diff --git a/angular/app/components/reset-password/reset-password.component.html b/angular/app/components/reset-password/reset-password.component.html index 9543217..f1d24dc 100644 --- a/angular/app/components/reset-password/reset-password.component.html +++ b/angular/app/components/reset-password/reset-password.component.html @@ -1,4 +1,4 @@ -
+
@@ -7,19 +7,28 @@

{{alert.title}}

{{alert.msg}}

-
- +
+ + +

Password is required.

+

Password is too long.

+

Password is too short, Please enter more than 8 characters.

+

{{vm.errors.password}}

-
- +
+ -
+

Password confirmation is required.

+

Password confirmation does not match.

+

Password confirmation does not match.

+

Password confirmation is too long.

+

Password confirmation is too short, Please enter more than 8 characters.

+

{{vm.errors.password_confirmation}}

+
-
-
-
+
diff --git a/angular/app/components/reset-password/reset-password.component.js b/angular/app/components/reset-password/reset-password.component.js index 6eac56b..0980b26 100644 --- a/angular/app/components/reset-password/reset-password.component.js +++ b/angular/app/components/reset-password/reset-password.component.js @@ -11,6 +11,7 @@ class ResetPasswordController { this.password = '' this.password_confirmation = '' this.isValidToken = false + this.formSubmitted = false this.verifyToken() } @@ -27,26 +28,30 @@ class ResetPasswordController { }) } - submit () { - this.alerts = [] - let data = { - email: this.$state.params.email, - token: this.$state.params.token, - password: this.password, - password_confirmation: this.password_confirmation + submit (isValid) { + if(isValid) { + this.alerts = [] + let data = { + email: this.$state.params.email, + token: this.$state.params.token, + password: this.password, + password_confirmation: this.password_confirmation + } + + this.API.all('auth/password/reset').post(data).then(() => { + this.$state.go('login', {successMsg: `Your password has been changed, You may now login.`}) + }, (res) => { + let alrtArr = [] + + angular.forEach(res.data.errors, function (value) { + alrtArr = {type: 'error', 'title': 'Error!', msg: value[0]} + }) + + this.alerts.push(alrtArr) + }) + } else { + this.formSubmitted = true } - - this.API.all('auth/password/reset').post(data).then(() => { - this.$state.go('login', { successMsg: `Your password has been changed, You may now login.` }) - }, (res) => { - let alrtArr = [] - - angular.forEach(res.data.errors, function (value) { - alrtArr = { type: 'error', 'title': 'Error!', msg: value[0]} - }) - - this.alerts.push(alrtArr) - }) } } diff --git a/angular/app/pages/reset-password/reset-password.page.html b/angular/app/pages/reset-password/reset-password.page.html index 1b37921..9facbd7 100644 --- a/angular/app/pages/reset-password/reset-password.page.html +++ b/angular/app/pages/reset-password/reset-password.page.html @@ -3,7 +3,17 @@ AdminLTE