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" }}
<div class="flex ph3 ph0-ns justify-center">
<div class="w-100 w-auto-ns pv3">
<h1>Hi, {{ .Username }}!</h1>
<form method="post" class="flex flex-column">
<input type="hidden" name="token" value="{{ .Token }}" />
<div class="mw5 pv3 center">
<h1 class="mb2">Hi, {{ .Username }}!</h1>
<div class="mb2">Please enter a new password.</div>
<form method="post" class="hmn-form flex flex-column g2">
<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 */}}
<input
style="position:absolute; visibility:hidden;"
type="text"
name="username"
value="{{ .Username }}"
readonly
/>
{{/*NOTE: The username field isn't `type="hidden"` because this way browser will offer to save the username along with the password */}}
<input
style="position:absolute; visibility:hidden;"
type="text"
name="username"
value="{{ .Username }}"
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">
<label class="db b" for="password">New password</label>
<input class="db w-100 w5-ns"
name="password"
type="password"
minlength="8"
required
/>
</div>
<input class="db mt3 w-100"
type="submit"
value="Reset your password"
/>
</form>
</div>
<input class="db w-100 btn-primary"
type="submit"
value="Reset your password"
/>
</form>
</div>
{{ end }}

View File

@ -1,8 +1,16 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ define "content" }}
<div class="mw7 ph3 ph0-ns pb3">
<form method="POST">
<div class="mw6 ph3 pv3 post-content center">
<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="destination" value="{{ .DestinationURL }}" />
@ -14,23 +22,15 @@
value="{{ .Username }}"
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"
name="password"
type="password"
minlength="8"
placeholder="Password"
required
/>
<input class="db mt3 w-100 w-auto-ns"
<input class="btn-primary db w-100 w-auto-ns"
type="submit"
value="Complete registration"
/>

View File

@ -1,55 +1,47 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ define "content" }}
<div class="flex ph3 ph0-ns justify-center">
<div class="w-100 w-auto-ns pv3">
<h1 class="tc">Log in</h1>
<form method="POST" class="flex flex-column">
<input type="hidden" name="redirect" value="{{ .RedirectUrl }}" />
<div>
<label class="db b" for="username">Username</label>
<input class="db w-100 w5-ns"
name="username"
type="text"
minlength="3" maxlength="30"
required
/>
</div>
<div class="mw5 pv3 center">
<h1 class="mb2">Log in</h1>
<form method="POST" class="flex flex-column g2 hmn-form">
<input type="hidden" name="redirect" value="{{ .RedirectUrl }}" />
<input class="db w-100 w5-ns"
name="username"
type="text"
minlength="3" maxlength="30"
placeholder="Username"
required
/>
<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"
name="password"
type="password"
minlength="8"
required
/>
</div>
<div class="mt3">
<input class="w-100" type="submit" value="Log in" />
</div>
<input class="db w-100 w5-ns"
name="password"
type="password"
minlength="8"
placeholder="Password"
required
/>
<a href="{{ .ForgotPasswordUrl }}" tabindex="-1">Forgot your password?</a>
<div class="mt3">
<input class="btn-primary w-100" type="submit" value="Log in" />
</div>
<div class="tc pa3">
Need an account? <a href="{{ .RegisterUrl }}">Sign up.</a>
</div>
<div class="tc pa3">
Need an account? <a href="{{ .RegisterUrl }}">Sign up.</a>
</div>
<div class="mt3 tc">
<div class="b mb1">Third-party login</div>
<div class="flex flex-column g1">
<a href="{{ .LoginWithDiscordUrl }}" class="db br2 overflow-hidden flex" title="Log in with Discord">
<img
src="{{ static "discord-login.svg" }}"
alt="Log in with Discord"
>
</a>
</div>
<div class="mt3 tc">
<div class="b mb1">Third-party login</div>
<div class="flex flex-column g1">
<a href="{{ .LoginWithDiscordUrl }}" class="db br2 overflow-hidden flex" title="Log in with Discord">
<img
src="{{ static "discord-login.svg" }}"
alt="Log in with Discord"
>
</a>
</div>
</form>
</div>
</div>
</form>
</div>
{{ end }}

View File

