From ebc0d3c71801e010399086abdf3342e274f5a041 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Mon, 21 Nov 2022 17:55:35 +0000 Subject: [PATCH] also handle email verification --- src/boot/routes.js | 2 ++ .../awaiting_email_confirmation.js | 4 ++++ .../awaiting_email_confirmation.vue | 12 ++++++++++++ src/components/registration/registration.js | 2 ++ src/i18n/en.json | 2 ++ src/modules/users.js | 2 +- 6 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/components/awaiting_email_confirmation/awaiting_email_confirmation.js create mode 100644 src/components/awaiting_email_confirmation/awaiting_email_confirmation.vue diff --git a/src/boot/routes.js b/src/boot/routes.js index 04ba2717..93a94a9b 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -23,6 +23,7 @@ import ListTimeline from 'components/list_timeline/list_timeline.vue' import ListEdit from 'components/list_edit/list_edit.vue' import AnnouncementsPage from 'components/announcements_page/announcements_page.vue' import RegistrationRequestSent from 'components/registration_request_sent/registration_request_sent.vue' +import AwaitingEmailConfirmation from 'components/awaiting_email_confirmation/awaiting_email_confirmation.vue' export default (store) => { const validateAuthenticatedRoute = (to, from, next) => { @@ -64,6 +65,7 @@ export default (store) => { { name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute }, { name: 'registration', path: '/registration', component: Registration }, { name: 'registration-request-sent', path: '/registration-request-sent', component: RegistrationRequestSent }, + { name: 'awaiting-email-confirmation', path: '/awaiting-email-confirmation', component: AwaitingEmailConfirmation }, { name: 'password-reset', path: '/password-reset', component: PasswordReset, props: true }, { name: 'registration-token', path: '/registration/:token', component: Registration }, { name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute }, diff --git a/src/components/awaiting_email_confirmation/awaiting_email_confirmation.js b/src/components/awaiting_email_confirmation/awaiting_email_confirmation.js new file mode 100644 index 00000000..3809de4a --- /dev/null +++ b/src/components/awaiting_email_confirmation/awaiting_email_confirmation.js @@ -0,0 +1,4 @@ +export default { + computed: { + } +} diff --git a/src/components/awaiting_email_confirmation/awaiting_email_confirmation.vue b/src/components/awaiting_email_confirmation/awaiting_email_confirmation.vue new file mode 100644 index 00000000..559457e6 --- /dev/null +++ b/src/components/awaiting_email_confirmation/awaiting_email_confirmation.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index 28f2d2e5..9778a2f3 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -84,6 +84,8 @@ const registration = { this.$router.push({ name: 'friends' }) } else if (data.identifier === 'awaiting_approval') { this.$router.push({ name: 'registration-request-sent' }) + } else if (data.identifier === 'missing_confirmed_email') { + this.$router.push({ name: 'awaiting-email-confirmation' }) } else { console.warn('Unknown response from sign up', data) } diff --git a/src/i18n/en.json b/src/i18n/en.json index a6316305..2de13ace 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -409,6 +409,8 @@ } }, "registration": { + "awaiting_email_confirmation_title": "Awaiting email confirmation", + "awaiting_email_confirmation": "Your account has been registered and an email has been sent to your address. Please check the email to complete registration.", "bio": "Bio", "bio_placeholder": "e.g.\nHi! Welcome to my bio.\nI love watching anime and playing games. I hope we can be friends!", "captcha": "CAPTCHA", diff --git a/src/modules/users.js b/src/modules/users.js index f7d0c193..022cc1dc 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -489,7 +489,7 @@ const users = { let data = await rootState.api.backendInteractor.register( { params: { ...userInfo } } ) - if (data.identifier === 'awaiting_approval') { + if (data.identifier === 'awaiting_approval' || data.identifier === 'missing_confirmed_email') { store.commit('signUpSuccess') return data } else if (data.me !== undefined) {