summaryrefslogtreecommitdiffstats
path: root/routers/web/user/setting
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-02-01 13:53:04 +0100
committerGitHub <noreply@github.com>2023-02-01 20:53:04 +0800
commit5882e179a93a00a0635c6c578ec6d43ce68d687b (patch)
treee1bba3b2d88f74e95f05214bedebc616e2452805 /routers/web/user/setting
parent9f9a1ce92292739c3d0b5ee4bb654d883eb3b869 (diff)
downloadgitea-5882e179a93a00a0635c6c578ec6d43ce68d687b.tar.gz
gitea-5882e179a93a00a0635c6c578ec6d43ce68d687b.zip
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>
Diffstat (limited to 'routers/web/user/setting')
-rw-r--r--routers/web/user/setting/secrets.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/routers/web/user/setting/secrets.go b/routers/web/user/setting/secrets.go
new file mode 100644
index 0000000000..3a57897d8f
--- /dev/null
+++ b/routers/web/user/setting/secrets.go
@@ -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",
+ )
+}