Browse Source

enforce promo code policy

pull/1/head
Jonathan Cobb 4 years ago
parent
commit
a3713776cb
2 changed files with 15 additions and 5 deletions
  1. +5
    -2
      src/_store/system.module.js
  2. +10
    -3
      src/auth/RegisterPage.vue

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

@@ -12,7 +12,8 @@ const state = {
entityClasses: [],
locales: ['en_US'],
cloudConfigs: {},
sslPort: null
sslPort: null,
promoCodePolicy: null
},
entityConfigs: {},
searchResults: [],
@@ -219,7 +220,9 @@ const getters = {
icon: messages.label_menu_logout_icon
});
return menu;
}
},
promoCodesEnabled: function () { return state.promoCodePolicy === 'required' || state.promoCodePolicy === 'optional'; },
promoCodeRequired: function () { return state.promoCodePolicy === 'required'; }
};

const mutations = {


+ 10
- 3
src/auth/RegisterPage.vue View File

@@ -14,9 +14,14 @@
</div>
<div class="form-group">
<label for="email">{{messages.field_label_email}}</label>
<input type="text" v-model="user.contact.info" name="email" class="form-control" :class="{ 'is-invalid': submitted && errors.has('email') }" />
<input type="text" v-model="user.contact.info" v-validate="'required'" name="email" class="form-control" :class="{ 'is-invalid': submitted && errors.has('email') }" />
<div v-if="submitted && errors.has('email')" class="invalid-feedback">{{ errors.first('email') }}</div>
</div>
<div class="form-group" v-if="promoCodesEnabled">
<label for="promoCode">{{messages.field_label_promoCode}}</label>
<input type="text" v-model="user.promoCode" v-validate="{required: promoCodeRequired}" name="promoCode" class="form-control" :class="{ 'is-invalid': submitted && errors.has('promoCode') }" />
<div v-if="submitted && errors.has('promoCode')" class="invalid-feedback">{{ errors.first('promoCode') }}</div>
</div>
<div class="form-group">
<label for="user.contact.receiveInformationalMessages">{{messages.field_label_receiveInformationalMessages}}</label>
<input type="checkbox" id="user.contact.receiveInformationalMessages" v-model="user.contact.receiveInformationalMessages">
@@ -35,7 +40,7 @@
</template>

<script>
import { mapState, mapActions } from 'vuex'
import { mapState, mapActions, mapGetters } from 'vuex'

export default {
data () {
@@ -48,7 +53,8 @@ export default {
info: '',
receiveInformationalMessages: false,
receivePromotionalMessages: false
}
},
promoCode: null
},
submitted: false
}
@@ -59,6 +65,7 @@ export default {
},
methods: {
...mapActions('account', ['register']),
...mapGetters('system', ['promoCodesEnabled', 'promoCodeRequired']),
handleSubmit(e) {
this.submitted = true;
this.$validator.validate().then(valid => {


Loading…
Cancel
Save