Files
drasl/view/complete-registration.tmpl
Evan Goode bb524367eb Respect RegistrationOIDC.RequireInvite
This previously setting had no effect when clicking 'Sign in with
$PROVIDER' on the home page.
2025-08-24 15:58:40 -04:00

181 lines
6.6 KiB
Cheetah

{{ template "layout" . }}
{{ define "title" }}{{ call .T "Complete Registration" }}{{ end }}
{{ define
"content"
}}
{{ template "header" . }}
{{ $dividerNeeded := false }}
{{ if .AnyUnmigratedUsers }}
{{ if $dividerNeeded }}
<div class="divider">or</div>
{{ $dividerNeeded = false }}
{{ end }}
<h3>{{ call .T "Migrate an existing user" }}</h3>
<p>{{ call .T "You can link this identity provider to an existing %s account." .App.Config.ApplicationName }} <span class="warning-message">{{ call .T "If you do so, you will no longer be able to log in using your %s password. You'll need to use your Minecraft Token to log in to Minecraft launchers." .App.Config.ApplicationName }}</span></p>
<form action="{{ .App.FrontEndURL }}/web/oidc-migrate" method="post">
<input type="text" name="username" placeholder="{{ call .T "Username" }}" required />
<input hidden name="returnUrl" value="{{ .URL }}" />
<input
type="password"
name="password"
placeholder="{{ call .T "Password" }}"
required
/>
<input type="submit" value="{{ call .T "Link account" }}" />
</form>
{{ $dividerNeeded = true }}
{{ end }}
<!-- CreateNewPlayer -->
{{ if .App.Config.CreateNewPlayer.Allow }}
{{ if $dividerNeeded }}
<div class="divider">{{ call .T "or" }}</div>
{{ $dividerNeeded = false }}
{{ end }}
<h3>{{ call .T "Create a player" }}</h3>
{{ if and .OIDCProvider.Config.RequireInvite (not .InviteCode) }}
<p>{{ call .T "Registration with %s requires an invite." .OIDCProvider.Config.Name }}</p>
{{ else if and .App.Config.RegistrationExistingPlayer.RequireInvite (not .InviteCode) }}
<p>{{ call .T "Registration as a new player is invite-only." }}</p>
{{ else }}
<p>{{ call .T "Complete registration by creating a new player:" }}</p>
<form action="{{ .App.FrontEndURL }}/web/register" method="post">
<input
required
type="text"
name="playerName"
placeholder="{{ call .T "Player name" }}"
maxlength="{{ .App.Constants.MaxUsernameLength }}"
value="{{ .PreferredPlayerName }}"
{{ if not .OIDCProvider.Config.AllowChoosingPlayerName }}
title="{{ call .T "Choosing a player name is not allowed." }}"
disabled
{{ end }}
/>
<input
hidden
type="checkbox"
name="useIdToken"
checked
/>
{{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}
<p>
<input
class="long"
type="text"
name="uuid"
placeholder="{{ if eq .App.Config.PlayerUUIDGeneration "offline" }}{{ call .T "Player UUID (leave blank for offline UUID)" }}{{ else }}{{ call .T "Player UUID (leave blank for random)" }}{{ end }}"
pattern="^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$"
/>
</p>
{{ end }}
<input type="text" name="inviteCode" value="{{ .InviteCode }}" hidden />
<input hidden name="returnUrl" value="{{ .URL }}" />
{{ if .InviteCode }}
<p><em>{{ call .T "Using invite code %s" .InviteCode }}</em></p>
{{ end }}
<p>
<input type="submit" value="{{ call .T "Register" }}"/>
</p>
</form>
{{ end }}
{{ $dividerNeeded = true }}
{{ end }}
<!-- ImportExistingPlayer -->
{{ if .App.Config.ImportExistingPlayer.Allow }}
{{ if $dividerNeeded }}
<div class="divider">{{ call .T "or" }}</div>
{{ $dividerNeeded = false }}
{{ end }}
<h3>{{ call .T "Register from an existing Minecraft player" }}</h3>
{{ if and .OIDCProvider.Config.RequireInvite (not .InviteCode) }}
<p>{{ call .T "Registration with %s requires an invite." .OIDCProvider.Config.Name }}</p>
{{ else if and .App.Config.RegistrationExistingPlayer.RequireInvite (not .InviteCode) }}
<p>{{ call .T "Registration as an existing player is invite-only." }}</p>
{{ else }}
{{ if .App.Config.ImportExistingPlayer.RequireSkinVerification }}
<p>
{{ call .T
"Register a new account with the UUID of an existing %s account. Requires verification that you own the account."
.App.Config.ImportExistingPlayer.Nickname
}}
</p>
{{ if .InviteCode }}
<p><em>{{ call .T "Using invite code %s" .InviteCode }}</em></p>
{{ end }}
<form action="{{ .App.FrontEndURL }}/web/register-challenge" method="get">
<input
required
type="text"
name="playerName"
placeholder="{{ call .T "%s player name" .App.Config.ImportExistingPlayer.Nickname }}"
maxlength="{{ .App.Constants.MaxUsernameLength }}"
{{ if not .OIDCProvider.Config.AllowChoosingPlayerName }}
value="{{ .PreferredPlayerName }}"
title="{{ call .T "Choosing a player name is not allowed." }}"
disabled
{{ end }}
/>
<input
hidden
type="checkbox"
name="useIdToken"
checked
/>
<input
hidden
type="text"
name="inviteCode"
value="{{ .InviteCode }}"
/>
<input hidden name="returnUrl" value="{{ .URL }}" />
<input type="submit" value="{{ call .T "Continue" }}" />
</form>
{{ else }}
<p>
{{ call .T
"Register a new account with the UUID of an existing %s account"
.App.Config.ImportExistingPlayer.Nickname
}}
</p>
<form action="{{ .App.FrontEndURL }}/web/register" method="post">
<input
required
type="text"
name="playerName"
placeholder="{{ call .T "%s player name" .App.Config.ImportExistingPlayer.Nickname }}"
maxlength="{{ .App.Constants.MaxUsernameLength }}"
/>
<input
hidden
type="checkbox"
name="useIdToken"
checked
/>
<input type="checkbox" name="existingPlayer" checked hidden />
<input
hidden
type="text"
name="inviteCode"
value="{{ .InviteCode }}"
/>
{{ if .InviteCode }}
<p><em>{{ call .T "Using invite code %s" .InviteCode }}</em></p>
{{ end }}
<input type="submit" value="{{ call .T "Register" }}" />
</form>
{{ end }}
{{ end }}
{{ $dividerNeeded = true }}
{{ end }}
{{ template "footer" . }}
{{ end }}