Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Client-side Validation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
enkodellc committed Jun 6, 2014
1 parent fa00fe9 commit 725cc4c
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$http
//If user is signed in then redirect back home
if ($scope.authentication.user) $location.path('/');

$scope.signup = function() {
$http.post('/auth/signup', $scope.credentials).success(function(response) {
//If successful we assign the response to the global user model
$scope.authentication.user = response;

//And redirect to the index page
$location.path('/');
}).error(function(response) {
$scope.error = response.message;
});
$scope.signup = function(isValid) {
if (isValid){
$http.post('/auth/signup', $scope.credentials).success(function(response) {
//If successful we assign the response to the global user model
$scope.authentication.user = response;

//And redirect to the index page
$location.path('/');
}).error(function(response) {
$scope.error = response.message;
});
} else {
$scope.submitted = true;
}
};

$scope.signin = function() {
Expand All @@ -31,4 +35,4 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$http
});
};
}
]);
]);

0 comments on commit 725cc4c

Please sign in to comment.