mirror of https://github.com/go-gitea/gitea.git
#1124 LDAP add and edit form are misleading
This commit is contained in:
parent
9c67a19332
commit
211596f407
|
@ -10,25 +10,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AuthenticationForm struct {
|
type AuthenticationForm struct {
|
||||||
Id int64 `form:"id"`
|
ID int64 `form:"id"`
|
||||||
Type int `form:"type"`
|
Type int
|
||||||
AuthName string `form:"name" binding:"Required;MaxSize(50)"`
|
Name string `binding:"Required;MaxSize(50)"`
|
||||||
Domain string `form:"domain"`
|
Domain string
|
||||||
Host string `form:"host"`
|
Host string
|
||||||
Port int `form:"port"`
|
Port int
|
||||||
UseSSL bool `form:"usessl"`
|
UseSSL bool `form:"usessl"`
|
||||||
BaseDN string `form:"base_dn"`
|
BaseDN string `form:"base_dn"`
|
||||||
AttributeUsername string `form:"attribute_username"`
|
AttributeUsername string
|
||||||
AttributeName string `form:"attribute_name"`
|
AttributeName string
|
||||||
AttributeSurname string `form:"attribute_surname"`
|
AttributeSurname string
|
||||||
AttributeMail string `form:"attribute_mail"`
|
AttributeMail string
|
||||||
Filter string `form:"filter"`
|
Filter string
|
||||||
MsAdSA string `form:"ms_ad_sa"`
|
MsAdSA string `form:"ms_ad_sa"`
|
||||||
IsActived bool `form:"is_actived"`
|
IsActived bool
|
||||||
SmtpAuth string `form:"smtpauth"`
|
SMTPAuth string `form:"smtp_auth"`
|
||||||
SmtpHost string `form:"smtphost"`
|
SMTPHost string `form:"smtp_host"`
|
||||||
SmtpPort int `form:"smtpport"`
|
SMTPPort int `form:"smtp_port"`
|
||||||
Tls bool `form:"tls"`
|
TLS bool `form:"tls"`
|
||||||
AllowAutoRegister bool `form:"allowautoregister"`
|
AllowAutoRegister bool `form:"allowautoregister"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,15 +74,15 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
Filter: form.Filter,
|
Filter: form.Filter,
|
||||||
MsAdSAFormat: form.MsAdSA,
|
MsAdSAFormat: form.MsAdSA,
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Name: form.AuthName,
|
Name: form.Name,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
case models.SMTP:
|
case models.SMTP:
|
||||||
u = &models.SMTPConfig{
|
u = &models.SMTPConfig{
|
||||||
Auth: form.SmtpAuth,
|
Auth: form.SMTPAuth,
|
||||||
Host: form.SmtpHost,
|
Host: form.SMTPHost,
|
||||||
Port: form.SmtpPort,
|
Port: form.SMTPPort,
|
||||||
TLS: form.Tls,
|
TLS: form.TLS,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ctx.Error(400)
|
ctx.Error(400)
|
||||||
|
@ -91,7 +91,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
|
|
||||||
var source = &models.LoginSource{
|
var source = &models.LoginSource{
|
||||||
Type: models.LoginType(form.Type),
|
Type: models.LoginType(form.Type),
|
||||||
Name: form.AuthName,
|
Name: form.Name,
|
||||||
IsActived: true,
|
IsActived: true,
|
||||||
AllowAutoRegister: form.AllowAutoRegister,
|
AllowAutoRegister: form.AllowAutoRegister,
|
||||||
Cfg: u,
|
Cfg: u,
|
||||||
|
@ -102,7 +102,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.AuthName)
|
log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/admin/auths")
|
ctx.Redirect(setting.AppSubUrl + "/admin/auths")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,15 +156,15 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
Filter: form.Filter,
|
Filter: form.Filter,
|
||||||
MsAdSAFormat: form.MsAdSA,
|
MsAdSAFormat: form.MsAdSA,
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
Name: form.AuthName,
|
Name: form.Name,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
case models.SMTP:
|
case models.SMTP:
|
||||||
config = &models.SMTPConfig{
|
config = &models.SMTPConfig{
|
||||||
Auth: form.SmtpAuth,
|
Auth: form.SMTPAuth,
|
||||||
Host: form.SmtpHost,
|
Host: form.SMTPHost,
|
||||||
Port: form.SmtpPort,
|
Port: form.SMTPPort,
|
||||||
TLS: form.Tls,
|
TLS: form.TLS,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ctx.Error(400)
|
ctx.Error(400)
|
||||||
|
@ -172,8 +172,8 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
u := models.LoginSource{
|
u := models.LoginSource{
|
||||||
Id: form.Id,
|
Id: form.ID,
|
||||||
Name: form.AuthName,
|
Name: form.Name,
|
||||||
IsActived: form.IsActived,
|
IsActived: form.IsActived,
|
||||||
Type: models.LoginType(form.Type),
|
Type: models.LoginType(form.Type),
|
||||||
AllowAutoRegister: form.AllowAutoRegister,
|
AllowAutoRegister: form.AllowAutoRegister,
|
||||||
|
@ -185,7 +185,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, form.AuthName)
|
log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, form.Name)
|
||||||
ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
|
ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"))
|
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,11 @@
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attribute_username" name="attribute_username" value="{{.Source.LDAP.AttributeUsername}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attribute_username" name="attribute_username" value="{{.Source.LDAP.AttributeUsername}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label>
|
<label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attribute_name" name="attribute_name" value="{{.Source.LDAP.AttributeName}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attribute_name" name="attribute_name" value="{{.Source.LDAP.AttributeName}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label>
|
<label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attribute_surname" name="attribute_surname" value="{{.Source.LDAP.AttributeSurname}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attribute_surname" name="attribute_surname" value="{{.Source.LDAP.AttributeSurname}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
{{else if eq $type 3}}
|
{{else if eq $type 3}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
|
<label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
|
||||||
<select name="smtpauth">
|
<select name="smtp_auth">
|
||||||
{{$auth := .Source.SMTP.Auth}}
|
{{$auth := .Source.SMTP.Auth}}
|
||||||
{{range .SMTPAuths}}
|
{{range .SMTPAuths}}
|
||||||
<option value="{{.}}"
|
<option value="{{.}}"
|
||||||
|
@ -84,12 +84,12 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="smtphost">{{.i18n.Tr "admin.auths.smtphost"}}</label>
|
<label class="req" for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpHost}}ipt-error{{end}}" id="smtphost" name="smtphost" value="{{.Source.SMTP.Host}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpHost}}ipt-error{{end}}" id="smtp_host" name="smtp_host" value="{{.Source.SMTP.Host}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="smtpport">{{.i18n.Tr "admin.auths.smtpport"}}</label>
|
<label class="req" for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtpport" name="smtpport" value="{{.Source.SMTP.Port}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtp_port" name="smtp_port" value="{{.Source.SMTP.Port}}" />
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,20 @@
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_BaseDN}}ipt-error{{end}}" id="base_dn" name="base_dn" value="{{.base_dn}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_BaseDN}}ipt-error{{end}}" id="base_dn" name="base_dn" value="{{.base_dn}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="attributes">{{.i18n.Tr "admin.auths.attributes"}}</label>
|
<label class="req" for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Attributes}}ipt-error{{end}}" id="attributes" name="attributes" value="{{.attributes}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_AttributeUsername}}ipt-error{{end}}" id="attribute_username" name="attribute_username" value="{{.attribute_username}}" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label>
|
||||||
|
<input class="ipt ipt-large ipt-radius {{if .Err_AttributeName}}ipt-error{{end}}" id="attribute_name" name="attribute_name" value="{{.attribute_name}}" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label>
|
||||||
|
<input class="ipt ipt-large ipt-radius {{if .Err_AttributeSurname}}ipt-error{{end}}" id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="req" for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label>
|
||||||
|
<input class="ipt ipt-large ipt-radius {{if .Err_AttributeMail}}ipt-error{{end}}" id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="filter">{{.i18n.Tr "admin.auths.filter"}}</label>
|
<label class="req" for="filter">{{.i18n.Tr "admin.auths.filter"}}</label>
|
||||||
|
@ -59,19 +71,19 @@
|
||||||
<div class="smtp hidden">
|
<div class="smtp hidden">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
|
<label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
|
||||||
<select name="smtpauth">
|
<select name="smtp_auth">
|
||||||
{{range .SMTPAuths}}
|
{{range .SMTPAuths}}
|
||||||
<option value="{{.}}">{{.}}</option>
|
<option value="{{.}}">{{.}}</option>
|
||||||
{{end}}
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="smtphost">{{.i18n.Tr "admin.auths.smtphost"}}</label>
|
<label class="req" for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpHost}}ipt-error{{end}}" id="smtphost" name="smtphost" value="{{.smtphost}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpHost}}ipt-error{{end}}" id="smtp_host" name="smtp_host" value="{{.smtp_host}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="smtpport">{{.i18n.Tr "admin.auths.smtpport"}}</label>
|
<label class="req" for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtpport" name="smtpport" value="{{.smtpport}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtp_port" name="smtp_port" value="{{.smtp_port}}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
Loading…
Reference in New Issue