diff --git a/contentcuration/contentcuration/frontend/accounts/pages/__tests__/resetPassword.spec.js b/contentcuration/contentcuration/frontend/accounts/pages/__tests__/resetPassword.spec.js
index 7980086963..6d6e9a2451 100644
--- a/contentcuration/contentcuration/frontend/accounts/pages/__tests__/resetPassword.spec.js
+++ b/contentcuration/contentcuration/frontend/accounts/pages/__tests__/resetPassword.spec.js
@@ -39,8 +39,10 @@ describe('resetPassword', () => {
});
it('should call setPassword on submit if password data is valid', () => {
wrapper.setData({ new_password1: 'pass', new_password2: 'pass' });
- wrapper.find({ ref: 'form' }).trigger('submit');
- expect(setPassword).toHaveBeenCalled();
+ wrapper.vm.$nextTick(() => {
+ wrapper.find({ ref: 'form' }).trigger('submit');
+ expect(setPassword).toHaveBeenCalled();
+ });
});
it('should retain data from query params so reset credentials are preserved', () => {
router.replace({
@@ -50,7 +52,9 @@ describe('resetPassword', () => {
},
});
wrapper.setData({ new_password1: 'pass', new_password2: 'pass' });
- wrapper.find({ ref: 'form' }).trigger('submit');
- expect(setPassword.mock.calls[0][0].test).toBe('testing');
+ wrapper.vm.$nextTick(() => {
+ wrapper.find({ ref: 'form' }).trigger('submit');
+ expect(setPassword.mock.calls[0][0].test).toBe('testing');
+ });
});
});
diff --git a/contentcuration/contentcuration/frontend/accounts/pages/resetPassword/ResetPassword.vue b/contentcuration/contentcuration/frontend/accounts/pages/resetPassword/ResetPassword.vue
index 2fd3ceddd3..65e69270c9 100644
--- a/contentcuration/contentcuration/frontend/accounts/pages/resetPassword/ResetPassword.vue
+++ b/contentcuration/contentcuration/frontend/accounts/pages/resetPassword/ResetPassword.vue
@@ -9,6 +9,7 @@
(this.new_password1 === value ? true : this.$tr('passwordMatchMessage'))];
},
+ passwordValidationRules() {
+ return [value => (value.length >= 8 ? true : this.$tr('passwordValidationMessage'))];
+ },
},
methods: {
...mapActions('account', ['setPassword']),
@@ -80,6 +84,7 @@
resetPasswordPrompt: 'Enter and confirm your new password',
passwordLabel: 'New password',
passwordConfirmLabel: 'Confirm password',
+ passwordValidationMessage: 'Password should be at least 8 characters long',
passwordMatchMessage: "Passwords don't match",
submitButton: 'Submit',
resetPasswordFailed: 'Failed to reset password. Please try again.',
diff --git a/contentcuration/contentcuration/frontend/settings/pages/Account/ChangePasswordForm.vue b/contentcuration/contentcuration/frontend/settings/pages/Account/ChangePasswordForm.vue
index 82ed1bcadb..8394fb4e2c 100644
--- a/contentcuration/contentcuration/frontend/settings/pages/Account/ChangePasswordForm.vue
+++ b/contentcuration/contentcuration/frontend/settings/pages/Account/ChangePasswordForm.vue
@@ -8,9 +8,11 @@
@submit="submitPassword"
@cancel="dialog = false"
>
-
+
+
(value.length >= 8 ? true : this.$tr('passwordValidationMessage'))];
+ },
passwordConfirmRules() {
return [value => (this.password === value ? true : this.$tr('formInvalidText'))];
},
@@ -86,6 +91,7 @@
newPasswordLabel: 'New password',
confirmNewPasswordLabel: 'Confirm new password',
formInvalidText: "Passwords don't match",
+ passwordValidationMessage: 'Password should be at least 8 characters long',
cancelAction: 'Cancel',
saveChangesAction: 'Save changes',
paswordChangeSuccess: 'Password updated',