Browse Source

feat: prevent registration when the configs.allowRegistration is set to false

pull/27/head
Tyler Chen 4 years ago
parent
commit
711d3ef987
7 changed files with 86 additions and 54 deletions
  1. +7
    -3
      src/_components/layout/Header.vue
  2. +58
    -0
      src/_components/sections/Features.vue
  3. +1
    -0
      src/_components/sections/index.js
  4. +1
    -1
      src/_pages/auth/ForgotPassword.vue
  5. +2
    -7
      src/_pages/auth/Login.vue
  6. +11
    -41
      src/_pages/auth/Register.vue
  7. +6
    -2
      src/_store/system.module.js

+ 7
- 3
src/_components/layout/Header.vue View File

@@ -11,7 +11,11 @@
{{ messages.button_label_help }}
</Button>
</router-link>
<router-link to="/register" class="d-flex align-items-center">
<router-link
v-if="configs.allowRegistration === true"
to="/register"
class="d-flex align-items-center"
>
<Button link>
{{ messages.button_label_sign_up }}
</Button>
@@ -74,7 +78,7 @@
<script>
import ClickOutside from 'vue-click-outside';

import { mapState } from 'vuex';
import { mapState, mapGetters } from 'vuex';
import { Button } from '~/_components/shared';

export default {
@@ -92,7 +96,7 @@ export default {
},

computed: {
...mapState('system', ['messages']),
...mapState('system', ['messages', 'configs']),
},

methods: {


+ 58
- 0
src/_components/sections/Features.vue View File

@@ -0,0 +1,58 @@
<template>
<div>
<!--- We've Got You Covered Section --->
<h2 class="covered-section-title text-center">
{{ messages.marketing_message_got_you_covered_title }}
</h2>
<div class="row" v-if="messages && messages.marketing_message_topics">
<div
v-for="(item, index) in messages.marketing_message_topics.split(',')"
:key="index"
class="col-lg-3 col-md-6 col-sm-12 my-4 px-3"
>
<Card>
<div class="card-content">
<span
class="card-icon"
:style="{
color: messages[`marketing_message_${item}_color`],
backgroundColor:
messages[`marketing_message_${item}_background_color`],
}"
v-html="messages[`marketing_message_${item}_icon`]"
>
</span>
<p class="card-title">
{{ messages[`marketing_message_${item}_title`] }}
</p>
<span class="card-message">
{{ messages[`marketing_message_${item}_content`] }}
</span>
</div>
</Card>
</div>
</div>
</div>
</template>

<style lang="scss" scoped>
.covered-section-title {
margin-top: 64px;
margin-bottom: 20px;
color: #3c3c3c;
}
</style>

<script>
import { mapState } from 'vuex';
import { Card } from '../shared';

export default {
components: {
Card,
},
computed: {
...mapState('system', ['messages']),
},
};
</script>

+ 1
- 0
src/_components/sections/index.js View File

@@ -0,0 +1 @@
export { default as Features } from './Features';

+ 1
- 1
src/_pages/auth/ForgotPassword.vue View File

@@ -36,7 +36,7 @@
{{ messages.button_label_forgot_password }}
</Button>
<p class="text-center mt-3">
<router-link to="/sign-in">
<router-link to="/login">
{{ messages.forgot_password_login_link }}
</router-link>
</p>


+ 2
- 7
src/_pages/auth/Login.vue View File

@@ -143,9 +143,9 @@
v-html="messages.message_login_agreeToTerms"
></p>
</form>
<p class="text-center mt-4">
<p class="text-center mt-4" v-if="configs.allowRegistration === true">
{{ messages.registration_label }}
<router-link to="/sign-up">
<router-link to="/register">
{{ messages.button_label_sign_up }}
</router-link>
</p>
@@ -191,10 +191,6 @@ export default {
};
},

created() {
this.loadSystemConfigs();
},

computed: {
...mapState('account', [
'status',
@@ -241,7 +237,6 @@ export default {

methods: {
...mapActions('account', ['login', 'logout']),
...mapActions('system', ['loadSystemConfigs']),

submit() {
this.errors.clear();


+ 11
- 41
src/_pages/auth/Register.vue View File

@@ -147,38 +147,7 @@
</div>
</form>

<!--- We've Got You Covered Section --->
<h2 class="covered-section-title text-center">
{{ messages.marketing_message_got_you_covered_title }}
</h2>
<div class="row" v-if="messages && messages.marketing_message_topics">
<div
v-for="(item, index) in messages.marketing_message_topics.split(',')"
:key="index"
class="col-lg-3 col-md-6 col-sm-12 my-4 px-3"
>
<Card>
<div class="card-content">
<span
class="card-icon"
:style="{
color: messages[`marketing_message_${item}_color`],
backgroundColor:
messages[`marketing_message_${item}_background_color`],
}"
v-html="messages[`marketing_message_${item}_icon`]"
>
</span>
<p class="card-title">
{{ messages[`marketing_message_${item}_title`] }}
</p>
<span class="card-message">
{{ messages[`marketing_message_${item}_content`] }}
</span>
</div>
</Card>
</div>
</div>
<Features></Features>

<!--- Pricing Section --->
<a
@@ -230,12 +199,6 @@
<style lang="scss" scoped>
@import '../../_scss/components/form';

.covered-section-title {
margin-top: 64px;
margin-bottom: 20px;
color: #3c3c3c;
}

.pricing-section-link {
color: $vivid-navy;
font-size: 36px;
@@ -249,14 +212,16 @@ import { validationMixin } from 'vuelidate';
import { required, email, minLength, sameAs } from 'vuelidate/lib/validators';

import { util } from '~/_helpers';
import { Button, Input, Checkbox, Card } from '~/_components/shared';
import { Button, Input, Checkbox } from '~/_components/shared';
import { Features } from '~/_components/sections';

export default {
components: {
Button,
Input,
Checkbox,
Card,

Features,
},

mixins: [validationMixin],
@@ -292,7 +257,7 @@ export default {

computed: {
...mapState('account', ['status']),
...mapState('system', ['messages', 'countries']),
...mapState('system', ['messages', 'countries', 'configs']),
...mapState('plans', ['plans', 'plan']),
...mapState('paymentMethods', [
'paymentMethods',
@@ -416,6 +381,11 @@ export default {
this.user.preferredPlan = p.uuid;
}
},
configs(configs) {
if (configs.allowRegistration === false) {
this.$route.replace('/login');
}
},
},
};
</script>

+ 6
- 2
src/_store/system.module.js View File

@@ -31,7 +31,8 @@ const state = {
securityLevels: null,
jarVersion: null,
jarUpgradeAvailable: null,
maxUsers: null
maxUsers: null,
loaded: false,
},
entityConfigs: {},
searchResults: [],
@@ -336,6 +337,9 @@ const getters = {
promoCodeRequired: function() {
return state.promoCodePolicy === 'required';
},
configs: function () {
return state.configs.loaded === true ? state.configs : {};
}
};

const mutations = {
@@ -364,7 +368,7 @@ const mutations = {

loadSystemConfigsRequest(state) {},
loadSystemConfigsSuccess(state, configs) {
state.configs = configs;
state.configs = {...configs, loaded: true};
},
loadSystemConfigsFailure(state, error) {
state.error = error;


Loading…
Cancel
Save