Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

feat(web): add verify email button on settings page

Acho Arnold Ewin27f7116d9216
diff --git a/web/app/pages/settings/index.vue b/web/app/pages/settings/index.vue
index 8861ec12..eb5a1db0 100644
--- a/web/app/pages/settings/index.vue
+++ b/web/app/pages/settings/index.vue
@@ -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>
<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