Merge branch 'fix-issue' into 'master'

fix small issues

See merge request mohit.panjvani/crater-web!12
This commit is contained in:
Mohit Panjwani
2019-11-13 08:35:26 +00:00
6 changed files with 35 additions and 15 deletions

View File

@ -753,6 +753,7 @@ export default {
invalid_url: 'Invalid url (ex: http://www.crater.com)',
required: 'Field is required',
email_incorrect: 'Incorrect Email.',
email_already_taken: 'The email has already been taken.',
email_does_not_exist: "User with given email doesn't exist",
send_reset_link: 'Send Reset Link',
not_yet: 'Not yet? Send it again',

View File

@ -12,10 +12,15 @@
focus
type="email"
name="email"
@input="$v.loginData.email.$touch()"
/>
<div v-if="$v.loginData.email.$error">
<span v-if="!$v.loginData.email.required" class="text-danger">{{ $tc('validation.required') }}</span>
<span v-if="!$v.loginData.email.email" class="text-danger"> {{ $tc('validation.email_incorrect') }} </span>
<span v-if="!$v.loginData.email.required" class="text-danger">
{{ $tc('validation.required') }}
</span>
<span v-if="!$v.loginData.email.email" class="text-danger">
{{ $tc('validation.email_incorrect') }}
</span>
</div>
</div>
<div class="form-group">
@ -25,8 +30,10 @@
:invalid="$v.loginData.password.$error"
type="password"
name="password"
show-password
@input="$v.loginData.password.$touch()"
/>
<div v-if="$v.loginData.email.$error">
<div v-if="$v.loginData.password.$error">
<span v-if="!$v.loginData.password.required" class="text-danger">{{ $tc('validation.required') }}</span>
<span v-if="!$v.loginData.password.minLength" class="text-danger"> {{ $tc('validation.password_min_length', $v.loginData.password.$params.minLength.min, {count: $v.loginData.password.$params.minLength.min}) }} </span>
</div>

View File

@ -624,17 +624,20 @@ export default {
this.isLoading = true
this.formData.currency_id = this.currency.id
}
let response = await this.addCustomer(this.formData)
if (response.data.success) {
window.toastr['success'](this.$t('customers.created_message'))
this.$router.push('/admin/customers')
this.isLoading = false
return true
try {
let response = await this.addCustomer(this.formData)
if (response.data.success) {
window.toastr['success'](this.$t('customers.created_message'))
this.$router.push('/admin/customers')
this.isLoading = false
return true
}
} catch (err) {
if (err.response.data.errors.email) {
this.isLoading = false
window.toastr['error'](this.$t('validation.email_already_taken'))
}
}
window.toastr['error'](response.data.error)
}
},
async fetchBillingState () {

View File

@ -43,6 +43,9 @@
type="password"
@input="$v.formData.password.$touch()"
/>
<div v-if="$v.formData.password.$error">
<span v-if="!$v.formData.password.minLength" class="text-danger"> {{ $tc('validation.password_min_length', $v.formData.password.$params.minLength.min, {count: $v.formData.password.$params.minLength.min}) }} </span>
</div>
</div>
<div class="col-md-6 mb-4 form-group">
<label class="input-label">{{ $tc('settings.account_settings.confirm_password') }}</label>
@ -78,7 +81,7 @@
<script>
import { validationMixin } from 'vuelidate'
import { mapActions } from 'vuex'
const { required, requiredIf, sameAs, email } = require('vuelidate/lib/validators')
const { required, requiredIf, sameAs, email, minLength } = require('vuelidate/lib/validators')
export default {
mixins: [validationMixin],
@ -103,6 +106,7 @@ export default {
email
},
password: {
minLength: minLength(8)
},
confirm_password: {
required: requiredIf('isRequired'),

View File

@ -45,6 +45,7 @@
/>
<div v-if="$v.profileData.password.$error">
<span v-if="!$v.profileData.password.required" class="text-danger">{{ $tc('validation.required') }}</span>
<span v-if="!$v.profileData.password.minLength" class="text-danger"> {{ $tc('validation.password_min_length', $v.profileData.password.$params.minLength.min, {count: $v.profileData.password.$params.minLength.min}) }} </span>
</div>
</div>
<div class="col-md-6">
@ -106,7 +107,8 @@ export default {
required
},
password: {
required
required,
minLength: minLength(8)
},
confirm_password: {
required: requiredIf('isRequired'),