refactor: better ui + ux for email sign in
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div slot="body" class="flex flex-col">
|
<div v-if="mode === 'sign-in'" slot="body" class="flex flex-col">
|
||||||
<label for="email"> E-mail </label>
|
<label for="email"> E-mail </label>
|
||||||
<input
|
<input
|
||||||
id="email"
|
id="email"
|
||||||
@@ -25,7 +25,21 @@
|
|||||||
@keyup.enter="signInWithEmail"
|
@keyup.enter="signInWithEmail"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer">
|
<div v-else slot="body" class="flex flex-col items-center">
|
||||||
|
<div class="flex justify-center max-w-md p-4 items-center flex-col">
|
||||||
|
<i class="material-icons text-acColor" style="font-size: 64px">
|
||||||
|
verified
|
||||||
|
</i>
|
||||||
|
<h3 class="font-bold my-2 text-center text-lg">
|
||||||
|
{{ $t("we_sent_magic_link") }}
|
||||||
|
</h3>
|
||||||
|
<p class="text-center">
|
||||||
|
{{ $t("we_sent_magic_link_description", { email: form.email }) }}
|
||||||
|
</p>
|
||||||
|
<p class="info">{{ $t("check_your_inbox") }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="mode === 'sign-in'" slot="footer">
|
||||||
<div class="row-wrapper">
|
<div class="row-wrapper">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span>
|
<span>
|
||||||
@@ -70,6 +84,7 @@ export default {
|
|||||||
signingInWithEmail: false,
|
signingInWithEmail: false,
|
||||||
emailRegex:
|
emailRegex:
|
||||||
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/,
|
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/,
|
||||||
|
mode: "sign-in",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -98,10 +113,7 @@ export default {
|
|||||||
await fb
|
await fb
|
||||||
.signInWithEmail(this.form.email, actionCodeSettings)
|
.signInWithEmail(this.form.email, actionCodeSettings)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success("Check your inbox", {
|
this.mode = "email"
|
||||||
icon: "email",
|
|
||||||
duration: 0,
|
|
||||||
})
|
|
||||||
window.localStorage.setItem("emailForSignIn", this.form.email)
|
window.localStorage.setItem("emailForSignIn", this.form.email)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -115,6 +127,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
hideModal() {
|
hideModal() {
|
||||||
|
this.mode = "sign-in"
|
||||||
this.$toast.clear()
|
this.$toast.clear()
|
||||||
this.$emit("hide-modal")
|
this.$emit("hide-modal")
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -333,5 +333,9 @@
|
|||||||
"user_removed": "User removed successfully",
|
"user_removed": "User removed successfully",
|
||||||
"import_from_my_collections": "Import from My Collections",
|
"import_from_my_collections": "Import from My Collections",
|
||||||
"export_as_json": "Export as JSON",
|
"export_as_json": "Export as JSON",
|
||||||
"send_magic_link": "Send a magic link to sign in"
|
"send_magic_link": "Send a magic link to sign in",
|
||||||
|
"check_your_inbox": "Check your inbox.",
|
||||||
|
"you_can_dismiss_this_modal": "You can dismiss this ",
|
||||||
|
"we_sent_magic_link": "We sent you a magic link!",
|
||||||
|
"we_sent_magic_link_description": "We sent an email to {email}. It contains a magic link that’ll log you in."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user