Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(account)!: update authentication flow #1687

Open
wants to merge 66 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9a5ad6c
feat(tailwind): add accent colors
dargmuesli Dec 9, 2024
62b99d6
feat(button-colored): update secondary style
dargmuesli Dec 9, 2024
d505463
feat(form-account-sign-in): update registration button
dargmuesli Dec 9, 2024
4a86b2b
feat(tailwind): add accent fancy
huzaifaedhi22 Dec 10, 2024
cd65cbc
feat(AppLink): update accent color
huzaifaedhi22 Dec 10, 2024
f167cc9
feat: update ButtonColored component to accept more styles
huzaifaedhi22 Dec 10, 2024
013980f
feat(form): update form design to match new one
huzaifaedhi22 Dec 10, 2024
e488e14
chore(i18n): update placeholder text to "Create an account"
huzaifaedhi22 Dec 10, 2024
691a5a9
Merge branch 'master' into feat/account/restyle
dargmuesli Dec 11, 2024
2e91ca5
feat(footer): create footer component
huzaifaedhi22 Dec 12, 2024
58dbc9a
feat(layout): add footer component to default layout
huzaifaedhi22 Dec 12, 2024
97a431a
fix(account): convert route paths to route names in footer component
huzaifaedhi22 Dec 13, 2024
21d2920
chore(tests): update visual regression snapshots
huzaifaedhi22 Dec 13, 2024
9d8e747
chore(tests): add visual regression snapshots
huzaifaedhi22 Dec 13, 2024
6af14af
chore(tests): add visual regression test
huzaifaedhi22 Dec 13, 2024
d2e2f4c
feat(account): add modals for privacy policy and general terms accept…
huzaifaedhi22 Dec 16, 2024
10d456f
feat(button): add confirm button component
huzaifaedhi22 Dec 16, 2024
aba3fe0
chore(tailwind): add colors to tailwind config
huzaifaedhi22 Dec 16, 2024
f227f0c
feat(account-register): add privacy policy and general terms modal to…
huzaifaedhi22 Dec 16, 2024
e57282a
fix: linting errors
huzaifaedhi22 Dec 16, 2024
65cb627
fix(modal): resolve transition issue between modals
huzaifaedhi22 Dec 16, 2024
3bd5d44
Merge branch 'master' into feat/account/restyle
huzaifaedhi22 Dec 18, 2024
15fe2fc
feat(account):add uuid field to accountRegistration mutation response
huzaifaedhi22 Dec 18, 2024
8e26419
feat(account): add acceptLegalTermAcceptance mutation
huzaifaedhi22 Dec 18, 2024
b842e02
feat(account): include legal acceptance mutation in registration flow
huzaifaedhi22 Dec 18, 2024
5f72daf
chore(gql): update generated gql files
huzaifaedhi22 Dec 18, 2024
5d528c3
feat(account): add terms id to registration flow
huzaifaedhi22 Dec 25, 2024
8a89c74
feat(generalTerms): create and use general terms query
huzaifaedhi22 Dec 25, 2024
faa0089
Merge branch 'master' into feat/account/restyle
huzaifaedhi22 Dec 25, 2024
59cc12c
fix(lint): typos in graph ql files
huzaifaedhi22 Dec 25, 2024
4927602
merge master
huzaifaedhi22 Dec 25, 2024
9df88a4
fix(typo) : remove typo
huzaifaedhi22 Dec 25, 2024
5c3da72
chore(merge): resolve conflicts and merge master
huzaifaedhi22 Mar 6, 2025
e9839bf
refactor(query): use nodes instead of edges
huzaifaedhi22 Mar 6, 2025
510a11f
chore(merge) : Merge branch 'main' into feat/account/restyle
huzaifaedhi22 Mar 7, 2025
a0ba90c
chore(shad-cn): add shad cn dialogue and shadbutton
huzaifaedhi22 Mar 8, 2025
43b3d60
chore(colors): add colors from new design
huzaifaedhi22 Mar 8, 2025
6a4e201
feat(account): implement updated design for account signup and login
huzaifaedhi22 Mar 8, 2025
2354350
refactor(empty-lines):remove
huzaifaedhi22 Mar 8, 2025
41ed214
chore(shad-cn): shadcn components index and deps
huzaifaedhi22 Mar 8, 2025
3f388fc
feat(modals): use shadcn for modals
huzaifaedhi22 Mar 8, 2025
e872835
chore(text): update text
huzaifaedhi22 Mar 8, 2025
39d1058
feat(forms): use updated design for forms
huzaifaedhi22 Mar 13, 2025
4166f8f
feat(styling): update modals for dark mode
huzaifaedhi22 Mar 13, 2025
e906d96
feat(validator): add validator to allow both username and email to si…
huzaifaedhi22 Mar 13, 2025
37809aa
chore(resolve-conflicts) : merge branch main into feat/account/restyle
huzaifaedhi22 Mar 13, 2025
b3e577b
chore(colors): add colors
huzaifaedhi22 Mar 13, 2025
a0f54a0
fix(deps): sync lockfile
huzaifaedhi22 Mar 13, 2025
00ec0e2
fix(shadcn): use updated import
huzaifaedhi22 Mar 13, 2025
a906d4f
fix(shad-button): export as ShadButton to avoid conflict
huzaifaedhi22 Mar 13, 2025
4726b26
fix(css): merge app.css and maevsi.css
huzaifaedhi22 Mar 13, 2025
30260f9
chore(merge):Merge branch main into feat/account/restyle
huzaifaedhi22 Mar 14, 2025
727c9ef
chore(deps): deduplicate dependencies
dargmuesli Mar 14, 2025
1be2e06
fix(turnstile): set token without store
dargmuesli Mar 14, 2025
79a64a1
chore(tests) : update tests
huzaifaedhi22 Mar 14, 2025
e90f4ef
fix(styles): pass correct color variable
huzaifaedhi22 Mar 14, 2025
4941401
chore(sync) : Merge branch 'main' into feat/account/restyle
huzaifaedhi22 Mar 17, 2025
ea4b8e1
feat(modals): add back button to modals
huzaifaedhi22 Mar 18, 2025
e24a7e2
fix(termId): add legal term id to account registration mutation
huzaifaedhi22 Mar 19, 2025
ea2730d
feat(pending-verify): add pending verification email page
huzaifaedhi22 Mar 19, 2025
dfebaa9
chore(gql): update gql files
huzaifaedhi22 Mar 19, 2025
f00ae77
refactor(verify): create verify directory instead
huzaifaedhi22 Mar 19, 2025
0ca7e74
chore(tests): update tests
huzaifaedhi22 Mar 19, 2025
ea9db67
chore(tests): add new screenshots
huzaifaedhi22 Mar 19, 2025
68ad066
chore(tests): update tests
huzaifaedhi22 Mar 19, 2025
c07b891
chore(test): update snapshots
dargmuesli Mar 20, 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
2 changes: 1 addition & 1 deletion src/app/components/_/AppLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const emit = defineEmits<{
const classes = computed(() => {
return [
'rounded',
...(props.isColored ? ['text-link-dark dark:text-link-bright'] : []),
...(props.isColored ? ['text-accent-strong dark:text-link-bright'] : []),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? Shouldn't it be

Suggested change
...(props.isColored ? ['text-accent-strong dark:text-link-bright'] : []),
...(props.isColored ? ['text-(--accent-strong= dark:text-link-bright'] : []),

?

...(props.isDisabled ? ['disabled'] : []),
...(props.isUnderlined ? ['underline'] : []),
].join(' ')
Expand Down
17 changes: 6 additions & 11 deletions src/app/components/button/ButtonColored.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
:aria-label="ariaLabel"
class="justify-center rounded-md px-4 py-2 font-medium"
:class="
[
...(isPrimary
? [
'bg-gradient-to-tr from-blue-500 to-blue-600 text-text-bright dark:from-blue-300 dark:to-blue-400 dark:text-text-dark',
]
: [
'border border-gray-300 text-text-dark hover:bg-black/5 dark:border-gray-600 dark:text-text-bright dark:hover:bg-black/30',
]),
].join(' ')
variant === 'primary'
? 'bg-accent-fancy from-blue-500 to-blue-600 text-text-bright hover:bg-accent-strong dark:from-blue-300 dark:to-blue-400 dark:text-text-dark'
: 'bg-accent-weak text-accent-strong hover:bg-accent-mid dark:border dark:border-gray-600 dark:bg-inherit dark:text-text-bright dark:hover:bg-black/30'
"
:disabled="disabled"
:to="props.to"
Expand All @@ -35,14 +29,15 @@ export interface Props {
ariaLabel: string
disabled?: boolean
isExternal?: boolean
isPrimary?: boolean
variant?: 'primary' | 'accent'
to?: RouteLocationRaw
type?: 'button' | 'reset' | 'submit'
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line to be removed

const props = withDefaults(defineProps<Props>(), {
disabled: false,
isExternal: undefined,
isPrimary: true,
variant: 'primary', // default variant
to: undefined,
type: 'button',
})
Expand Down
27 changes: 27 additions & 0 deletions src/app/components/button/ButtonConfirm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<button
:aria-label="ariaLabel"
:class="[
'w-full justify-center rounded-md px-4 py-2 font-medium transition-colors',
disabled
? 'text-faint-mid cursor-not-allowed bg-faint-weak'
: 'bg-accent-strong text-text-bright hover:bg-accent-mid dark:bg-accent-strong dark:text-text-dark',
]"
:disabled="disabled"
:type="type"
@click="handleSubmit"
>
<slot />
</button>
</template>

<script setup lang="ts">
export interface Props {
ariaLabel: string
disabled?: boolean
type?: 'button' | 'reset' | 'submit'
handleSubmit: () => void
}

defineProps<Props>()
</script>
33 changes: 33 additions & 0 deletions src/app/components/footer/Footer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<footer class="mt-auto py-8">
<div class="mx-auto flex flex-row justify-center gap-x-20">
<AppLink :to="localePath('legal-notice')" :is-colored="true">
{{ t('terms') }}
</AppLink>

<AppLink :to="localePath('index')" :is-colored="true">
{{ t('imprint') }}
</AppLink>

Comment on lines +7 to +11
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<AppLink :to="localePath('index')" :is-colored="true">
{{ t('imprint') }}
</AppLink>
<AppLink :to="localePath('index')" :is-colored="true">
{{ t('imprint') }}
</AppLink>

<AppLink :to="localePath('privacy-policy')" :is-colored="true">
{{ t('policy') }}
</AppLink>
</div>
</footer>
</template>

<script setup lang="ts">
const { t } = useI18n()
const localePath = useLocalePath()
</script>

<i18n lang="yaml">
de:
terms: Bedingungen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
terms: Bedingungen
terms: Nutzungsbedingungen

imprint: Impressum
policy: Datenschutzrichtlinie
en:
terms: Terms
imprint: Imprint
policy: Policy
</i18n>
3 changes: 2 additions & 1 deletion src/app/components/form/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<div class="flex flex-col">
<div class="flex min-h-0 flex-col gap-6">
<slot />
<div class="flex flex-col items-center justify-between">
<div class="flex flex-col justify-between">
<ButtonColored
:aria-label="submitName || t('submit')"
:is-primary="false"
:class="{
'animate-shake': $error,
}"
Expand Down
86 changes: 64 additions & 22 deletions src/app/components/form/account/FormAccountRegistration.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<template>
<div class="flex flex-col items-center gap-4">
<ButtonColored
:is-primary="false"
:aria-label="t('register')"
:to="localePath('session-create')"
>
{{ t('signIn') }}
<template #prefix>
<IHeroiconsArrowLeft />
</template>
</ButtonColored>
<Form
:errors="api.errors"
:errors-pg-ids="{
Expand All @@ -20,7 +10,7 @@
form-class="w-full"
:is-form-sent="isFormSent"
:submit-name="t('register')"
@submit.prevent="submit"
@submit.prevent="handleSubmit"
>
<FormInputUsername
:form-input="v$.username"
Expand All @@ -47,45 +37,86 @@
</FormInputStateInfo>
</template>
</Form>

<AppLink
:to="localePath('session-create')"
:is-underlined="true"
:is-colored="true"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:is-underlined="true"
:is-colored="true"
is-underlined
is-colored

>
{{ t('alreadyHaveAnAccount') }}
</AppLink>

<!-- Modals -->
<ModalPrivacyPolicy
v-model="privacyModalOpen"
@open-general-terms="openGeneralTerms"
/>

<ModalGeneralTerms v-model="generalTermsModalOpen" @accepted="submit" />
</div>
</template>

<script setup lang="ts">
import { useVuelidate } from '@vuelidate/core'
import { useCreateLegalTermAcceptanceMutation } from '~~/gql/documents/mutations/account/accountLegalTermAcceptance'
import { useAccountRegistrationMutation } from '~~/gql/documents/mutations/account/accountRegistration'

const { locale, t } = useI18n()
const localePath = useLocalePath()
const fireAlert = useFireAlert()
const store = useMaevsiStore()

// api data
const privacyModalOpen = ref(false)
const generalTermsModalOpen = ref(false)

const accountRegistrationMutation = useAccountRegistrationMutation()
const api = getApiData([accountRegistrationMutation])

// data
const form = reactive({
captcha: ref<string>(),
emailAddress: ref<string>(),
password: ref<string>(),
username: ref<string>(),
})
const isFormSent = ref(false)

// methods
const submit = async () => {
if (!(await isFormValid({ v$, isFormSent }))) return
const isFormSent = ref(false)

// Methods
const submit = async (termId: string) => {
store.turnstileToken = form.captcha

const result = await accountRegistrationMutation.executeMutation({
const accountResult = await accountRegistrationMutation.executeMutation({
emailAddress: form.emailAddress || '',
language: locale.value,
password: form.password || '',
username: form.username || '',
})

if (result.error || !result.data) return
if (accountResult.error) {
return
}

const accountUuid = accountResult.data?.accountRegistration?.uuid
if (!accountUuid) {
console.error('No account UUID received')
return
}

const legalTermAcceptanceMutation = useCreateLegalTermAcceptanceMutation()

const acceptanceResult = await legalTermAcceptanceMutation.executeMutation({
input: {
legalTermAcceptance: {
accountId: accountUuid,
legalTermId: termId,
},
},
})

if (acceptanceResult.error) {
console.error('Legal term acceptance error:', acceptanceResult.error)
return
}

await fireAlert({
level: 'success',
Expand All @@ -94,6 +125,16 @@ const submit = async () => {
})
}

const handleSubmit = async () => {
if (!(await isFormValid({ v$, isFormSent }))) return

privacyModalOpen.value = true
}

const openGeneralTerms = () => {
generalTermsModalOpen.value = true
}

// vuelidate
const rules = {
captcha: VALIDATION_CAPTCHA(),
Expand All @@ -104,6 +145,7 @@ const rules = {
password: VALIDATION_PASSWORD(),
emailAddress: VALIDATION_EMAIL_ADDRESS({ isRequired: true }),
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line to be removed, it's all the vuelidate part

const v$ = useVuelidate(rules, form)
</script>

Expand All @@ -115,13 +157,13 @@ de:
register: Registrieren
registrationSuccessBody: Verifiziere deinen Account über den Link in der E-Mail, die du in Kürze erhalten wirst.
registrationSuccessTitle: Verifizierungs-E-Mail gesendet.
signIn: Stattdessen anmelden
alreadyHaveAnAccount: 'Du hast bereits ein Konto? Anmelden'
en:
accountDeletionNotice: "You'll be able to delete your account at any time."
postgres22023: Your password is too short! Think of a longer one.
postgres23505: This username or email address is already in use! Think of a new name or try signing in instead.
register: Register
register: Sign Up
registrationSuccessBody: Verify your account using the verification link sent to you by email.
registrationSuccessTitle: Verification email sent.
signIn: Sign in instead
alreadyHaveAnAccount: Already have an account? Log in
</i18n>
32 changes: 18 additions & 14 deletions src/app/components/form/account/FormAccountSignIn.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<template>
<div class="flex flex-col items-center gap-4">
<ButtonColored
:is-primary="false"
:aria-label="t('register')"
:to="localePath('account-create')"
>
{{ t('register') }}
<template #prefix>
<IHeroiconsArrowRight />
</template>
</ButtonColored>
<Form
:errors="api.errors"
:errors-pg-ids="{
Expand Down Expand Up @@ -56,7 +46,21 @@
</ButtonColored>
</template>
</Form>
<AppLink :to="localePath('account-password-reset-request')">
<div class="flex w-full flex-col justify-between">
<ButtonColored
variant="accent"
:aria-label="t('register')"
:to="localePath('account-create')"
class="w-full"
>
{{ t('register') }}
</ButtonColored>
</div>
<AppLink
:to="localePath('account-password-reset-request')"
:is-underlined="true"
:is-colored="true"
>
{{ t('passwordReset') }}
</AppLink>
</div>
Expand Down Expand Up @@ -140,14 +144,14 @@ de:
passwordReset: Passwort zurücksetzen
postgres55000: Deine E-Mail-Adresse ist noch nicht verifiziert! Schau in dein E-Mail-Postfach, ggf. auch in den Spam-Ordner, oder kontaktiere den Support.
postgresP0002: Anmeldung fehlgeschlagen! Hast du dich schon registriert? Überprüfe deine Eingaben auf Schreibfehler oder kontaktiere den Support.
register: Stattdessen registrieren
register: Konto erstellen
signIn: Anmelden
en:
contactSupport: Contact support
jwtStoreFail: Failed to store the authentication data!
passwordReset: Reset password
passwordReset: I forgot my password
postgres55000: Your email address has not been verified yet! Check your email inbox, including the spam folder if necessary, or contact support.
postgresP0002: Login failed! Have you registered yet? Check your input for spelling mistakes or contact support.
register: Register instead
register: Create an account
signIn: Sign in
</i18n>
Loading
Loading