diff --git a/src/components/layout/ModalPagesHeader.vue b/src/components/layout/ModalPagesHeader.vue index 99cc6f2..8fd740e 100644 --- a/src/components/layout/ModalPagesHeader.vue +++ b/src/components/layout/ModalPagesHeader.vue @@ -167,7 +167,7 @@ button:disabled { color: white; &:hover { - background-color: #4e5557; + opacity: 0.8; } } diff --git a/src/helpers/errorHundle.js b/src/helpers/errorHundle.js index 5d0f90a..3464420 100644 --- a/src/helpers/errorHundle.js +++ b/src/helpers/errorHundle.js @@ -57,7 +57,10 @@ const errorManager = { email_not_verified: { triggers: ["email_not_verified"], callback(r, item, component) { - component.$router.push(`/confirm-register/${r.body.token[0].message}`); + component.$router.push({ + name: "confirm-register", + query: { login_email: component.username }, + }); }, }, wrong_2fa_many_times: { diff --git a/src/locales/lang/common.js b/src/locales/lang/common.js index b0eb3ec..c72adb2 100644 --- a/src/locales/lang/common.js +++ b/src/locales/lang/common.js @@ -1,5 +1,12 @@ const common = { ru: { + resend: "Переотправить", + cancel_withdrawal: "Отменить вывод", + againAfter: "повторно через {n} секунд", + confirm_email: "Подтвердить имейл", + email_confirmation: "Подтверждение почты", + email_sent: "Вам отправлено письмо с кодом, введите его в поле ниже", + you_were_registered: "Аккаунт успешно создан", deposit_modal: { title: "Внимание!", text: "Адрес для пополнения для каждой монеты уникален.", @@ -777,6 +784,14 @@ const common = { }, en: { + resend: "Resend", + cancel_withdrawal: "Cancel withdrawal", + againAfter: "again in {n} seconds", + confirm_email: "Confirm Email", + email_confirmation: "Confirm email", + email_sent: + "Email with a code has been sent to you, please enter it in the form below", + you_were_registered: "Account successfully registered", deposit_modal: { title: "Attention!", text: "The deposit address for each coin is unique.", diff --git a/src/modules/account/pages/ConfirmRegister.vue b/src/modules/account/pages/ConfirmRegister.vue index 744de71..80ea2bd 100644 --- a/src/modules/account/pages/ConfirmRegister.vue +++ b/src/modules/account/pages/ConfirmRegister.vue @@ -4,32 +4,52 @@ :style="loginBackground ? `background: ${loginBackground} !important` : {}" > - - + +
+ {{ $t("common.email_sent") }} +
+
+ + + + + + +
@@ -44,46 +64,39 @@ export default { token: this.$route.params.token, timer: 300, awaitSeconds: 300, + confirmationCode: "", + email: "", }; }, mounted() { const savedTime = localStorage.getItem("confirm-email"); + this.email = this.$route.query.login_email || ""; + if (savedTime) { this.showBanner = true; this.runTimer(); } }, methods: { - resendEmail() { - if (this.token) { - this.$http - .post("resend-email-confirmation/", { - token: this.token, - }) - .then(() => { - localStorage.setItem( - "confirm-email", - `${Math.round(new Date().getTime() / 1000)}` - ); - this.showBanner = true; - this.runTimer(); - }) - .catch((error) => { - this.$notify({ - type: "error", - text: error.data?.code, - }); - this.$router.push("/login"); - }); - } else { - this.$router.push("/login"); - } + resendCode() { + this.$http + .post("auth/registration/resend-email/", { + email: this.email, + }) + .then(this.runTimer); }, + cancel() { this.$router.push("/login"); }, runTimer() { - let savedTime = localStorage.getItem("confirm-email"); + let savedTime = + localStorage.getItem("confirm-email") || + `${Math.round(new Date().getTime() / 1000)}`; + this.showBanner = true; + + localStorage.setItem("confirm-email", savedTime); + const timerFn = () => { const currentTime = `${Math.round(new Date().getTime() / 1000)}`; if (savedTime) { @@ -104,11 +117,38 @@ export default { timerFn(); let interval = setInterval(timerFn, 1000); }, + + confirmEmail() { + this.$http + .post("auth/registration/verify-email/", { + key: this.confirmationCode, + }) + .then(() => { + this.$notify({ + type: "success", + title: "", + text: this.$t("common.you_were_registered"), + }); + this.$router.push({ name: "login" }); + }) + .catch((r) => { + if (r.data?.type === "not_found") { + this.$notify({ + type: "error", + title: "", + text: this.$t("common.invalid_code"), + }); + } + }); + }, }, }; diff --git a/src/modules/account/pages/Register.vue b/src/modules/account/pages/Register.vue index fcd9392..f6b537b 100644 --- a/src/modules/account/pages/Register.vue +++ b/src/modules/account/pages/Register.vue @@ -7,7 +7,7 @@ " > -