Fix add authentication page (#16543)
* Fix add authentication page There is a regression in #16199 whereby the add authentication page fails to react to the change in selected type. This is due to the String() method on the LoginSourceType which is ameliorated with an Int() function being added. Following on from this there are a few other related bugs. Fix #16541 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
fd15fd4c67
commit
6a33b290a0
|
@ -36,6 +36,11 @@ func (typ LoginType) String() string {
|
||||||
return LoginNames[typ]
|
return LoginNames[typ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Int returns the int value of the LoginType
|
||||||
|
func (typ LoginType) Int() int {
|
||||||
|
return int(typ)
|
||||||
|
}
|
||||||
|
|
||||||
// LoginNames contains the name of LoginType values.
|
// LoginNames contains the name of LoginType values.
|
||||||
var LoginNames = map[LoginType]string{
|
var LoginNames = map[LoginType]string{
|
||||||
LoginLDAP: "LDAP (via BindDN)",
|
LoginLDAP: "LDAP (via BindDN)",
|
||||||
|
@ -218,6 +223,10 @@ func CreateLoginSource(source *LoginSource) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if settable, ok := source.Cfg.(LoginSourceSettable); ok {
|
||||||
|
settable.SetLoginSource(source)
|
||||||
|
}
|
||||||
|
|
||||||
registerableSource, ok := source.Cfg.(RegisterableSource)
|
registerableSource, ok := source.Cfg.(RegisterableSource)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
|
@ -320,6 +329,10 @@ func UpdateSource(source *LoginSource) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if settable, ok := source.Cfg.(LoginSourceSettable); ok {
|
||||||
|
settable.SetLoginSource(source)
|
||||||
|
}
|
||||||
|
|
||||||
registerableSource, ok := source.Cfg.(RegisterableSource)
|
registerableSource, ok := source.Cfg.(RegisterableSource)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -19,6 +19,11 @@ func (s SecurityProtocol) String() string {
|
||||||
return SecurityProtocolNames[s]
|
return SecurityProtocolNames[s]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Int returns the int value of the SecurityProtocol
|
||||||
|
func (s SecurityProtocol) Int() int {
|
||||||
|
return int(s)
|
||||||
|
}
|
||||||
|
|
||||||
// SecurityProtocolNames contains the name of SecurityProtocol values.
|
// SecurityProtocolNames contains the name of SecurityProtocol values.
|
||||||
var SecurityProtocolNames = map[SecurityProtocol]string{
|
var SecurityProtocolNames = map[SecurityProtocol]string{
|
||||||
SecurityProtocolUnencrypted: "Unencrypted",
|
SecurityProtocolUnencrypted: "Unencrypted",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<input type="hidden" name="id" value="{{.Source.ID}}">
|
<input type="hidden" name="id" value="{{.Source.ID}}">
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{$.i18n.Tr "admin.auths.auth_type"}}</label>
|
<label>{{$.i18n.Tr "admin.auths.auth_type"}}</label>
|
||||||
<input type="hidden" id="auth_type" name="type" value="{{.Source.Type}}">
|
<input type="hidden" id="auth_type" name="type" value="{{.Source.Type.Int}}">
|
||||||
<span>{{.Source.TypeName}}</span>
|
<span>{{.Source.TypeName}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="required inline field {{if .Err_Name}}error{{end}}">
|
<div class="required inline field {{if .Err_Name}}error{{end}}">
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{{range .SecurityProtocols}}
|
{{range .SecurityProtocols}}
|
||||||
<div class="item" data-value="{{.Type}}">{{.Name}}</div>
|
<div class="item" data-value="{{.Type.Int}}">{{.Name}}</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
<div class="inline required field {{if .Err_Type}}error{{end}}">
|
<div class="inline required field {{if .Err_Type}}error{{end}}">
|
||||||
<label>{{.i18n.Tr "admin.auths.auth_type"}}</label>
|
<label>{{.i18n.Tr "admin.auths.auth_type"}}</label>
|
||||||
<div class="ui selection type dropdown">
|
<div class="ui selection type dropdown">
|
||||||
<input type="hidden" id="auth_type" name="type" value="{{.type}}">
|
<input type="hidden" id="auth_type" name="type" value="{{.type.Int}}">
|
||||||
<div class="text">{{.CurrentTypeName}}</div>
|
<div class="text">{{.CurrentTypeName}}</div>
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{{range .AuthSources}}
|
{{range .AuthSources}}
|
||||||
<div class="item" data-value="{{.Type}}">{{.Name}}</div>
|
<div class="item" data-value="{{.Type.Int}}">{{.Name}}</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{{range .SecurityProtocols}}
|
{{range .SecurityProtocols}}
|
||||||
<div class="item" data-value="{{.Type}}">{{.Name}}</div>
|
<div class="item" data-value="{{.Type.Int}}">{{.Name}}</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue