mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 00:20:50 +00:00
feat: Add option to disable builtin authentication.
Setting ENABLE_INTERNAL_SIGNIN to false will disable the built-in signin form, should the administrator prefer to limit users to SSO. Continuation of forgejo/forgejo#6076
This commit is contained in:
parent
48b91fa31a
commit
a126477e86
6 changed files with 59 additions and 0 deletions
|
@ -164,6 +164,7 @@ func SignIn(ctx *context.Context) {
|
|||
ctx.Data["PageIsSignIn"] = true
|
||||
ctx.Data["PageIsLogin"] = true
|
||||
ctx.Data["EnableSSPI"] = auth.IsSSPIEnabled(ctx)
|
||||
ctx.Data["EnableInternalSignIn"] = setting.Service.EnableInternalSignIn
|
||||
|
||||
if setting.Service.EnableCaptcha && setting.Service.RequireCaptchaForLogin {
|
||||
context.SetCaptchaData(ctx)
|
||||
|
@ -187,6 +188,13 @@ func SignInPost(ctx *context.Context) {
|
|||
ctx.Data["PageIsSignIn"] = true
|
||||
ctx.Data["PageIsLogin"] = true
|
||||
ctx.Data["EnableSSPI"] = auth.IsSSPIEnabled(ctx)
|
||||
ctx.Data["EnableInternalSignIn"] = setting.Service.EnableInternalSignIn
|
||||
|
||||
// Permission denied if EnableInternalSignIn is false
|
||||
if !setting.Service.EnableInternalSignIn {
|
||||
ctx.Error(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(http.StatusOK, tplSignIn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue