mirror of
https://github.com/modrinth/code.git
synced 2026-09-02 13:05:50 +00:00
fix create account flow
This commit is contained in:
@@ -1,39 +1,46 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="create-account-card">
|
<div
|
||||||
<h1 class="create-account-title">{{ formatMessage(messages.title) }}</h1>
|
class="shadow-card mx-auto flex w-full max-w-[30rem] flex-col gap-6 rounded-2xl border border-button-bg bg-surface-3 p-6"
|
||||||
|
>
|
||||||
|
<h1
|
||||||
|
class="mx-auto my-0 flex w-full justify-center text-center text-2xl font-semibold text-contrast"
|
||||||
|
>
|
||||||
|
{{ formatMessage(messages.title) }}
|
||||||
|
</h1>
|
||||||
|
|
||||||
<section v-if="requiresDob" class="create-account-section">
|
<section v-if="requiresDob" class="flex flex-col gap-2.5">
|
||||||
<label class="create-account-label" for="create-account-dob">
|
<label class="text-md font-semibold text-contrast" for="create-account-dob">
|
||||||
{{ formatMessage(messages.dateOfBirthLabel) }}
|
{{ formatMessage(messages.dateOfBirthLabel) }}
|
||||||
</label>
|
</label>
|
||||||
<div class="date-input-wrap">
|
<input
|
||||||
<input
|
id="create-account-dob"
|
||||||
id="create-account-dob"
|
v-model="dateOfBirthModel"
|
||||||
v-model="dateOfBirthModel"
|
class="scheme-dark w-full border-0 bg-surface-4 text-lg text-contrast outline-none [color-scheme:dark]"
|
||||||
class="date-input"
|
type="date"
|
||||||
type="date"
|
:max="maxBirthDate"
|
||||||
:max="maxBirthDate"
|
/>
|
||||||
/>
|
<div>You must be over 13 years old to use Modrinth.</div>
|
||||||
<CalendarIcon class="date-input-icon" />
|
<Admonition type="info">
|
||||||
</div>
|
<div class="flex flex-col gap-1.5 leading-normal">
|
||||||
<p class="helper-text">{{ formatMessage(messages.over13HelperText) }}</p>
|
<div>
|
||||||
|
{{ formatMessage(messages.infoPanelText) }}
|
||||||
|
</div>
|
||||||
|
<a
|
||||||
|
class="w-fit text-link"
|
||||||
|
:href="sourceCodeUrl"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{{ formatMessage(messages.relevantSourceCodeText) }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</Admonition>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="info-panel">
|
<section class="flex flex-col gap-2.5">
|
||||||
<div class="info-panel-icon">
|
<label class="text-md font-semibold text-contrast" for="create-account-username">
|
||||||
<InfoIcon />
|
|
||||||
</div>
|
|
||||||
<div class="info-panel-content">
|
|
||||||
<p>{{ formatMessage(messages.infoPanelText) }}</p>
|
|
||||||
<a class="text-link" :href="sourceCodeUrl" target="_blank" rel="noopener noreferrer">
|
|
||||||
{{ formatMessage(messages.relevantSourceCodeText) }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="create-account-section">
|
|
||||||
<label class="create-account-label" for="create-account-username">
|
|
||||||
{{ formatMessage(messages.usernameOptionalLabel) }}
|
{{ formatMessage(messages.usernameOptionalLabel) }}
|
||||||
|
<span class="font-normal text-primary">(optional)</span>
|
||||||
</label>
|
</label>
|
||||||
<StyledInput
|
<StyledInput
|
||||||
id="create-account-username"
|
id="create-account-username"
|
||||||
@@ -44,23 +51,21 @@
|
|||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="create-account-section">
|
<section class="flex flex-col gap-2.5" v-if="globals?.captcha_enabled">
|
||||||
<label class="create-account-label">{{ formatMessage(messages.securityCheckLabel) }}</label>
|
<label class="text-md font-semibold text-contrast">{{
|
||||||
<div class="captcha-wrap">
|
formatMessage(messages.securityCheckLabel)
|
||||||
<HCaptcha v-if="globals?.captcha_enabled" :ref="onSetCaptchaRef" v-model="tokenModel" />
|
}}</label>
|
||||||
</div>
|
<HCaptcha v-if="globals?.captcha_enabled" :ref="onSetCaptchaRef" v-model="tokenModel" />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Checkbox
|
<div class="flex gap-2.5 rounded-2xl border border-solid border-surface-5 p-3 leading-normal">
|
||||||
v-model="subscribeModel"
|
<Checkbox v-model="subscribeModel" class="text-left" />
|
||||||
class="subscribe-checkbox"
|
<div>{{ formatMessage(messages.subscribeLabel) }}</div>
|
||||||
:label="formatMessage(messages.subscribeLabel)"
|
</div>
|
||||||
:description="formatMessage(messages.subscribeLabel)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ButtonStyled color="brand">
|
<ButtonStyled color="brand">
|
||||||
<button
|
<button
|
||||||
class="!w-full complete-sign-up-btn"
|
class="!w-full font-bold"
|
||||||
:disabled="globals?.captcha_enabled ? !tokenModel : false"
|
:disabled="globals?.captcha_enabled ? !tokenModel : false"
|
||||||
@click="onCompleteSignUp()"
|
@click="onCompleteSignUp()"
|
||||||
>
|
>
|
||||||
@@ -71,8 +76,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { CalendarIcon, InfoIcon } from '@modrinth/assets'
|
import {
|
||||||
import { ButtonStyled, Checkbox, defineMessages, StyledInput, useVIntl } from '@modrinth/ui'
|
Admonition,
|
||||||
|
ButtonStyled,
|
||||||
|
Checkbox,
|
||||||
|
defineMessages,
|
||||||
|
StyledInput,
|
||||||
|
useVIntl,
|
||||||
|
} from '@modrinth/ui'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
import HCaptcha from '@/components/ui/auth/HCaptcha.vue'
|
import HCaptcha from '@/components/ui/auth/HCaptcha.vue'
|
||||||
@@ -104,7 +115,8 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
sourceCodeUrl: {
|
sourceCodeUrl: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'https://github.com/modrinth/labrinth/blob/main/apps/labrinth/src/routes/internal/flows.rs',
|
default:
|
||||||
|
'https://github.com/modrinth/labrinth/blob/main/apps/labrinth/src/routes/internal/flows.rs',
|
||||||
},
|
},
|
||||||
onCompleteSignUp: {
|
onCompleteSignUp: {
|
||||||
type: Function,
|
type: Function,
|
||||||
@@ -166,7 +178,8 @@ const messages = defineMessages({
|
|||||||
},
|
},
|
||||||
infoPanelText: {
|
infoPanelText: {
|
||||||
id: 'auth.create-account.info-panel.text',
|
id: 'auth.create-account.info-panel.text',
|
||||||
defaultMessage: 'We do not store your date of birth, it is only used to confirm your age at sign up.',
|
defaultMessage:
|
||||||
|
'We do not store your date of birth, it is only used to confirm your age at sign up.',
|
||||||
},
|
},
|
||||||
relevantSourceCodeText: {
|
relevantSourceCodeText: {
|
||||||
id: 'auth.create-account.info-panel.source-code-link',
|
id: 'auth.create-account.info-panel.source-code-link',
|
||||||
@@ -174,7 +187,7 @@ const messages = defineMessages({
|
|||||||
},
|
},
|
||||||
usernameOptionalLabel: {
|
usernameOptionalLabel: {
|
||||||
id: 'auth.create-account.username.optional-label',
|
id: 'auth.create-account.username.optional-label',
|
||||||
defaultMessage: 'Username (Optional)',
|
defaultMessage: 'Username',
|
||||||
},
|
},
|
||||||
usernamePlaceholder: {
|
usernamePlaceholder: {
|
||||||
id: 'auth.create-account.username.placeholder',
|
id: 'auth.create-account.username.placeholder',
|
||||||
@@ -194,113 +207,3 @@ const messages = defineMessages({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.create-account-card {
|
|
||||||
background: var(--color-raised-bg);
|
|
||||||
border: 1px solid var(--color-button-bg);
|
|
||||||
border-radius: var(--size-rounded-xl);
|
|
||||||
box-shadow: var(--shadow-card);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--gap-md);
|
|
||||||
margin-inline: auto;
|
|
||||||
max-width: 30rem;
|
|
||||||
padding: var(--gap-xl);
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-account-title {
|
|
||||||
font-size: var(--text-4xl);
|
|
||||||
font-weight: var(--weight-bold);
|
|
||||||
line-height: 1.2;
|
|
||||||
margin: 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-account-section {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--gap-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-account-label {
|
|
||||||
color: var(--color-contrast);
|
|
||||||
font-size: var(--text-xl);
|
|
||||||
font-weight: var(--weight-bold);
|
|
||||||
}
|
|
||||||
|
|
||||||
.date-input-wrap {
|
|
||||||
align-items: center;
|
|
||||||
background: var(--color-button-bg);
|
|
||||||
border-radius: var(--size-rounded-lg);
|
|
||||||
display: flex;
|
|
||||||
gap: var(--gap-sm);
|
|
||||||
padding: 0.875rem 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.date-input {
|
|
||||||
background: transparent;
|
|
||||||
border: 0;
|
|
||||||
color: var(--color-contrast);
|
|
||||||
font-size: var(--text-lg);
|
|
||||||
outline: none;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.date-input-icon {
|
|
||||||
color: var(--color-secondary);
|
|
||||||
flex-shrink: 0;
|
|
||||||
height: 1.2rem;
|
|
||||||
width: 1.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.helper-text {
|
|
||||||
color: var(--color-secondary);
|
|
||||||
font-size: var(--text-lg);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel {
|
|
||||||
background: color-mix(in oklab, var(--color-brand) 20%, var(--color-bg));
|
|
||||||
border: 1px solid color-mix(in oklab, var(--color-brand) 80%, transparent);
|
|
||||||
border-radius: var(--size-rounded-xl);
|
|
||||||
display: flex;
|
|
||||||
gap: var(--gap-sm);
|
|
||||||
padding: var(--gap-md);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel-icon {
|
|
||||||
color: var(--color-brand);
|
|
||||||
display: flex;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel-content {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--gap-xs);
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: var(--color-contrast);
|
|
||||||
font-size: var(--text-lg);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.captcha-wrap {
|
|
||||||
background: var(--color-button-bg);
|
|
||||||
border-radius: var(--size-rounded-lg);
|
|
||||||
min-height: 4.25rem;
|
|
||||||
padding: var(--gap-md);
|
|
||||||
}
|
|
||||||
|
|
||||||
.subscribe-checkbox {
|
|
||||||
border: 1px solid var(--color-button-bg);
|
|
||||||
border-radius: var(--size-rounded-xl);
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.complete-sign-up-btn {
|
|
||||||
font-weight: var(--weight-bold);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ useHead({
|
|||||||
const auth = await useAuth()
|
const auth = await useAuth()
|
||||||
const route = useNativeRoute()
|
const route = useNativeRoute()
|
||||||
|
|
||||||
|
if (route.query.state !== undefined) {
|
||||||
|
await navigateTo(
|
||||||
|
{
|
||||||
|
path: '/auth/create/oauth',
|
||||||
|
query: route.query,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
replace: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const redirectTarget = route.query.redirect || ''
|
const redirectTarget = route.query.redirect || ''
|
||||||
const subtleLauncherRedirectUri = ref()
|
const subtleLauncherRedirectUri = ref()
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
@click="toggle"
|
@click="toggle"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="w-5 h-5 rounded-md flex items-center justify-center border-[1px] border-solid"
|
class="w-5 h-5 aspect-square rounded-md flex items-center justify-center border-[1px] border-solid"
|
||||||
:class="
|
:class="
|
||||||
(modelValue
|
(modelValue
|
||||||
? 'bg-brand border-button-border text-brand-inverted'
|
? 'bg-brand border-button-border text-brand-inverted'
|
||||||
|
|||||||
Reference in New Issue
Block a user