make email validation conditional work

This commit is contained in:
Shpuld Shpuldson 2020-05-04 12:56:39 +03:00
parent 101eebb40b
commit f7f8a579fa

View file

@ -14,15 +14,17 @@ const registration = {
}, },
captcha: {} captcha: {}
}), }),
validations: { validations () {
user: { return {
email: requiredIf('accountActivationRequired'), user: {
username: { required }, email: { required: requiredIf(() => this.accountActivationRequired) },
fullname: { required }, username: { required },
password: { required }, fullname: { required },
confirm: { password: { required },
required, confirm: {
sameAsPassword: sameAs('password') required,
sameAsPassword: sameAs('password')
}
} }
} }
}, },
@ -43,7 +45,8 @@ const registration = {
signedIn: (state) => !!state.users.currentUser, signedIn: (state) => !!state.users.currentUser,
isPending: (state) => state.users.signUpPending, isPending: (state) => state.users.signUpPending,
serverValidationErrors: (state) => state.users.signUpErrors, serverValidationErrors: (state) => state.users.signUpErrors,
termsOfService: (state) => state.instance.tos termsOfService: (state) => state.instance.tos,
accountActivationRequired: (state) => state.instance.accountActivationRequired
}) })
}, },
methods: { methods: {