diff --git a/public/application.js b/public/application.js
index fac86e70..d006c152 100755
--- a/public/application.js
+++ b/public/application.js
@@ -36,7 +36,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
console.log('toState: '+toState.name);
//Redirect to listForms if user is authenticated
- if(toState.name === 'home' || toState.name === 'signin' || toState.name === 'resendVerifyEmail' || toState.name === 'verify' || toState.name === 'signup' || toState.name === 'signup-success'){
+ if(toState.name === 'home' || toState.name === 'signin' || toState.name === 'resendVerifyEmail' || toState.name === 'verify' || toState.name === 'signup' || toState.name === 'signup-success' || toState.name.slice(0,5) === 'reset' || toState.name === 'forgot'){
if(Auth.isAuthenticated()){
event.preventDefault(); // stop current execution
$state.go('listForms'); // go to listForms page
diff --git a/public/modules/users/controllers/password.client.controller.js b/public/modules/users/controllers/password.client.controller.js
index a8382270..83b11399 100755
--- a/public/modules/users/controllers/password.client.controller.js
+++ b/public/modules/users/controllers/password.client.controller.js
@@ -23,6 +23,7 @@ angular.module('users').controller('PasswordController', ['$scope', '$stateParam
$scope.success = $scope.error = null;
User.resetPassword($scope.passwordDetails, $stateParams.token).then(
function(response){
+ console.log(response);
// If successful show success message and clear form
$scope.success = response.message;
$scope.passwordDetails = null;
@@ -31,6 +32,7 @@ angular.module('users').controller('PasswordController', ['$scope', '$stateParam
$state.go('reset-success');
},
function(error){
+ console.error(error);
$scope.error = error.message || error;
$scope.passwordDetails = null;
}
diff --git a/public/modules/users/services/user.client.service.js b/public/modules/users/services/user.client.service.js
index c694544a..4a700d4f 100644
--- a/public/modules/users/services/user.client.service.js
+++ b/public/modules/users/services/user.client.service.js
@@ -81,11 +81,23 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
return deferred.promise;
},
+ validateResetToken: function(token) {
+
+ var deferred = $q.defer();
+ $http.get('/auth/password/'+token).success(function(response) {
+ deferred.resolve(response);
+ }).error(function(error) {
+ deferred.reject(error.message || error);
+ });
+
+ return deferred.promise;
+ },
+
resetPassword: function(passwordDetails, token) {
var deferred = $q.defer();
- $http.get('/auth/password/'+token, passwordDetails).success(function(response) {
- deferred.resolve();
+ $http.post('/auth/password/'+token, passwordDetails).success(function(response) {
+ deferred.resolve(response);
}).error(function(error) {
deferred.reject(error.message || error);
});
diff --git a/public/modules/users/views/authentication/signin.client.view.html b/public/modules/users/views/authentication/signin.client.view.html
index 8b3b56db..dfacf313 100755
--- a/public/modules/users/views/authentication/signin.client.view.html
+++ b/public/modules/users/views/authentication/signin.client.view.html
@@ -26,7 +26,7 @@