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,38 +1,33 @@
{{ 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 */}}
<input <input
style="position:absolute; visibility:hidden;" style="position:absolute; visibility:hidden;"
type="text" type="text"
name="username" name="username"
value="{{ .Username }}" value="{{ .Username }}"
readonly readonly
/> />
<div>Please enter a new password.</div> <input class="db w-100 w5-ns"
name="password"
type="password"
minlength="8"
placeholder="New password"
required
/>
<div class="mt2"> <input class="db w-100 btn-primary"
<label class="db b" for="password">New password</label> type="submit"
<input class="db w-100 w5-ns" value="Reset your password"
name="password" />
type="password" </form>
minlength="8"
required
/>
</div>
<input class="db mt3 w-100"
type="submit"
value="Reset your password"
/>
</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,55 +1,47 @@
{{ 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> <input class="db w-100 w5-ns"
<label class="db b" for="username">Username</label> name="username"
<input class="db w-100 w5-ns" type="text"
name="username" minlength="3" maxlength="30"
type="text" placeholder="Username"
minlength="3" maxlength="30" required
required />
/>
</div>
<div class="mt2"> <input class="db w-100 w5-ns"
<div class="flex justify-between"> name="password"
<label class="db b" for="password">Password</label> type="password"
<a href="{{ .ForgotPasswordUrl }}" tabindex="-1">Forgot your password?</a> minlength="8"
</div> placeholder="Password"
<input class="db w-100 w5-ns" required
name="password" />
type="password" <a href="{{ .ForgotPasswordUrl }}" tabindex="-1">Forgot your password?</a>
minlength="8"
required
/>
</div>
<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">
Need an account? <a href="{{ .RegisterUrl }}">Sign up.</a> Need an account? <a href="{{ .RegisterUrl }}">Sign up.</a>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<div class="b mb1">Third-party login</div> <div class="b mb1">Third-party login</div>
<div class="flex flex-column g1"> <div class="flex flex-column g1">
<a href="{{ .LoginWithDiscordUrl }}" class="db br2 overflow-hidden flex" title="Log in with Discord"> <a href="{{ .LoginWithDiscordUrl }}" class="db br2 overflow-hidden flex" title="Log in with Discord">
<img <img
src="{{ static "discord-login.svg" }}" src="{{ static "discord-login.svg" }}"
alt="Log in with Discord" alt="Log in with Discord"
> >
</a> </a>
</div>
</div> </div>
</form> </div>
</div> </form>
</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"> <input class="db w-100 w5-ns"
<div> name="username"
<label class="db b" for="username">Username</label> type="text"
<input class="db w-100 w5-ns" minlength="3" maxlength="30"
name="username" placeholder="Username"
type="text" required
minlength="3" maxlength="30" />
required
/>
</div>
<div class="mt2"> <input class="db w-100 w5-ns"
<label class="db b" for="email">Email</label> name="email"
<input class="db w-100 w5-ns" type="text"
name="email" placeholder="Email"
type="text" 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> <input class="db w-100 w5-ns"
<label class="db b" for="username">Username</label> name="username"
<input class="db w-100 w5-ns" type="text"
name="username" minlength="3" maxlength="30"
type="text" pattern="^[0-9a-zA-Z][\w-]{2,29}$"
minlength="3" maxlength="30" placeholder="Username"
pattern="^[0-9a-zA-Z][\w-]{2,29}$" required
required />
/>
</div>
<div class="mt2"> <input class="db w-100 w5-ns"
<label class="db" for="displayname"><b>Display name</b> <span class="c--dim i">(optional)</span></label> name="displayname"
<input class="db w-100 w5-ns" placeholder="Display name (optional)"
name="displayname" type="text"
type="text" />
/>
</div>
<div class="mt2"> <input class="db w-100 w5-ns"
<label class="db b" for="email">Email</label> name="email"
<input class="db w-100 w5-ns" type="email"
name="email" placeholder="Email"
type="email" required
required />
/>
</div>
<div class="mt2"> <input class="db w-100 w5-ns"
<label class="db b" for="password">Password</label> name="password"
<input class="db w-100 w5-ns" type="password"
name="password" minlength="8"
type="password" placeholder="Password"
minlength="8" 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)