Add require login feature to see gists

This commit is contained in:
Thomas Miceli
2023-04-28 20:31:10 +02:00
parent 64d0818c9f
commit 333efeacbf
12 changed files with 77 additions and 23 deletions

View File

@ -66,7 +66,7 @@
</svg>
</a>
{{ else }}
{{ if not .signupDisabled }}
{{ if not .DisableSignup }}
<a href="/register" class="inline-flex text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">
<p class="text-slate-300 mr-1">Register</p>
</a>

View File

@ -81,7 +81,11 @@
<div class="space-y-2">
<div>
<label for="disable-signup" class="text-sm text-slate-300">Disable signup</label>
<input type="checkbox" id="disable-signup" name="disable-signup" {{ if .signupDisabled }}checked="checked"{{ end }} class="ml-1 h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-600" />
<input type="checkbox" id="disable-signup" name="disable-signup" {{ if .DisableSignup }}checked="checked"{{ end }} class="ml-1 h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-600" />
</div>
<div>
<label for="disable-signup" class="text-sm text-slate-300">Login required</label>
<input type="checkbox" id="require-login" name="require-login" {{ if .RequireLogin }}checked="checked"{{ end }} class="ml-1 h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-600" />
</div>
</div>
</div>

View File

@ -8,7 +8,7 @@
</header>
<main class="mt-4">
{{ if and .signupDisabled (ne .title "Login") }}
{{ if and .DisableSignup (ne .title "Login") }}
<p class="italic">Administrator has disabled signing up</p>
{{ else }}
<div class="sm:col-span-6">
@ -33,7 +33,7 @@
<div class="flex-auto">
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent border-gray-700 text-sm font-medium rounded-md shadow-sm text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">Login</button>
</div>
{{ if not .signupDisabled }}
{{ if not .DisableSignup }}
<span class="float-right text-sm py-2 underline"><a href="/register">Register instead →</a></span>
{{ end }}
</div>