@ -1,40 +1,32 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ define "content" }}
<div class="flex ph3 ph0-ns justify-center">
<div class="w-100 w-auto-ns pv3">
<h1 class="tc">Reset your password</h1>
<form method="POST" class="flex flex-column">
<div>
<label class="db b" for="username">Username</label>
<input class="db w-100 w5-ns"
name="username"
type="text"
minlength="3" maxlength="30"
required
/>
</div>
<div class="mw5 pv3 center">
<h1 class="mb2">Reset your password</h1>
<form method="POST" class="hmn-form flex flex-column g2">
<input class="db w-100 w5-ns"
name="username"
type="text"
minlength="3" maxlength="30"
placeholder="Username"
required
/>
<div class="mt2">
<label class="db b" for="email">Email</label>
<input class="db w-100 w5-ns"
name="email"
type="text"
required
/>
</div>
<input class="db w-100 w5-ns"
name="email"
type="text"
placeholder="Email"
required
/>
<div class="mt3">
<input class="w-100"
type="submit"
value="Request password reset"
/>
</div>
<input class="btn-primary w-100"
type="submit"
value="Request password reset"
/>
<div class="note 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.
</div>
</form>
</div>
<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.
</div>
</form>
</div>
{{ end }}

View File

@ -1,7 +1,7 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ 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>
<p>
It will expire in 24 hours.

View File

@ -1,56 +1,48 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ define "content" }}
<div class="flex ph3 ph0-ns justify-center">
<div class="flex ph3 justify-center">
<div class="w-100 w-auto-ns pv3">
<h1 class="tc">Sign up</h1>
<form method="POST" class="flex flex-column">
<h1 class="mb2">Sign up</h1>
<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 */}}
<input type="hidden" name="destination" value="{{ .DestinationURL }}" />
<div>
<label class="db b" for="username">Username</label>
<input class="db w-100 w5-ns"
name="username"
type="text"
minlength="3" maxlength="30"
pattern="^[0-9a-zA-Z][\w-]{2,29}$"
required
/>
</div>
<input class="db w-100 w5-ns"
name="username"
type="text"
minlength="3" maxlength="30"
pattern="^[0-9a-zA-Z][\w-]{2,29}$"
placeholder="Username"
required
/>
<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"
name="displayname"
type="text"
/>
</div>
<input class="db w-100 w5-ns"
name="displayname"
placeholder="Display name (optional)"
type="text"
/>
<div class="mt2">
<label class="db b" for="email">Email</label>
<input class="db w-100 w5-ns"
name="email"
type="email"
required
/>
</div>
<input class="db w-100 w5-ns"
name="email"
type="email"
placeholder="Email"
required
/>
<div class="mt2">
<label class="db b" for="password">Password</label>
<input class="db w-100 w5-ns"
name="password"
type="password"
minlength="8"
required
/>
</div>
<input class="db w-100 w5-ns"
name="password"
type="password"
minlength="8"
placeholder="Password"
required
/>
{{/* TODO(asaf): Consider adding some bot-mitigation thing here */}}
<div class="mt3">
<input class="w-100" type="submit" value="Register" />
<input class="w-100 btn-primary" type="submit" value="Register" />
</div>
</form>
</div>

View File

@ -1,7 +1,7 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ define "content" }}
<div class="mw7 ph3 ph0-ns">
<div class="mw6 ph3 pv3 center post-content">
<h1>Verify your email</h1>
<p class="mb3 b">
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" }}
{{ $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="fronke">
<div class="center mw7 ph3 pv3 post-content flex flex-column g3">
<div>
<a href="https://handmadehero.org/conference">
<h2>HandmadeCon</h2>
</a>

View File

@ -1,4 +1,4 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ define "extrahead" }}
<style>
@ -10,7 +10,7 @@
{{ end }}
{{ define "content" }}
<div class="ph3 ph0-ns">
<div class="mw8 post-content ph3 pv3 center">
<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>

View File

@ -1,12 +1,10 @@
{{ template "base.html" . }}
{{ template "base-2024.html" . }}
{{ 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>
<span class="big">Hi there, {{ if .User }}{{ .User.Name }}{{ else }}visitor{{ end }}!</span>
</p>
<p>
<span class="big">Your request was rejected for the following reason:</span><br />
<span>Your request was rejected for the following reason:</span><br />
<p class="b">{{ .RejectReason }}</p>
<p>
<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"))
}
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")
err = tx.Commit(c)
if err != nil {
@ -600,10 +605,22 @@ func RequestPasswordResetSubmit(c *RequestContext) ResponseData {
}
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 {
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)