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

Commit 725cc4c

Browse files
committed
Client-side Validation updates
1 parent fa00fe9 commit 725cc4c

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

public/modules/users/controllers/authentication.client.controller.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$http
77
//If user is signed in then redirect back home
88
if ($scope.authentication.user) $location.path('/');
99

10-
$scope.signup = function() {
11-
$http.post('/auth/signup', $scope.credentials).success(function(response) {
12-
//If successful we assign the response to the global user model
13-
$scope.authentication.user = response;
14-
15-
//And redirect to the index page
16-
$location.path('/');
17-
}).error(function(response) {
18-
$scope.error = response.message;
19-
});
10+
$scope.signup = function(isValid) {
11+
if (isValid){
12+
$http.post('/auth/signup', $scope.credentials).success(function(response) {
13+
//If successful we assign the response to the global user model
14+
$scope.authentication.user = response;
15+
16+
//And redirect to the index page
17+
$location.path('/');
18+
}).error(function(response) {
19+
$scope.error = response.message;
20+
});
21+
} else {
22+
$scope.submitted = true;
23+
}
2024
};
2125

2226
$scope.signin = function() {
@@ -31,4 +35,4 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$http
3135
});
3236
};
3337
}
34-
]);
38+
]);

0 commit comments

Comments
 (0)