diff --git a/models/login_source.go b/models/login_source.go index 5e1c6e22243..3a48074e9a7 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -36,6 +36,11 @@ func (typ LoginType) String() string { 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. var LoginNames = map[LoginType]string{ LoginLDAP: "LDAP (via BindDN)", @@ -218,6 +223,10 @@ func CreateLoginSource(source *LoginSource) error { return nil } + if settable, ok := source.Cfg.(LoginSourceSettable); ok { + settable.SetLoginSource(source) + } + registerableSource, ok := source.Cfg.(RegisterableSource) if !ok { return nil @@ -320,6 +329,10 @@ func UpdateSource(source *LoginSource) error { return nil } + if settable, ok := source.Cfg.(LoginSourceSettable); ok { + settable.SetLoginSource(source) + } + registerableSource, ok := source.Cfg.(RegisterableSource) if !ok { return nil diff --git a/services/auth/source/ldap/security_protocol.go b/services/auth/source/ldap/security_protocol.go index 47c9d30e5cf..bb0c7770a1d 100644 --- a/services/auth/source/ldap/security_protocol.go +++ b/services/auth/source/ldap/security_protocol.go @@ -19,6 +19,11 @@ func (s SecurityProtocol) String() string { 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. var SecurityProtocolNames = map[SecurityProtocol]string{ SecurityProtocolUnencrypted: "Unencrypted", diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 3fbfedefe70..22a2903b273 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -12,7 +12,7 @@