-
-
Notifications
You must be signed in to change notification settings - Fork 18
feat(account): login with username or email #1869
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
Open
huzaifaedhi22
wants to merge
22
commits into
main
Choose a base branch
from
feat/account/emailOrUsername
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8e2735d
feat(account)!: update authentication flow (#1687)
dargmuesli bdbbf1f
chore(release): 10.0.0-beta.1 [skip ci]
semantic-release-bot 01d4cdc
feat(pages): restructure legal (#1859)
dargmuesli fd54c51
feat(login): allow users to login using email or username
huzaifaedhi22 25c7b75
refactor: imports
huzaifaedhi22 d729ff5
fix(max-length): use @ to differentiate bw lengths
huzaifaedhi22 53a06c4
Merge branch 'main' into feat/account/emailOrUsername
huzaifaedhi22 3065cdc
refactor(ts): lint issues
huzaifaedhi22 dd9e044
chore: update tests
huzaifaedhi22 18521bd
Merge branch 'main' into feat/account/emailOrUsername
huzaifaedhi22 e5f5efd
Merge branch 'main' into feat/account/emailOrUsername
huzaifaedhi22 68384e2
Revert changes to Changelog.md
huzaifaedhi22 03394c4
revert: remove changes to pnpm-lock.yaml
huzaifaedhi22 d758802
revert: remove changes to verify/create.vue
huzaifaedhi22 8597547
revert: remove changes to sitemap snapshot
huzaifaedhi22 d6a5be9
refactor: remove title prop, use translation
huzaifaedhi22 f3c89ff
chore: update sitemap snapshots
huzaifaedhi22 eee7612
chore: update regression tests
huzaifaedhi22 d8a1e41
chore: update sitemap
huzaifaedhi22 46527b4
chore: update tests
huzaifaedhi22 f67bd18
Merge branch 'main' into feat/account/emailOrUsername
dargmuesli d07885a
chore(test): update snapshots
dargmuesli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
dargmuesli marked this conversation as resolved.
Show resolved
Hide resolved
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
dargmuesli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.03 KB
(100%)
...n.spec.ts-snapshots/visual-regression-looks-as-before-1-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.79 KB
(110%)
...n.spec.ts-snapshots/visual-regression-looks-as-before-1-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.17 KB
(100%)
...SignIn.spec.ts-snapshots/visual-regression-looks-as-before-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dargmuesli marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.