aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-07-25 08:09:52 +0100
committerGitHub <noreply@github.com>2021-07-25 08:09:52 +0100
commit6a33b290a09b623bfb85d0bc03b2c7e6524ecf2d (patch)
tree331ec300f1aff93eedd9273cfb8f2a90f63028e6 /models
parentfd15fd4c67b22189a18765f888bb3f19e241acbe (diff)
downloadgitea-6a33b290a09b623bfb85d0bc03b2c7e6524ecf2d.tar.gz
gitea-6a33b290a09b623bfb85d0bc03b2c7e6524ecf2d.zip
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>
Diffstat (limited to 'models')
-rw-r--r--models/login_source.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/login_source.go b/models/login_source.go
index 5e1c6e2224..3a48074e9a 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