-
-
-
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