From fc5b0f1b37bb2879fc078e976f131f3ab81f0eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 17 Mar 2021 18:30:46 +0100 Subject: [PATCH] Refine and translate registration sliders with database handling and auto login --- .../ComponentSlider/ComponentSlider.vue | 6 +- .../Registration/RegistrationSlideCreate.vue | 14 ++++ .../Registration/RegistrationSlideEmail.vue | 71 +++++++------------ .../Registration/RegistrationSlideNonce.vue | 2 - .../Registration/RegistrationSlider.story.js | 57 ++++++++++++--- .../Registration/RegistrationSlider.vue | 24 ++++--- .../components/utils/TranslateErrorMessage.js | 12 ++++ webapp/locales/de.json | 9 ++- webapp/locales/en.json | 9 ++- 9 files changed, 135 insertions(+), 69 deletions(-) create mode 100644 webapp/components/utils/TranslateErrorMessage.js diff --git a/webapp/components/ComponentSlider/ComponentSlider.vue b/webapp/components/ComponentSlider/ComponentSlider.vue index 08f0d4e22..73ec81cf0 100644 --- a/webapp/components/ComponentSlider/ComponentSlider.vue +++ b/webapp/components/ComponentSlider/ComponentSlider.vue @@ -40,7 +40,11 @@ :icon="sliderData.sliders[sliderIndex].button.icon" type="submit" filled - :loading="false" + :loading=" + sliderData.sliders[sliderIndex].button.loading !== undefined + ? sliderData.sliders[sliderIndex].button.loading + : false + " :disabled="!sliderData.sliders[sliderIndex].validated" @click="onNextClick" > diff --git a/webapp/components/Registration/RegistrationSlideCreate.vue b/webapp/components/Registration/RegistrationSlideCreate.vue index 8cb2bf897..26d670ca4 100644 --- a/webapp/components/Registration/RegistrationSlideCreate.vue +++ b/webapp/components/Registration/RegistrationSlideCreate.vue @@ -284,6 +284,9 @@ export default { const termsAndConditionsAgreedVersion = VERSION const locale = this.$i18n.locale() try { + this.sliderData.setSliderValuesCallback(null, { + sliderSettings: { buttonLoading: true }, + }) await this.$apollo.mutate({ mutation: SignupVerificationMutation, variables: { @@ -298,7 +301,18 @@ export default { }, }) this.response = 'success' + setTimeout(async () => { + await this.$store.dispatch('auth/login', { email, password }) + this.$toast.success('You are logged in!') // Wolle + this.$router.push('/') + this.sliderData.setSliderValuesCallback(null, { + sliderSettings: { buttonLoading: false }, + }) + }, 3000) } catch (err) { + this.sliderData.setSliderValuesCallback(null, { + sliderSettings: { buttonLoading: false }, + }) this.response = 'error' } }, diff --git a/webapp/components/Registration/RegistrationSlideEmail.vue b/webapp/components/Registration/RegistrationSlideEmail.vue index 7e83c3996..75c1dfec5 100644 --- a/webapp/components/Registration/RegistrationSlideEmail.vue +++ b/webapp/components/Registration/RegistrationSlideEmail.vue @@ -1,5 +1,4 @@