Add an optional site password for visitors
Settings → Privacy can set a password for the whole public site. Until a visitor enters it, every public page shows a prompt over a blurred made-up page, and images, preview clips and exports return 401; nothing real is sent. Unlocking sets a 90-day cookie derived from the password hash, so changing the password asks everyone again. The owner is never asked while signed in. Wrong guesses are rate limited, and a locked site sends noindex. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
568162202b
commit
06097d3bca
11 files changed
+302
-9
No files matched your search
@@ -0,0 +1,28 @@
|
||||
{{define "bodyclass"}}page-gate{{end}}
|
||||
{{define "content"}}
|
||||
{{- /* A made-up page shape to blur behind the prompt. None of the real
|
||||
site is sent until the password is entered. */}}
|
||||
<div class="gate-bg" aria-hidden="true">
|
||||
<div class="container">
|
||||
<div class="gate-sk-profile"><span class="gate-sk-avatar"></span><span class="gate-sk-lines"><i></i><i></i></span></div>
|
||||
<div class="gate-sk-shelf"><i class="gate-sk-heading"></i><div class="gate-sk-row"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div></div>
|
||||
<div class="gate-sk-shelf"><i class="gate-sk-heading"></i><div class="gate-sk-row"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div></div>
|
||||
<div class="gate-sk-shelf"><i class="gate-sk-heading"></i><div class="gate-sk-row"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<section class="auth-card gate-card">
|
||||
<div class="auth-mark">{{icon "lock"}}</div>
|
||||
<h1>{{.Site.Title}}</h1>
|
||||
<p class="muted">This collection is private. Enter the password to see it.</p>
|
||||
{{with .Data.Error}}<p class="alert alert--error" role="alert">{{icon "alert"}}{{.}}</p>{{end}}
|
||||
<form method="post" action="/unlock" class="stack">
|
||||
<input type="hidden" name="next" value="{{.Data.Next}}">
|
||||
<label class="field">
|
||||
<span class="field-label">Password</span>
|
||||
<input name="password" type="password" autocomplete="current-password" required autofocus>
|
||||
</label>
|
||||
<button class="btn btn--primary btn--block" type="submit">Enter</button>
|
||||
</form>
|
||||
<a class="auth-back" href="/login?next=/admin">{{icon "user"}}Owner sign in</a>
|
||||
</section>
|
||||
{{end}}
|
||||
Reference in new issue
Block a user