Updated a bunch of pages

This commit is contained in:
Asaf Gartner 2024-06-20 18:29:36 +03:00
parent f37635829d
commit 02a41f56bd
11 changed files with 165 additions and 179 deletions

View File

@ -1,10 +1,10 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="flex ph3 ph0-ns justify-center"> <div class="mw5 pv3 center">
<div class="w-100 w-auto-ns pv3"> <h1 class="mb2">Hi, {{ .Username }}!</h1>
<h1>Hi, {{ .Username }}!</h1> <div class="mb2">Please enter a new password.</div>
<form method="post" class="flex flex-column"> <form method="post" class="hmn-form flex flex-column g2">
<input type="hidden" name="token" value="{{ .Token }}" /> <input type="hidden" name="token" value="{{ .Token }}" />
{{/*NOTE: The username field isn't `type="hidden"` because this way browser will offer to save the username along with the password */}} {{/*NOTE: The username field isn't `type="hidden"` because this way browser will offer to save the username along with the password */}}
@ -16,23 +16,18 @@
readonly readonly
/> />
<div>Please enter a new password.</div>
<div class="mt2">
<label class="db b" for="password">New password</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="password" name="password"
type="password" type="password"
minlength="8" minlength="8"
placeholder="New password"
required required
/> />
</div>
<input class="db mt3 w-100" <input class="db w-100 btn-primary"
type="submit" type="submit"
value="Reset your password" value="Reset your password"
/> />
</form> </form>
</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -1,8 +1,16 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="mw7 ph3 ph0-ns pb3"> <div class="mw6 ph3 pv3 post-content center">
<form method="POST"> <h1>Hi, {{ .Username }}!</h1>
<p class="mb3 b">
You're almost done signing up.
</p>
<p>
To complete your registration and log in, please enter the password you used during the registration process.
</p>
<form method="POST" class="hmn-form flex flex-column g2 center mt4">
<input type="hidden" name="token" value="{{ .Token }}" /> <input type="hidden" name="token" value="{{ .Token }}" />
<input type="hidden" name="destination" value="{{ .DestinationURL }}" /> <input type="hidden" name="destination" value="{{ .DestinationURL }}" />
@ -14,23 +22,15 @@
value="{{ .Username }}" value="{{ .Username }}"
readonly readonly
/> />
<h1>Hi, {{ .Username }}!</h1>
<p class="mb3 b">
You're almost done signing up.
</p>
<p>
To complete your registration and log in, please enter the password you used during the registration process.
</p>
<label class="db b" for="password">Password</label>
<input class="db w-100 w-auto-ns" <input class="db w-100 w-auto-ns"
name="password" name="password"
type="password" type="password"
minlength="8" minlength="8"
placeholder="Password"
required required
/> />
<input class="db mt3 w-100 w-auto-ns" <input class="btn-primary db w-100 w-auto-ns"
type="submit" type="submit"
value="Complete registration" value="Complete registration"
/> />

View File

