aboutsummaryrefslogtreecommitdiff
path: root/src/components/registration
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2022-03-26 13:03:23 -0400
committerTusooa Zhu <tusooa@kazv.moe>2022-04-29 20:34:32 -0400
commit1d36ea5ec58c8df870a0c6c1ec267b78b8db28f0 (patch)
tree249e59465dd01ccb47d6bae8c56df78ec51f0e8d /src/components/registration
parentd39de3022108c4a42d20fe2a38265179ae0062f9 (diff)
Add email language option to registration form
Diffstat (limited to 'src/components/registration')
-rw-r--r--src/components/registration/registration.js14
-rw-r--r--src/components/registration/registration.vue12
2 files changed, 24 insertions, 2 deletions
diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js
index a3ef0f04..e3f6b875 100644
--- a/src/components/registration/registration.js
+++ b/src/components/registration/registration.js
@@ -1,6 +1,8 @@
import useVuelidate from '@vuelidate/core'
import { required, requiredIf, sameAs } from '@vuelidate/validators'
import { mapActions, mapState } from 'vuex'
+import InterfaceLanguageSwitcher from '../interface_language_switcher/interface_language_switcher.vue'
+import localeService from '../../services/locale/locale.service.js'
const registration = {
setup () { return { v$: useVuelidate() } },
@@ -11,10 +13,14 @@ const registration = {
username: '',
password: '',
confirm: '',
- reason: ''
+ reason: '',
+ language: '',
},
captcha: {}
}),
+ components: {
+ InterfaceLanguageSwitcher
+ },
validations () {
return {
user: {
@@ -26,7 +32,8 @@ const registration = {
required,
sameAs: sameAs(this.user.password)
},
- reason: { required: requiredIf(() => this.accountApprovalRequired) }
+ reason: { required: requiredIf(() => this.accountApprovalRequired) },
+ language: {}
}
}
},
@@ -64,6 +71,9 @@ const registration = {
this.user.captcha_solution = this.captcha.solution
this.user.captcha_token = this.captcha.token
this.user.captcha_answer_data = this.captcha.answer_data
+ if (this.user.language) {
+ this.user.language = localeService.internalToBackendLocale(this.user.language)
+ }
this.v$.$touch()
diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue
index 3d409109..6fa70a09 100644
--- a/src/components/registration/registration.vue
+++ b/src/components/registration/registration.vue
@@ -163,6 +163,18 @@
</div>
<div
+ class="form-group"
+ :class="{ 'form-group--error': $v.user.language.$error }"
+ >
+ <interface-language-switcher
+ for="email-language"
+ :prompt-text="$t('registration.email_language')"
+ :language="$v.user.language.$model"
+ :set-language="val => $v.user.language.$model = val"
+ />
+ </div>
+
+ <div
v-if="accountApprovalRequired"
class="form-group"
>