mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Add user secrets (#22191)
Fixes #22183 Replaces #22187 This PR adds secrets for users. I refactored the files for organizations and repos to use the same logic and templates. I splitted the secrets from deploy keys again and reverted the fix from #22187. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
45
routers/web/user/setting/secrets.go
Normal file
45
routers/web/user/setting/secrets.go
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package setting
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
shared "code.gitea.io/gitea/routers/web/shared/secrets"
|
||||
)
|
||||
|
||||
const (
|
||||
tplSettingsSecrets base.TplName = "user/settings/secrets"
|
||||
)
|
||||
|
||||
func Secrets(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("secrets.secrets")
|
||||
ctx.Data["PageIsSettingsSecrets"] = true
|
||||
|
||||
shared.SetSecretsContext(ctx, ctx.Doer.ID, 0)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.HTML(http.StatusOK, tplSettingsSecrets)
|
||||
}
|
||||
|
||||
func SecretsPost(ctx *context.Context) {
|
||||
shared.PerformSecretsPost(
|
||||
ctx,
|
||||
ctx.Doer.ID,
|
||||
0,
|
||||
setting.AppSubURL+"/user/settings/secrets",
|
||||
)
|
||||
}
|
||||
|
||||
func SecretsDelete(ctx *context.Context) {
|
||||
shared.PerformSecretsDelete(
|
||||
ctx,
|
||||
setting.AppSubURL+"/user/settings/secrets",
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user