From 86561592d002b08d6b2cd9549e8057a4ffd091cb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 24 Feb 2020 11:19:00 -0600 Subject: [PATCH 1/3] First attempt at not requiring email address for registration --- src/boot/after_store.js | 3 +++ src/components/registration/registration.js | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index d70e10584b..9fb9a853cd 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -241,6 +241,9 @@ const getNodeInfo = async ({ store }) => { : federation.enabled }) + const accountActivationRequired = metadata.accountActivationRequired + store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired }) + const accounts = metadata.staffAccounts resolveStaffAccounts({ store, accounts }) } else { diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index ace8cc7ce8..fd2942a5a1 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -1,5 +1,5 @@ import { validationMixin } from 'vuelidate' -import { required, sameAs } from 'vuelidate/lib/validators' +import { required, requiredIf, sameAs } from 'vuelidate/lib/validators' import { mapActions, mapState } from 'vuex' const registration = { @@ -16,7 +16,7 @@ const registration = { }), validations: { user: { - email: { required }, + email: requiredIf('accountActivationRequired'), username: { required }, fullname: { required }, password: { required }, @@ -24,6 +24,11 @@ const registration = { required, sameAsPassword: sameAs('password') } + }, + nested: { + required: requiredIf(function (nestedModel) { + return this.accountActivationRequired + }) } }, created () { From 39e3917118293912b2af09f509457d718f0207c9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 24 Feb 2020 11:23:16 -0600 Subject: [PATCH 2/3] Remove unneccessary nested --- src/components/registration/registration.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index fd2942a5a1..1d8109e44c 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -24,11 +24,6 @@ const registration = { required, sameAsPassword: sameAs('password') } - }, - nested: { - required: requiredIf(function (nestedModel) { - return this.accountActivationRequired - }) } }, created () { From f7f8a579fa17102a994dc7bd7a4c7808e0964d55 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 4 May 2020 12:56:39 +0300 Subject: [PATCH 3/3] make email validation conditional work --- src/components/registration/registration.js | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index 1d8109e44c..dab06e1ee4 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -14,15 +14,17 @@ const registration = { }, captcha: {} }), - validations: { - user: { - email: requiredIf('accountActivationRequired'), - username: { required }, - fullname: { required }, - password: { required }, - confirm: { - required, - sameAsPassword: sameAs('password') + validations () { + return { + user: { + email: { required: requiredIf(() => this.accountActivationRequired) }, + username: { required }, + fullname: { required }, + password: { required }, + confirm: { + required, + sameAsPassword: sameAs('password') + } } } }, @@ -43,7 +45,8 @@ const registration = { signedIn: (state) => !!state.users.currentUser, isPending: (state) => state.users.signUpPending, serverValidationErrors: (state) => state.users.signUpErrors, - termsOfService: (state) => state.instance.tos + termsOfService: (state) => state.instance.tos, + accountActivationRequired: (state) => state.instance.accountActivationRequired }) }, methods: {