also handle email verification
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed

This commit is contained in:
FloatingGhost 2022-11-21 17:55:35 +00:00
parent 17b0b48b5b
commit ebc0d3c718
6 changed files with 23 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import ListTimeline from 'components/list_timeline/list_timeline.vue'
import ListEdit from 'components/list_edit/list_edit.vue' import ListEdit from 'components/list_edit/list_edit.vue'
import AnnouncementsPage from 'components/announcements_page/announcements_page.vue' import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
import RegistrationRequestSent from 'components/registration_request_sent/registration_request_sent.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) => { export default (store) => {
const validateAuthenticatedRoute = (to, from, next) => { const validateAuthenticatedRoute = (to, from, next) => {
@ -64,6 +65,7 @@ export default (store) => {
{ name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute }, { name: 'dms', path: '/users/:username/dms', component: DMs, beforeEnter: validateAuthenticatedRoute },
{ name: 'registration', path: '/registration', component: Registration }, { name: 'registration', path: '/registration', component: Registration },
{ name: 'registration-request-sent', path: '/registration-request-sent', component: RegistrationRequestSent }, { 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: 'password-reset', path: '/password-reset', component: PasswordReset, props: true },
{ name: 'registration-token', path: '/registration/:token', component: Registration }, { name: 'registration-token', path: '/registration/:token', component: Registration },
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute }, { name: 'friend-requests', path: '/friend-requests', component: FollowRequests, beforeEnter: validateAuthenticatedRoute },

View file

@ -0,0 +1,4 @@
export default {
computed: {
}
}

View file

@ -0,0 +1,12 @@
<template>
<div class="panel panel-default">
<div class="panel-heading">
<h4>{{ $t('registration.awaiting_email_confirmation_title') }}</h4>
</div>
<div class="panel-body">
<p>{{ $t('registration.awaiting_email_confirmation') }}</p>
</div>
</div>
</template>
<script src="./awaiting_email_confirmation.js"></script>

View file

@ -84,6 +84,8 @@ const registration = {
this.$router.push({ name: 'friends' }) this.$router.push({ name: 'friends' })
} else if (data.identifier === 'awaiting_approval') { } else if (data.identifier === 'awaiting_approval') {
this.$router.push({ name: 'registration-request-sent' }) this.$router.push({ name: 'registration-request-sent' })
} else if (data.identifier === 'missing_confirmed_email') {
this.$router.push({ name: 'awaiting-email-confirmation' })
} else { } else {
console.warn('Unknown response from sign up', data) console.warn('Unknown response from sign up', data)
} }

View file

@ -409,6 +409,8 @@
} }
}, },
"registration": { "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": "Bio",
"bio_placeholder": "e.g.\nHi! Welcome to my bio.\nI love watching anime and playing games. I hope we can be friends!", "bio_placeholder": "e.g.\nHi! Welcome to my bio.\nI love watching anime and playing games. I hope we can be friends!",
"captcha": "CAPTCHA", "captcha": "CAPTCHA",

View file

@ -489,7 +489,7 @@ const users = {
let data = await rootState.api.backendInteractor.register( let data = await rootState.api.backendInteractor.register(
{ params: { ...userInfo } } { params: { ...userInfo } }
) )
if (data.identifier === 'awaiting_approval') { if (data.identifier === 'awaiting_approval' || data.identifier === 'missing_confirmed_email') {
store.commit('signUpSuccess') store.commit('signUpSuccess')
return data return data
} else if (data.me !== undefined) { } else if (data.me !== undefined) {