Add password validation checks back to UI#136
Conversation
…-password-validation-checks-back-to-UI
| </v-container> | ||
| </v-main> | ||
| <v-card-actions class="pa-4 justify-end"> | ||
| <v-btn type="submit" variant="elevated" color="primary"> |
There was a problem hiding this comment.
Small suggestion:
I feel we are doing unnecessary loop here, using submit button and submit handler on the form. then blocking submission to validate. instead,
let's remove the submit handler and use a normal button
<v-btn @click="validateAndSave" color="primary" variant="elevated">Save</v-btn>
then
async validateAndSave() {
const { valid, errors } = await this.$refs.form.validate();
if (valid) {
this.save();
} else {
this.showSnack("Please review the form for errors.");
scrollToFirstError(errors);
}
}
I think this is more vue friendly and simpler.
| const {createApp} = Vue; | ||
| const {createVuetify} = Vuetify; | ||
| <script> | ||
| const { createApp, ref } = Vue; |
There was a problem hiding this comment.
don't think we need/use ref anywhere
There was a problem hiding this comment.
Right it was imported by mistake, fixed
…-password-validation-checks-back-to-UI
level09
left a comment
There was a problem hiding this comment.
The Button is still using type=submit but we can improve this later
|
@level09 i did a refactor on |
| isStrongPassword: false, | ||
| form: { | ||
| password: null, | ||
| new_password: null, |
There was a problem hiding this comment.
I suggest using '' empty strings rather than null
Null can cause a lot of unexpected scenarios :
// This could throw "Cannot read property 'length' of null"
if (this.form.password.length > 0) { ... }
// Validation rules that expect strings
validationRules.minLength(10)(null) // Could fail unexpectedly
// JSON.stringify behavior differs
JSON.stringify({ password: null }) // {"password":null}
JSON.stringify({ password: "" }) // {"password":""}
also type checking etc etc .. Let's just use empty strings :)
c67b589
into
bynt-1387-enforce-password-policies
Jira Issue
Description
Add password validations checks to change_password.html and users.html
Checklist
API Changes (if applicable)
Additional Notes
[Any other relevant information]