Fix login page disabled depending on locale (#120)

This commit is contained in:
Thomas Miceli 2023-09-28 20:09:08 +02:00 committed by GitHub
parent bae18ecb0a
commit 4eedfdcf6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -31,6 +31,7 @@ func register(ctx echo.Context) error {
setData(ctx, "title", tr(ctx, "auth.new-account")) setData(ctx, "title", tr(ctx, "auth.new-account"))
setData(ctx, "htmlTitle", "New account") setData(ctx, "htmlTitle", "New account")
setData(ctx, "disableForm", getData(ctx, "DisableLoginForm")) setData(ctx, "disableForm", getData(ctx, "DisableLoginForm"))
setData(ctx, "isLoginPage", false)
return html(ctx, "auth_form.html") return html(ctx, "auth_form.html")
} }
@ -91,6 +92,7 @@ func login(ctx echo.Context) error {
setData(ctx, "title", tr(ctx, "auth.login")) setData(ctx, "title", tr(ctx, "auth.login"))
setData(ctx, "htmlTitle", "Login") setData(ctx, "htmlTitle", "Login")
setData(ctx, "disableForm", getData(ctx, "DisableLoginForm")) setData(ctx, "disableForm", getData(ctx, "DisableLoginForm"))
setData(ctx, "isLoginPage", true)
return html(ctx, "auth_form.html") return html(ctx, "auth_form.html")
} }

View file

@ -8,7 +8,7 @@
</header> </header>
<main class="mt-4"> <main class="mt-4">
{{ if and .DisableSignup (ne .title "Login") }} {{ if and .DisableSignup (not .isLoginPage) }}
<p class="italic">{{ .locale.Tr "auth.signup-disabled" }}</p> <p class="italic">{{ .locale.Tr "auth.signup-disabled" }}</p>
{{ else }} {{ else }}
<div class="sm:col-span-6"> <div class="sm:col-span-6">
@ -30,7 +30,7 @@
<input id="password" name="password" type="password" autocomplete="current-password" required class="dark:bg-gray-800 appearance-none block w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md shadow-sm placeholder-gray-600 dark:placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm"> <input id="password" name="password" type="password" autocomplete="current-password" required class="dark:bg-gray-800 appearance-none block w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md shadow-sm placeholder-gray-600 dark:placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
</div> </div>
</div> </div>
{{ if eq .title "Login" }} {{ if .isLoginPage }}
<div class="flex"> <div class="flex">
<div class="flex-auto"> <div class="flex-auto">
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent border-gray-200 dark:border-gray-700 text-sm font-medium rounded-md shadow-sm text-white dark:text-white bg-primary-500 hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">{{ .locale.Tr "auth.login" }}</button> <button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent border-gray-200 dark:border-gray-700 text-sm font-medium rounded-md shadow-sm text-white dark:text-white bg-primary-500 hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">{{ .locale.Tr "auth.login" }}</button>