resend email verification

This commit is contained in:
2025-02-06 13:19:50 +01:00
parent b515a68d02
commit 4169aeffb3
2 changed files with 62 additions and 5 deletions

View File

@@ -93,7 +93,8 @@ export default defineConfig((/* ctx */) => {
// Quasar plugins
plugins: [
'Notify',
'Loading'
'Loading',
'Dialog'
]
},

View File

@@ -29,8 +29,26 @@
<p class="text-grey-6 cursor-pointer">
<span @click='onLogin = false; email = ""; password = ""; repassword = "";'>Not reigistered? Created an
Account</span><br>
<span @click='onLogin = false; email = ""; password = ""; repassword = "";'>Not verified? Resend
email</span>
<span @click='prompt = true; email = ""; password = ""; repassword = "";'>Not verified? Resend
email</span><br>
<q-dialog v-model="prompt" persistent>
<q-card style="min-width: 350px">
<q-card-section>
<div class="text-h6">Your email</div>
</q-card-section>
<q-card-section class="q-pt-none">
<q-input dense v-model="email_verification" autofocus @keyup.enter="prompt = false" />
</q-card-section>
<q-card-actions align="right" class="text-primary">
<q-btn flat label="Cancel" v-close-popup @click="email_verification = ''" />
<q-btn flat label="Send email" v-close-popup @click="resendEmail"
:disable="email_verification.length < 5" />
</q-card-actions>
</q-card>
</q-dialog>
<span @click='onLogin = false; email = ""; password = ""; repassword = "";'>Forgot password?</span>
</p>
</q-card-section>
</q-card>
@@ -93,6 +111,8 @@ let onLogin = ref(true)
let isPwd = ref(true)
let isPwd1 = ref(true)
let isPwd2 = ref(true)
let prompt = ref(false)
let email_verification = ref('')
const registrar = async () => {
try {
@@ -115,7 +135,10 @@ const registrar = async () => {
}
catch (error) {
if (error instanceof Error) {
alert(error.message)
$q.notify({
type: 'negative',
message: error.message
})
}
}
finally {
@@ -142,7 +165,40 @@ const login = async () => {
}
catch (error) {
if (error instanceof Error) {
alert(error.message)
$q.notify({
type: 'negative',
message: error.message
})
}
}
finally {
$q.loading.hide()
}
}
const resendEmail = async () => {
try {
$q.loading.show({
delay: 200 // ms
})
const { error } = await supabase.auth.resend({
type: 'signup',
email: email_verification.value,
options: {
emailRedirectTo: 'http://localhost:9000/verify-email',
},
})
email_verification.value = ''
if (error) throw error
$q.loading.hide()
$q.notify('Check your email for verification link')
}
catch (error) {
if (error instanceof Error) {
$q.notify({
type: 'negative',
message: error.message
})
}
}
finally {