Hide change password form when login via password disabled (#314)

This commit is contained in:
Thomas Miceli 2024-09-03 17:48:45 +02:00 committed by GitHub
parent 069a999297
commit f881e1c13c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -29,6 +29,7 @@ func userSettings(ctx echo.Context) error {
setData(ctx, "email", user.Email) setData(ctx, "email", user.Email)
setData(ctx, "sshKeys", keys) setData(ctx, "sshKeys", keys)
setData(ctx, "hasPassword", user.Password != "") setData(ctx, "hasPassword", user.Password != "")
setData(ctx, "disableForm", getData(ctx, "DisableLoginForm"))
setData(ctx, "htmlTitle", trH(ctx, "settings")) setData(ctx, "htmlTitle", trH(ctx, "settings"))
return html(ctx, "settings.html") return html(ctx, "settings.html")
} }

View file

@ -7,7 +7,7 @@
</header> </header>
<main> <main>
<div class="relative mx-auto max-w-[40rem] space-y-8"> <div class="relative mx-auto max-w-[40rem] space-y-8">
<div class="sm:grid grid-cols-2 gap-x-4 md:gap-x-8 space-y-8 md:space-y-0"> <div class="sm:grid {{ if not .disableForm }}grid-cols-2{{ else }}grid-cols-1{{ end }} gap-x-4 md:gap-x-8 space-y-8 md:space-y-0">
<div class="w-full"> <div class="w-full">
<div class="bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10 h-full"> <div class="bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10 h-full">
<h2 class="text-md font-bold text-slate-700 dark:text-slate-300"> <h2 class="text-md font-bold text-slate-700 dark:text-slate-300">
@ -28,6 +28,7 @@
</form> </form>
</div> </div>
</div> </div>
{{ if not .disableForm }}
<div class="w-full"> <div class="w-full">
<div class="bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10"> <div class="bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
<h2 class="text-md font-bold text-slate-700 dark:text-slate-300"> <h2 class="text-md font-bold text-slate-700 dark:text-slate-300">
@ -64,6 +65,7 @@
</form> </form>
</div> </div>
</div> </div>
{{ end }}
</div> </div>
<div class="w-full"> <div class="w-full">
<div class="bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10"> <div class="bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">