Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validations: {
email: {
required,
email: email
},
username: {
required,
minLength: minLength(2)
},
password: {
required,
minLength: minLength(8)
},
passwordConfirmation: {
required,
sameAsPassword: sameAs('password')
}
},
methods: {
validateBeforeSubmit() {
this.$v.$touch();
if (this.$v.$invalid) {
this.shake = true;
this.focusFirstFormControlWithError();
} else {
this.loading = true;
this.submit().finally(() => {
this.loading = false;
});
}
},
{
rule (value) {
const regexp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])\S{8,}$/
return regexp.test(value)
},
msg: 'Password requires at least 8 characters without spaces, one number, one lowercase and one uppercase letter'
}
]
export const confirmation = [
{
rule: required,
msg: 'Confirmation is required'
},
{
rule: sameAs('password'),
msg: 'Password mismatch'
}
]
export const bookTitle = [
{
rule: required,
msg: 'Book title is required'
}
]
export const author = [
{
rule: required,
msg: 'Author is required'
}
unicodeAlpha
},
email: {
required,
email
}
},
oldPassword: {
required
},
password: {
required
},
rPassword: {
required,
sameAsPassword: sameAs('password')
},
userCompany: {
company: {
required
},
country: {
required
},
street: {
required,
unicodeAlphaNum
},
house: {
required,
unicodeAlphaNum
},
email,
minLength,
maxLength,
sameAs
} from 'vuelidate/lib/validators'
import { mapState, mapActions } from 'vuex'
export default {
mixins: [validationMixin],
validations: {
name: { required, minLength: minLength(4), maxLength: maxLength(30) },
email: { required, email },
password: { required, minLength: minLength(5), maxLength: maxLength(100) },
select: { required },
group: { required },
password2: { required, sameAs: sameAs('password') }
},
data: () => ({
group: '',
name: '',
email: '',
password: '',
password2: '',
select: null,
items: ['Student', 'Teacher']
}),
computed: {
...mapState(['loading']),
selectErrors() {
const errors = []
required,
email
},
firstName: {
required
},
lastName: {
required
},
password: {
minLength: minLength(8),
required
},
rPassword: {
required,
sameAsPassword: sameAs('password')
},
conditions: {
required
}
},
mixins: [Register],
components: {
ButtonFull,
BaseCheckbox,
BaseInput
},
methods: {
register () {
if (this.$v.$invalid) {
this.$v.$touch()
this.$store.dispatch('notification/spawnNotification', {
validations: () => ({
fieldWarning: { required: sameAs(() => true) }
})
}
minLength: minLength(3)
},
lastName: {
required
},
emailAddress: {
required,
email
}
},
password: {
required
},
rPassword: {
required,
sameAsPassword: sameAs('password')
},
acceptConditions: {
required
}
}
}
required
},
email: {
required,
email
}
},
oldPassword: {
required
},
password: {
required
},
rPassword: {
required,
sameAsPassword: sameAs('password')
},
userCompany: {
company: {
required
},
country: {
required
},
street: {
required
},
house: {
required
},
postcode: {
required,
profileData: {
name: {
required,
minLength: minLength(3)
},
email: {
email,
required
},
password: {
required,
minLength: minLength(5)
},
confirm_password: {
required: requiredIf('isRequired'),
sameAsPassword: sameAs('password')
}
}
},
computed: {
isRequired () {
if (this.profileData.password === null || this.profileData.password === undefined || this.profileData.password === '') {
return false
}
return true
}
},
methods: {
...mapActions('userProfile', [
'uploadOnboardAvatar'
]),
cropperHandler (cropper) {