Commit f1638589 authored by zauberstuhl's avatar zauberstuhl

Display revoke information on success

parent 4c66c6c9
Pipeline #779 passed with stage
in 2 minutes and 1 second
......@@ -38,9 +38,19 @@ func render(w http.ResponseWriter, name string, s interface{}) {
rootTmpl := template.New("").Funcs(template.FuncMap{
"add": add,
"len": length,
"isGitlab": func(serverType ServerType) bool {
return serverType == GITLAB
},
"removeHTTP": func(s string) string {
return strings.TrimPrefix(strings.TrimPrefix(s, "https://"), "http://")
},
"getOrgaFromSlug": func(s string) string {
sArr := strings.Split(s, "/")
if len(sArr) > 0 {
return sArr[0]
}
return ""
},
})
tmpl, err := rootTmpl.ParseFiles(
......@@ -82,6 +92,7 @@ func resultPage(w http.ResponseWriter, r *http.Request) {
secret := Secret(16)
isGithub := accessToken != "" && repo != "" && projectName != ""
isGitlab := server != "" && isGithub
isGithub = isGithub && !isGitlab
if !isGitlab && !isGithub {
render(w, "error.html", "Missing parameters: accessToken, server, repo or project")
......@@ -134,10 +145,7 @@ func resultPage(w http.ResponseWriter, r *http.Request) {
return
}
render(w, "result.html", struct{
Gitlab bool
Project Project
}{Gitlab: isGitlab, Project: project})
render(w, "result.html", project)
}
func authGitlabPage(w http.ResponseWriter, r *http.Request) {
......
......@@ -5,7 +5,14 @@
<div class="container">
<div class="alert alert-success" role="alert">
<h4>Success :)</h4>
You can undo it by simply deleting the ...
You can undo it by simply deleting the
<a href="{{.FQDN}}/{{.Slug}}/settings/{{if isGitlab .Type}}integrations{{else}}hooks{{end}}">webhook</a> and revoking the
{{if isGitlab .Type}}
<a href="{{.FQDN}}/profile/personal_access_tokens">access token</a>.
{{else}}
{{$orga := getOrgaFromSlug .Slug}}
<a href="{{.FQDN}}/organizations/{{$orga}}/settings/oauth_application_policy">oauth client</a> permissions.
{{end}}
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment