-
-
Notifications
You must be signed in to change notification settings - Fork 667
feat(web): add verify email button on settings page #930
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,12 @@ import { | |
| mdiCalendarClock, | ||
| mdiPlus, | ||
| } from '@mdi/js' | ||
| import { getAuth, signOut, type User as FirebaseUser } from 'firebase/auth' | ||
| import { | ||
| getAuth, | ||
| sendEmailVerification, | ||
| signOut, | ||
| type User as FirebaseUser, | ||
| } from 'firebase/auth' | ||
| import QRCode from 'qrcode' | ||
| import { ErrorMessages } from '~/utils/errors' | ||
| import { toApiError } from '~/utils/api-error' | ||
|
|
@@ -45,6 +50,28 @@ const notificationsStore = useNotificationsStore() | |
|
|
||
| const firebaseUser = ref<FirebaseUser | null>(null) | ||
| const gravatarUrl = ref<string | null>(null) | ||
| const sendingVerificationEmail = ref(false) | ||
| const verificationEmailSent = ref(false) | ||
|
|
||
| async function sendVerificationEmail() { | ||
| if (!firebaseUser.value) return | ||
| sendingVerificationEmail.value = true | ||
| try { | ||
| await sendEmailVerification(firebaseUser.value) | ||
| verificationEmailSent.value = true | ||
| notificationsStore.addNotification({ | ||
| message: 'Verification email sent. Please check your inbox.', | ||
| type: 'success', | ||
| }) | ||
| } catch { | ||
| notificationsStore.addNotification({ | ||
| message: 'Failed to send verification email. Please try again later.', | ||
| type: 'error', | ||
| }) | ||
| } finally { | ||
| sendingVerificationEmail.value = false | ||
| } | ||
| } | ||
|
|
||
| const computeGravatarUrl = async (email: string): Promise<string> => { | ||
| const normalized = email.trim().toLowerCase() | ||
|
|
@@ -819,6 +846,17 @@ onMounted(async () => { | |
| color="primary" | ||
| :icon="mdiShieldCheck" | ||
| /> | ||
| <VBtn | ||
| v-else | ||
| size="x-small" | ||
| variant="tonal" | ||
| color="warning" | ||
| :loading="sendingVerificationEmail" | ||
| :disabled="verificationEmailSent" | ||
| @click="sendVerificationEmail" | ||
| > | ||
| Verify Email | ||
| </VBtn> | ||
| </h4> | ||
|
Comment on lines
+850
to
861
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| <VAutocomplete | ||
| v-if="authStore.user" | ||
|
|
@@ -834,7 +872,7 @@ onMounted(async () => { | |
| </div> | ||
|
|
||
| <!-- API Key --> | ||
| <h5 class="text-headline-large mb-3 mt-3">API Key</h5> | ||
| <h5 class="text-headline-large mb-3 mt-0">API Key</h5> | ||
| <p class="text-medium-emphasis"> | ||
| Use your API Key in the <v-code>x-api-key</v-code> HTTP Header | ||
| when sending requests to | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.