Add registration form to login and allow everyone to see listing

This commit is contained in:
Alicia 2019-02-24 11:35:42 +00:00
parent f5dc9e22fe
commit c9e61da7f0
2 changed files with 56 additions and 41 deletions

View File

@ -41,6 +41,13 @@
{{ navbarItem .Path (.T "Request beatmap ranking") "/beatmaps/rank_request" }}
</div>
</div>
{{ else }}
<div class="ui dropdown item">
<span>{{ .T "Beatmaps" }}</span>
<div class="menu">
{{ navbarItem .Path (.T "Listing") "/beatmaps" }} }}
</div>
</div>
{{ end }}
{{ navbarItem .Path (.T "Donate" | printf "<i class=\"red heart icon\"></i>%s") "/donate" }}
{{ if $isAdmin }}{{ navbarItem .Path (.T "RAP" | printf "<b>%s</b>") "https://old.yozora.pw/p/100" }}{{ end }}

View File

@ -2,52 +2,60 @@
<div class="ui container">
{{ $regEnabled := qb "SELECT value_int FROM system_settings WHERE name = 'registrations_enabled'" }}
{{ if .Context.User.ID }}
<div class="ui segment">
{{ .T "You're already logged in!" }}
</div>
<div class="ui segment">
{{ .T "You're already logged in!" }}
</div>
{{ else if not ($regEnabled.value_int.Bool) }}
<div class="ui error message">
{{ .T "Sorry, it's not possible to register at the moment. Please try again later." }}
</div>
<div class="ui error message">
{{ .T "Sorry, it's not possible to register at the moment. Please try again later." }}
</div>
{{ else }}
{{ if eq (.Gin.Query "stopsign") "1" }}
<div class="ui warning message">
{{ .T "Remember: this seems like it's your second account! Do not multiaccount, or you're likely to get restricted!" }}
{{ if eq (.Gin.Query "stopsign") "1" }}
<div class="ui warning message">
{{ .T "Remember: this seems like it's your second account! Do not multiaccount, or you're likely to get restricted!" }}
</div>
{{ end }}
<div class="ui info message">
<center> Don't have a code? Apply <a href="https://docs.google.com/forms/d/1oYO8Cky0piTsfhMDxnQOZnNOo4K4tT3itZ5CdLY-w2k">here!</a></center>
</div>
<div class="tiny container">
<div class="ui raised segments">
<div class="ui segment">
<form id="register-form" class="ui form" method="post" action="/register">
<div class="field">
<label>{{ .T "Username (2 to 15 characters, alphanumeric, spaces, <code>_[]-</code>)" | html }}</label>
<input tabindex="1" type="text" name="username" placeholder="{{ .T "Username" }}"
value="{{ .FormData.username }}" required pattern="^[A-Za-z0-9 _\[\]-]{2,15}$">
</div>
<div class="field">
<label>{{ .T "Password (at least 8 characters)" }}</label>
<input tabindex="2" type="password" name="password" placeholder="{{ .T "Password" }}"
value="{{ .FormData.password }}" required pattern="^.{8,}$">
</div>
<div class="field">
<label>{{ .T "Email" }}</label>
<input tabindex="3" type="email" name="email" placeholder="{{ .T "Email" }}"
value="{{ .FormData.email }}" required>
</div>
<div class="field">
<label>{{ .T "Registration Key" }}</label>
<input tabindex="3" type="text" name="key" placeholder="{{ .T "Key" }}"
value="{{ .FormData.key }}" required>
</div>
{{ with config "RecaptchaSite" }}
<div class="field">
<div class="g-recaptcha" data-sitekey="{{ . }}"></div>
</div>
{{ end }}
{{ ieForm .Gin }}
</form>
</div>
{{ end }}
<div class="tiny container">
<div class="ui raised segments">
<div class="ui segment">
<form id="register-form" class="ui form" method="post" action="/register">
<div class="field">
<label>{{ .T "Username (2 to 15 characters, alphanumeric, spaces, <code>_[]-</code>)" | html }}</label>
<input tabindex="1" type="text" name="username" placeholder="{{ .T "Username" }}" value="{{ .FormData.username }}" required pattern="^[A-Za-z0-9 _\[\]-]{2,15}$">
</div>
<div class="field">
<label>{{ .T "Password (at least 8 characters)" }}</label>
<input tabindex="2" type="password" name="password" placeholder="{{ .T "Password" }}" value="{{ .FormData.password }}" required pattern="^.{8,}$">
</div>
<div class="field">
<label>{{ .T "Email" }}</label>
<input tabindex="3" type="email" name="email" placeholder="{{ .T "Email" }}" value="{{ .FormData.email }}" required>
</div>
<div class="field">
<label>{{ .T "Registration Key" }}</label>
<input tabindex="3" type="text" name="key" placeholder="{{ .T "Key" }}" value="{{ .FormData.key }}" required>
</div>
{{ with config "RecaptchaSite" }}
<div class="field">
<div class="g-recaptcha" data-sitekey="{{ . }}"></div>
</div>
{{ end }}
{{ ieForm .Gin }}
</form>
</div>
<div class="ui right aligned segment">
<button tabindex="4" class="ui primary button" type="submit" form="register-form">{{ .T "Submit" }}</button>
</div>
<div class="ui right aligned segment">
<button tabindex="4" class="ui primary button" type="submit"
form="register-form">{{ .T "Submit" }}</button>
</div>
</div>
</div>
{{ end }}
</div>
{{ end }}