mirror of
https://github.com/go-gitea/gitea
synced 2024-12-27 02:54:27 +00:00
1ee59f0fa3
We have some instances that only allow using an external authentication source for authentication. In this case, users changing their email, password, or linked OpenID connections will not have any effect, and we'd like to prevent showing that to them to prevent confusion. Included in this are several changes to support this: * A new setting to disable user managed authentication credentials (email, password & OpenID connections) * A new setting to disable user managed MFA (2FA codes & WebAuthn) * Fix an issue where some templates had separate logic for determining if a feature was disabled since it didn't check the globally disabled features * Hide more user setting pages in the navbar when their settings aren't enabled --------- Co-authored-by: Kyle D <kdumontnu@gmail.com>
41 lines
977 B
Go
41 lines
977 B
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
user_model "code.gitea.io/gitea/models/user"
|
|
"code.gitea.io/gitea/modules/base"
|
|
"code.gitea.io/gitea/modules/setting"
|
|
shared_user "code.gitea.io/gitea/routers/web/shared/user"
|
|
"code.gitea.io/gitea/services/context"
|
|
)
|
|
|
|
const (
|
|
tplSettingsBlockedUsers base.TplName = "user/settings/blocked_users"
|
|
)
|
|
|
|
func BlockedUsers(ctx *context.Context) {
|
|
ctx.Data["Title"] = ctx.Tr("user.block.list")
|
|
ctx.Data["PageIsSettingsBlockedUsers"] = true
|
|
ctx.Data["UserDisabledFeatures"] = user_model.DisabledFeaturesWithLoginType(ctx.Doer)
|
|
|
|
shared_user.BlockedUsers(ctx, ctx.Doer)
|
|
if ctx.Written() {
|
|
return
|
|
}
|
|
|
|
ctx.HTML(http.StatusOK, tplSettingsBlockedUsers)
|
|
}
|
|
|
|
func BlockedUsersPost(ctx *context.Context) {
|
|
shared_user.BlockedUsersPost(ctx, ctx.Doer)
|
|
if ctx.Written() {
|
|
return
|
|
}
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/user/settings/blocked_users")
|
|
}
|