@ -1,37 +1,30 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="flex ph3 ph0-ns justify-center"> <div class="mw5 pv3 center">
<div class="w-100 w-auto-ns pv3"> <h1 class="mb2">Log in</h1>
<h1 class="tc">Log in</h1> <form method="POST" class="flex flex-column g2 hmn-form">
<form method="POST" class="flex flex-column">
<input type="hidden" name="redirect" value="{{ .RedirectUrl }}" /> <input type="hidden" name="redirect" value="{{ .RedirectUrl }}" />
<div>
<label class="db b" for="username">Username</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="username" name="username"
type="text" type="text"
minlength="3" maxlength="30" minlength="3" maxlength="30"
placeholder="Username"
required required
/> />
</div>
<div class="mt2">
<div class="flex justify-between">
<label class="db b" for="password">Password</label>
<a href="{{ .ForgotPasswordUrl }}" tabindex="-1">Forgot your password?</a>
</div>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="password" name="password"
type="password" type="password"
minlength="8" minlength="8"
placeholder="Password"
required required
/> />
</div> <a href="{{ .ForgotPasswordUrl }}" tabindex="-1">Forgot your password?</a>
<div class="mt3"> <div class="mt3">
<input class="w-100" type="submit" value="Log in" /> <input class="btn-primary w-100" type="submit" value="Log in" />
</div> </div>
<div class="tc pa3"> <div class="tc pa3">
@ -50,6 +43,5 @@
</div> </div>
</div> </div>
</form> </form>
</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -1,40 +1,32 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="flex ph3 ph0-ns justify-center"> <div class="mw5 pv3 center">
<div class="w-100 w-auto-ns pv3"> <h1 class="mb2">Reset your password</h1>
<h1 class="tc">Reset your password</h1> <form method="POST" class="hmn-form flex flex-column g2">
<form method="POST" class="flex flex-column">
<div>
<label class="db b" for="username">Username</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="username" name="username"
type="text" type="text"
minlength="3" maxlength="30" minlength="3" maxlength="30"
placeholder="Username"
required required
/> />
</div>
<div class="mt2">
<label class="db b" for="email">Email</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="email" name="email"
type="text" type="text"
placeholder="Email"
required required
/> />
</div>
<div class="mt3"> <input class="btn-primary w-100"
<input class="w-100"
type="submit" type="submit"
value="Request password reset" value="Request password reset"
/> />
</div>
<div class="note mt3 mw-none mw5-ns"> <div class="f7 mt3 mw-none mw5-ns">
Note: To avoid spamming you with password reset links, we limit the number of requests per account every 24 hours. Note: To avoid spamming you with password reset links, we limit the number of requests per account every 24 hours.
</div> </div>
</form> </form>
</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -1,7 +1,7 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="mw6 ph3 ph0-ns pb3"> <div class="mw6 ph3 pv3 post-content center">
<h1>A password reset link was sent.</h1> <h1>A password reset link was sent.</h1>
<p> <p>
It will expire in 24 hours. It will expire in 24 hours.

View File

@ -1,56 +1,48 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="flex ph3 ph0-ns justify-center"> <div class="flex ph3 justify-center">
<div class="w-100 w-auto-ns pv3"> <div class="w-100 w-auto-ns pv3">
<h1 class="tc">Sign up</h1> <h1 class="mb2">Sign up</h1>
<form method="POST" class="flex flex-column"> <form method="POST" class="flex flex-column g2 hmn-form">
{{/* NOTE(asaf): No CSRF on register. We don't have a user session yet and I don't think we would gain anything from a pre-login session here */}} {{/* NOTE(asaf): No CSRF on register. We don't have a user session yet and I don't think we would gain anything from a pre-login session here */}}
<input type="hidden" name="destination" value="{{ .DestinationURL }}" /> <input type="hidden" name="destination" value="{{ .DestinationURL }}" />
<div>
<label class="db b" for="username">Username</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="username" name="username"
type="text" type="text"
minlength="3" maxlength="30" minlength="3" maxlength="30"
pattern="^[0-9a-zA-Z][\w-]{2,29}$" pattern="^[0-9a-zA-Z][\w-]{2,29}$"
placeholder="Username"
required required
/> />
</div>
<div class="mt2">
<label class="db" for="displayname"><b>Display name</b> <span class="c--dim i">(optional)</span></label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="displayname" name="displayname"
placeholder="Display name (optional)"
type="text" type="text"
/> />
</div>
<div class="mt2">
<label class="db b" for="email">Email</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="email" name="email"
type="email" type="email"
placeholder="Email"
required required
/> />
</div>
<div class="mt2">
<label class="db b" for="password">Password</label>
<input class="db w-100 w5-ns" <input class="db w-100 w5-ns"
name="password" name="password"
type="password" type="password"
minlength="8" minlength="8"
placeholder="Password"
required required
/> />
</div>
{{/* TODO(asaf): Consider adding some bot-mitigation thing here */}} {{/* TODO(asaf): Consider adding some bot-mitigation thing here */}}
<div class="mt3"> <div class="mt3">
<input class="w-100" type="submit" value="Register" /> <input class="w-100 btn-primary" type="submit" value="Register" />
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,7 +1,7 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="mw7 ph3 ph0-ns"> <div class="mw6 ph3 pv3 center post-content">
<h1>Verify your email</h1> <h1>Verify your email</h1>
<p class="mb3 b"> <p class="mb3 b">
We've sent you an email with a confirmation link. Please follow it to complete the registration process. We've sent you an email with a confirmation link. Please follow it to complete the registration process.

