aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org/setting_secrets.go
blob: 1cdbe35f32adeb5ba8423710f1d791595070edf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package org

import (
	"net/http"

	"code.gitea.io/gitea/modules/base"
	"code.gitea.io/gitea/modules/context"
	shared "code.gitea.io/gitea/routers/web/shared/secrets"
)

const (
	tplSettingsSecrets base.TplName = "org/settings/secrets"
)

// Secrets render organization secrets page
func Secrets(ctx *context.Context) {
	ctx.Data["Title"] = ctx.Tr("secrets.secrets")
	ctx.Data["PageIsOrgSettings"] = true
	ctx.Data["PageIsOrgSettingsSecrets"] = true

	shared.SetSecretsContext(ctx, ctx.ContextUser.ID, 0)
	if ctx.Written() {
		return
	}

	ctx.HTML(http.StatusOK, tplSettingsSecrets)
}

// SecretsPost add secrets
func SecretsPost(ctx *context.Context) {
	shared.PerformSecretsPost(
		ctx,
		ctx.ContextUser.ID,
		0,
		ctx.Org.OrgLink+"/settings/secrets",
	)
}

// SecretsDelete delete secrets
func SecretsDelete(ctx *context.Context) {
	shared.PerformSecretsDelete(
		ctx,
		ctx.Org.OrgLink+"/settings/secrets",
	)
}