1
0
Fork 0
forked from forgejo/forgejo

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:
zeripath 2021-07-25 08:09:52 +01:00 committed by GitHub
parent fd15fd4c67
commit 6a33b290a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 5 deletions

View file

@ -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