Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8e2735d
feat(account)!: update authentication flow (#1687)
dargmuesli Apr 4, 2025
bdbbf1f
chore(release): 10.0.0-beta.1 [skip ci]
semantic-release-bot Apr 4, 2025
01d4cdc
feat(pages): restructure legal (#1859)
dargmuesli Apr 8, 2025
fd54c51
feat(login): allow users to login using email or username
huzaifaedhi22 Apr 9, 2025
25c7b75
refactor: imports
huzaifaedhi22 Apr 10, 2025
d729ff5
fix(max-length): use @ to differentiate bw lengths
huzaifaedhi22 Apr 11, 2025
53a06c4
Merge branch 'main' into feat/account/emailOrUsername
huzaifaedhi22 May 7, 2025
3065cdc
refactor(ts): lint issues
huzaifaedhi22 May 7, 2025
dd9e044
chore: update tests
huzaifaedhi22 May 7, 2025
18521bd
Merge branch 'main' into feat/account/emailOrUsername
huzaifaedhi22 May 20, 2025
e5f5efd
Merge branch 'main' into feat/account/emailOrUsername
huzaifaedhi22 Jun 4, 2025
68384e2
Revert changes to Changelog.md
huzaifaedhi22 Jun 4, 2025
03394c4
revert: remove changes to pnpm-lock.yaml
huzaifaedhi22 Jun 4, 2025
d758802
revert: remove changes to verify/create.vue
huzaifaedhi22 Jun 4, 2025
8597547
revert: remove changes to sitemap snapshot
huzaifaedhi22 Jun 4, 2025
d6a5be9
refactor: remove title prop, use translation
huzaifaedhi22 Jun 5, 2025
f3c89ff
chore: update sitemap snapshots
huzaifaedhi22 Jun 5, 2025
eee7612
chore: update regression tests
huzaifaedhi22 Jun 5, 2025
d8a1e41
chore: update sitemap
huzaifaedhi22 Jun 18, 2025
46527b4
chore: update tests
huzaifaedhi22 Jun 18, 2025
f67bd18
Merge branch 'main' into feat/account/emailOrUsername
dargmuesli Jul 8, 2025
d07885a
chore(test): update snapshots
dargmuesli Jul 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,228 changes: 3,239 additions & 3,989 deletions CHANGELOG.md

Large diffs are not rendered by default.

22,192 changes: 14,732 additions & 7,460 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions src/app/components/form/account/FormAccountSignIn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
:submit-name="t('signIn')"
@submit.prevent="submit"
>
<FormInputEmailAddress
:form-input="v$.username"
@input="form.username = $event"
<FormInputEmailUsername
:form-input="v$.usernameOrEmail"
@input="form.usernameOrEmail = $event"
/>
<!-- TODO: allow for username too -->
<FormInputPassword
:form-input="v$.password"
@input="form.password = $event"
Expand Down Expand Up @@ -58,7 +57,7 @@ const localePath = useLocalePath()
const form = reactive({
captcha: ref<string>(),
password: ref<string>(),
username: ref<string>(),
usernameOrEmail: ref<string>(),
})
const isFormSent = ref(false)
const modelError = defineModel<Error>('error')
Expand All @@ -73,7 +72,7 @@ const submit = async () => {

const result = await authenticateMutation.executeMutation(
{
username: form.username || '',
username: form.usernameOrEmail || '',
password: form.password || '',
},
{
Expand Down Expand Up @@ -105,7 +104,7 @@ const submit = async () => {
// vuelidate
const rules = {
captcha: VALIDATION_CAPTCHA(),
username: VALIDATION_EMAIL_ADDRESS({ isRequired: true }),
usernameOrEmail: VALIDATION_USERNAME_OR_EMAIL({ isRequired: true }),
password: VALIDATION_PASSWORD(),
}
const v$ = useVuelidate(rules, form)
Expand Down
96 changes: 96 additions & 0 deletions src/app/components/form/input/FormInputEmailUsername.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<template>
<FormInput
v-if="formInput"
:is-optional="isOptional"
:id-label="`input-${id}`"
:title="title || t('usernameOrEmail')"
:type="inputType"
:value="formInput"
@input="handleInput"
>
<template #stateError>
<FormInputStateError
:form-input="formInput"
validation-property="lengthMax"
>
{{ t('globalValidationLength') }}
</FormInputStateError>
<FormInputStateError
:form-input="formInput"
validation-property="required"
>
{{ t('globalValidationRequired') }}
</FormInputStateError>
<FormInputStateError :form-input="formInput" validation-property="format">
{{ t('globalValidationFormat') }}
</FormInputStateError>
</template>
<template #stateWarning>
<FormInputStateWarning
v-if="
formInput.$dirty &&
formInput.$model &&
((formInput.$model.includes('@') &&
!isValidEmail(formInput.$model)) ||
(!formInput.$model.includes('@') &&
!isValidUsername(formInput.$model)))
"
>
{{ t('globalValidationCheck') }}
</FormInputStateWarning>
</template>
</FormInput>
</template>

<script setup lang="ts">
import type { BaseValidation } from '@vuelidate/core'
import { email } from '@vuelidate/validators'
import { VALIDATION_FORMAT_SLUG } from '~/utils/validation'

const {
formInput,
id = 'username-or-email',
isOptional,
title,
} = defineProps<{
formInput: BaseValidation<string | undefined>
id?: string
isOptional?: boolean
title?: string
}>()

const emit = defineEmits<{
input: [event: string]
}>()

const { t } = useI18n()

const isEmailLike = computed(() => {
if (!formInput.$model) return false
return String(formInput.$model).includes('@')
})

const inputType = computed(() => {
return isEmailLike.value ? 'email' : 'text'
})

const isValidEmail = (value: string) => {
return email.$validator(value, undefined, undefined)
}

const isValidUsername = (value: string) => {
return VALIDATION_FORMAT_SLUG(value)
}

const handleInput = (value: string) => {
emit('input', value)
formInput.$touch()
}
</script>

<i18n lang="yaml">
de:
usernameOrEmail: Benutzername oder E-Mail-Adresse
en:
usernameOrEmail: Username or Email address
</i18n>
57 changes: 57 additions & 0 deletions src/app/pages/account/verify/create.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<div class="flex grow flex-col">
<LayoutTopBar>
{{ title }}
</LayoutTopBar>
<div class="flex grow flex-col justify-center gap-8 p-8">
<p class="font-bold">
{{ t('checkEmail') }}
</p>
<ButtonColored
:aria-label="t('waiting')"
:variant="buttonVariant"
class="w-full rounded-lg px-4"
:to="
localePath({
path: '/session/create',
})
"
>
{{ buttonText }}
</ButtonColored>
</div>
</div>
</template>

<script setup lang="ts">
definePageMeta({
layout: 'plain',
})

const localePath = useLocalePath()
const { t } = useI18n()
const title = t('title')
const buttonText = ref(t('waiting'))
const buttonVariant = ref<'secondary' | 'primary'>('secondary')

onMounted(() => {
window.addEventListener('focus', () => {
buttonText.value = t('signIn')
buttonVariant.value = 'primary'
})
})
</script>

<i18n lang="yaml">
de:
checkEmail: Überprüfe deine E-Mails für einen Bestätigungslink.
signIn: Anmelden
title: Verifizierung
waiting: Warten auf dich...

en:
checkEmail: Check your email for a verification link.
signIn: Sign In
title: Email Verification Required
waiting: Waiting for you..
</i18n>
26 changes: 26 additions & 0 deletions src/app/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,29 @@ export const validateUsername = (invert?: boolean) => async (value: string) => {
? !result.data?.accountByUsername
: !!result.data?.accountByUsername
}

export const VALIDATION_USERNAME_OR_EMAIL = ({
isRequired,
}: {
isRequired?: boolean
}) => ({
format: (value: string) => {
if (!value) return true
if (value.includes('@')) {
return email.$validator(value, undefined, undefined)
} else {
return VALIDATION_FORMAT_SLUG(value)
}
},
lengthMax: {
$validator: (value: string) => {
if (!value) return true
if (value.includes('@')) {
return value.length <= VALIDATION_EMAIL_ADDRESS_LENGTH_MAXIMUM
} else {
return value.length <= VALIDATION_USERNAME_LENGTH_MAXIMUM
}
},
},
...(isRequired ? { required } : {}),
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/support/contact" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/support/contact" />
</url>
<url>
<loc>http://localhost:3001/de/account/verify/create</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/account/verify/create" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/account/verify/create" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/account/verify/create" />
</url>
<url>
<loc>http://localhost:3001/de/docs/legal/attributions</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/docs/legal/attributions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/support/contact" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/support/contact" />
</url>
<url>
<loc>http://localhost:3001/de/account/verify/create</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/account/verify/create" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/account/verify/create" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/account/verify/create" />
</url>
<url>
<loc>http://localhost:3001/de/docs/legal/attributions</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/docs/legal/attributions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/support/contact" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/support/contact" />
</url>
<url>
<loc>http://localhost:3001/de/account/verify/create</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/account/verify/create" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/account/verify/create" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/account/verify/create" />
</url>
<url>
<loc>http://localhost:3001/de/docs/legal/attributions</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/docs/legal/attributions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/support/contact" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/support/contact" />
</url>
<url>
<loc>http://localhost:3001/account/verify/create</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/account/verify/create" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/account/verify/create" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/account/verify/create" />
</url>
<url>
<loc>http://localhost:3001/docs/legal/attributions</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/docs/legal/attributions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/support/contact" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/support/contact" />
</url>
<url>
<loc>http://localhost:3001/account/verify/create</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/account/verify/create" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/account/verify/create" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/account/verify/create" />
</url>
<url>
<loc>http://localhost:3001/docs/legal/attributions</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/docs/legal/attributions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/support/contact" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/support/contact" />
</url>
<url>
<loc>http://localhost:3001/account/verify/create</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/account/verify/create" />
<xhtml:link rel="alternate" hreflang="en" href="http://localhost:3001/account/verify/create" />
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:3001/account/verify/create" />
</url>
<url>
<loc>http://localhost:3001/docs/legal/attributions</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://localhost:3001/de/docs/legal/attributions" />
Expand Down
Loading