Skip to content

Commit

Permalink
[chore] Don't render sign-up form when registrations closed (#3001)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmethurst authored Jun 12, 2024
1 parent fef9b6a commit fbdfce3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/web/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func (m *Module) signupGETHandler(c *gin.Context) {
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Extra: map[string]any{
"reasonRequired": config.GetAccountsReasonRequired(),
"reasonRequired": config.GetAccountsReasonRequired(),
"registrationOpen": config.GetAccountsRegistrationOpen(),
},
}

Expand Down
5 changes: 5 additions & 0 deletions web/template/sign-up.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<main>
<section class="with-form" aria-labelledby="sign-up">
<h2 id="sign-up">Sign up for an account on {{ .instance.Title -}}</h2>
{{- if not .registrationOpen }}
<p>This instance is not currently open to new sign-ups.</p>
{{- else }}
<form action="/signup" method="POST">
<div class="labelinput">
<label for="email">Email</label>
Expand All @@ -40,6 +43,7 @@
name="password"
required
placeholder="Please enter your desired password"
autocomplete="new-password"
>
</div>
<div class="labelinput">
Expand Down Expand Up @@ -88,6 +92,7 @@
<input type="hidden" name="locale" value="en">
<button type="submit" class="btn btn-success">Submit</button>
</form>
{{- end }}
</section>
</main>
{{- end }}

0 comments on commit fbdfce3

Please sign in to comment.