mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.4 KiB
85 lines
2.4 KiB
3 years ago
|
import { validatePassword } from 'nocodb-sdk'
|
||
|
|
||
3 years ago
|
export default {
|
||
|
data: () => ({
|
||
|
passwordProgress: 0,
|
||
|
passwordValidateMsg: '',
|
||
|
formUtil: {
|
||
|
formErr: false,
|
||
|
formErrMsg: '',
|
||
|
valid: false,
|
||
|
valid1: false,
|
||
|
recpatcha: true,
|
||
|
e3: true,
|
||
|
e4: true,
|
||
|
passwordProgress: 0,
|
||
|
progressColorValue: 'red'
|
||
|
}
|
||
|
}),
|
||
|
methods: {
|
||
|
progressColor(num) {
|
||
|
this.formUtil.progressColorValue = ['error', 'warning', 'info', 'success'][Math.floor(num / 25)]
|
||
|
return this.formUtil.progressColorValue
|
||
|
},
|
||
|
PasswordValidate(p) {
|
||
3 years ago
|
const { error, progress, valid } = validatePassword(p)
|
||
|
if (valid) { return true }
|
||
3 years ago
|
|
||
|
this.formUtil.passwordProgress = progress
|
||
|
this.progressColorValue = this.progressColor(this.formUtil.passwordProgress)
|
||
|
|
||
3 years ago
|
this.formUtil.passwordValidateMsg = error
|
||
|
return error
|
||
|
// if (!p) {
|
||
|
// this.passwordProgress = 0
|
||
|
// this.passwordValidateMsg = 'At least 8 letters with one Uppercase, one number and one special letter'
|
||
|
// return false
|
||
|
// }
|
||
|
//
|
||
|
// let msg = ''
|
||
|
// let validation = true
|
||
|
// let progress = 0
|
||
|
//
|
||
|
// if (!(p.length >= 8)) {
|
||
|
// msg += 'Atleast 8 letters. '
|
||
|
// validation = validation && false
|
||
|
// } else {
|
||
|
// progress = Math.min(100, progress + 25)
|
||
|
// }
|
||
|
//
|
||
|
// if (!(p.match(/.*[A-Z].*/))) {
|
||
|
// msg += 'One Uppercase Letter. '
|
||
|
// validation = validation && false
|
||
|
// } else {
|
||
|
// progress = Math.min(100, progress + 25)
|
||
|
// }
|
||
|
//
|
||
|
// if (!(p.match(/.*[0-9].*/))) {
|
||
|
// msg += 'One Number. '
|
||
|
// validation = validation && false
|
||
|
// } else {
|
||
|
// progress = Math.min(100, progress + 25)
|
||
|
// }
|
||
|
//
|
||
|
// if (!(p.match(/[$&+,:;=?@#|'<>.^*()%!_-]/))) {
|
||
|
// msg += 'One special letter. '
|
||
|
// validation = validation && false
|
||
|
// } else {
|
||
|
// progress = Math.min(100, progress + 25)
|
||
|
// }
|
||
|
//
|
||
|
// this.formUtil.passwordProgress = progress
|
||
|
// // console.log('progress', progress);
|
||
|
// // console.log('color', this.progressColor(this.formUtil.passwordProgress));
|
||
|
// this.progressColorValue = this.progressColor(this.formUtil.passwordProgress)
|
||
|
//
|
||
|
// this.formUtil.passwordValidateMsg = msg
|
||
|
//
|
||
|
// // console.log('msg', msg, validation);
|
||
|
//
|
||
|
// return validation
|
||
3 years ago
|
}
|
||
|
|
||
|
}
|
||
|
}
|