View File

@ -1,9 +1,9 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
{{ $bannerclass := "overflow-hidden br2 mt2 h4 h5-ns cover bg-center" }} {{ $bannerclass := "overflow-hidden br2 mt2 h4 h5-ns cover bg-center" }}
<div class="m--center mw7 ph3 ph0-ns post-content flex flex-column g3"> <div class="center mw7 ph3 pv3 post-content flex flex-column g3">
<div class="fronke"> <div>
<a href="https://handmadehero.org/conference"> <a href="https://handmadehero.org/conference">
<h2>HandmadeCon</h2> <h2>HandmadeCon</h2>
</a> </a>

View File

@ -1,4 +1,4 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "extrahead" }} {{ define "extrahead" }}
<style> <style>
@ -10,7 +10,7 @@
{{ end }} {{ end }}
{{ define "content" }} {{ define "content" }}
<div class="ph3 ph0-ns"> <div class="mw8 post-content ph3 pv3 center">
<h2>Jams</h2> <h2>Jams</h2>
<p>Since 2020, we have been running programming jams to encourage community members to explore new ideas and start projects. You can view all the past submissions and results here.</p> <p>Since 2020, we have been running programming jams to encourage community members to explore new ideas and start projects. You can view all the past submissions and results here.</p>

View File

@ -1,12 +1,10 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="description ph2 ph0-ns"> <div class="post-content description ph3 ph0-ns center mt3 mw6">
<h1>Hi there, {{ if .User }}{{ .User.Name }}{{ else }}visitor{{ end }}!</h1>
<p> <p>
<span class="big">Hi there, {{ if .User }}{{ .User.Name }}{{ else }}visitor{{ end }}!</span> <span>Your request was rejected for the following reason:</span><br />
</p>
<p>
<span class="big">Your request was rejected for the following reason:</span><br />
<p class="b">{{ .RejectReason }}</p> <p class="b">{{ .RejectReason }}</p>
<p> <p>
<a href="javascript:history.back();">Go back</a> <a href="javascript:history.back();">Go back</a>

View File

@ -322,6 +322,11 @@ func RegisterNewUserSubmit(c *RequestContext) ResponseData {
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to send registration email")) return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to send registration email"))
} }
if config.Config.Env == config.Dev {
confirmUrl := hmnurl.BuildEmailConfirmation(username, ott, destination)
logging.Debug().Str("Confirmation url", confirmUrl).Msg("New user requires email confirmation")
}
c.Perf.StartBlock("SQL", "Commit user") c.Perf.StartBlock("SQL", "Commit user")
err = tx.Commit(c) err = tx.Commit(c)
if err != nil { if err != nil {
@ -600,10 +605,22 @@ func RequestPasswordResetSubmit(c *RequestContext) ResponseData {
} }
resetToken = newToken resetToken = newToken
err = email.SendPasswordReset(user.Email, user.BestName(), user.Username, resetToken.Content, resetToken.Expires, c.Perf) err = email.SendPasswordReset(
user.Email,
user.BestName(),
user.Username,
resetToken.Content,
resetToken.Expires,
c.Perf,
)
if err != nil { if err != nil {
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to send email")) return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to send email"))
} }
if config.Config.Env == config.Dev {
passwordResetUrl := hmnurl.BuildDoPasswordReset(username, resetToken.Content)
logging.Debug().Str("Reset url", passwordResetUrl).Msg("Password reset requested")
}
} }
} }
return c.Redirect(hmnurl.BuildPasswordResetSent(), http.StatusSeeOther) return c.Redirect(hmnurl.BuildPasswordResetSent(), http.StatusSeeOther)