mirror of
https://github.com/thomiceli/opengist
synced 2024-11-08 12:55:50 +01:00
Include HTML buttons
This commit is contained in:
parent
4008b7ce38
commit
2d42cf798c
@ -163,7 +163,7 @@ func oauthCallback(ctx echo.Context) error {
|
|||||||
|
|
||||||
if err = userDB.Create(); err != nil {
|
if err = userDB.Create(); err != nil {
|
||||||
if models.IsUniqueConstraintViolation(err) {
|
if models.IsUniqueConstraintViolation(err) {
|
||||||
addFlash(ctx, "Username "+user.NickName+" already exists in opengist", "error")
|
addFlash(ctx, "Username "+user.NickName+" already exists in Opengist", "error")
|
||||||
return redirect(ctx, "/login")
|
return redirect(ctx, "/login")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +249,9 @@ func dataInit(next echo.HandlerFunc) echo.HandlerFunc {
|
|||||||
}
|
}
|
||||||
setData(ctx, "signupDisabled", disableSignup == "1")
|
setData(ctx, "signupDisabled", disableSignup == "1")
|
||||||
|
|
||||||
|
setData(ctx, "githubOauth", config.C.GithubClientKey != "" && config.C.GithubSecret != "")
|
||||||
|
setData(ctx, "giteaOauth", config.C.GiteaClientKey != "" && config.C.GiteaSecret != "")
|
||||||
|
|
||||||
return next(ctx)
|
return next(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
templates/pages/auth_form.html
vendored
19
templates/pages/auth_form.html
vendored
@ -48,6 +48,25 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ .csrfHtml }}
|
{{ .csrfHtml }}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div class="relative my-4">
|
||||||
|
<div class="absolute inset-0 flex items-center" aria-hidden="true">
|
||||||
|
<div class="w-full border-t border-gray-700"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="">
|
||||||
|
{{ if .githubOauth }}
|
||||||
|
<a href="/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
|
Continue with GitHub account
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .giteaOauth }}
|
||||||
|
<a href="/oauth/gitea" class="block w-full mb-2 text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
|
Continue with Gitea account
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
48
templates/pages/settings.html
vendored
48
templates/pages/settings.html
vendored
@ -7,7 +7,7 @@
|
|||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="sm:grid grid-cols-3 gap-x-4 md:gap-x-8">
|
<div class="sm:grid {{ if or .githubOauth .giteaOauth }}grid-cols-3{{else}}grid-cols-2{{end}} gap-x-4 md:gap-x-8">
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
||||||
<h2 class="text-md font-bold text-slate-300">
|
<h2 class="text-md font-bold text-slate-300">
|
||||||
@ -27,34 +27,42 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ if or .githubOauth .giteaOauth }}
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
||||||
<h2 class="text-md font-bold text-slate-300 mb-2">
|
<h2 class="text-md font-bold text-slate-300 mb-2">
|
||||||
Link accounts
|
Link accounts
|
||||||
</h2>
|
</h2>
|
||||||
<div class="gap-y-2">
|
<div class="gap-y-2">
|
||||||
{{ if .userLogged.GithubID }}
|
|
||||||
<a href="/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
|
||||||
Unlink GitHub account
|
|
||||||
</a>
|
|
||||||
{{ else }}
|
|
||||||
<a href="/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
|
||||||
Link GitHub account
|
|
||||||
</a>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if .userLogged.GiteaID }}
|
{{ if .githubOauth }}
|
||||||
<a href="/oauth/gitea" class="block w-full text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
{{ if .userLogged.GithubID }}
|
||||||
Unlink Gitea account
|
<a href="/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
</a>
|
Unlink GitHub account
|
||||||
{{ else }}
|
</a>
|
||||||
<a href="/oauth/gitea" class="block w-full text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
{{ else }}
|
||||||
Link Gitea account
|
<a href="/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
</a>
|
Link GitHub account
|
||||||
{{ end }}
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .giteaOauth }}
|
||||||
|
{{ if .userLogged.GiteaID }}
|
||||||
|
<a href="/oauth/gitea" class="block w-full text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
|
Unlink Gitea account
|
||||||
|
</a>
|
||||||
|
{{ else }}
|
||||||
|
<a href="/oauth/gitea" class="block w-full text-center whitespace-nowrap text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-600 bg-gray-800 px-2.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
|
Link Gitea account
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
||||||
<h2 class="text-md font-bold text-slate-300">
|
<h2 class="text-md font-bold text-slate-300">
|
||||||
@ -68,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:grid grid-cols-2 gap-x-4 md:gap-x-16">
|
<div class="sm:grid grid-cols-2 gap-x-4 md:gap-x-8">
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
||||||
<h2 class="text-md font-bold text-slate-300">
|
<h2 class="text-md font-bold text-slate-300">
|
||||||
|
Loading…
Reference in New Issue
Block a user