mirror of https://github.com/gogs/gogs.git
auth: support set default login source (#5274)
parent
68a6579852
commit
b68de2330d
|
@ -1102,6 +1102,7 @@ auths.new = Add New Source
|
|||
auths.name = Name
|
||||
auths.type = Type
|
||||
auths.enabled = Enabled
|
||||
auths.default = Default
|
||||
auths.updated = Updated
|
||||
auths.auth_type = Authentication Type
|
||||
auths.auth_name = Authentication Name
|
||||
|
@ -1140,6 +1141,7 @@ auths.pam_service_name = PAM Service Name
|
|||
auths.enable_auto_register = Enable Auto Registration
|
||||
auths.edit = Edit Authentication Setting
|
||||
auths.activated = This authentication is activated
|
||||
auths.default_auth = This authentication is default login source
|
||||
auths.new_success = New authentication '%s' has been added successfully.
|
||||
auths.update_success = Authentication setting has been updated successfully.
|
||||
auths.update = Update Authentication Setting
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/gogs/gogs/pkg/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.11.63.0910"
|
||||
const APP_VER = "0.11.64.0913"
|
||||
|
||||
func init() {
|
||||
setting.AppVer = APP_VER
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -115,10 +115,8 @@ func Login(c *context.Context) {
|
|||
c.Data["LoginSources"] = loginSources
|
||||
for i := range loginSources {
|
||||
if loginSources[i].IsDefault {
|
||||
c.Data["DefaultSource"] = *loginSources[i]
|
||||
c.Data["DefaultLoginSource"] = loginSources[i]
|
||||
c.Data["login_source"] = loginSources[i].ID
|
||||
newLoginSources := append(loginSources[:i], loginSources[i+1:]...)
|
||||
c.Data["LoginSources"] = newLoginSources
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -183,10 +181,7 @@ func LoginPost(c *context.Context, f form.SignIn) {
|
|||
}
|
||||
for i := range loginSources {
|
||||
if loginSources[i].IsDefault {
|
||||
c.Data["DefaultSource"] = *loginSources[i]
|
||||
c.Data["login_source"] = loginSources[i].ID
|
||||
newLoginSources := append(loginSources[:i], loginSources[i+1:]...)
|
||||
c.Data["LoginSources"] = newLoginSources
|
||||
c.Data["DefaultLoginSource"] = loginSources[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.11.63.0910
|
||||
0.11.64.0913
|
||||
|
|
|
@ -22,30 +22,20 @@
|
|||
<label for="password">{{.i18n.Tr "auth.auth_source"}}</label>
|
||||
<div class="ui selection dropdown">
|
||||
<input type="hidden" id="login_source" name="login_source" value="{{.login_source}}" required>
|
||||
{{if .DefaultSource}}
|
||||
<span class="text">
|
||||
{{.DefaultSource.Name}}
|
||||
</span>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<div class="item" data-value="{{.DefaultSource.ID}}">{{.DefaultSource.Name}}</div>
|
||||
<div class="item" data-value="0">{{.i18n.Tr "auth.local"}}</div>
|
||||
{{range .LoginSources}}
|
||||
<div class="item" data-value="{{.ID}}">{{.Name}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<span class="text">
|
||||
<span class="text">
|
||||
{{if .DefaultLoginSource}}
|
||||
{{.DefaultLoginSource.Name}}
|
||||
{{else}}
|
||||
{{.i18n.Tr "auth.local"}}
|
||||
</span>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<div class="item" data-value="0">{{.i18n.Tr "auth.local"}}</div>
|
||||
{{range .LoginSources}}
|
||||
<div class="item" data-value="{{.ID}}">{{.Name}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</span>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<div class="item" data-value="0">{{.i18n.Tr "auth.local"}}</div>
|
||||
{{range .LoginSources}}
|
||||
<div class="item" data-value="{{.ID}}">{{.Name}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
|
Loading…
Reference in New Issue