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 725cc4c commit cfb0e1b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions public/modules/users/controllers/settings.client.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ angular.module('users').controller('SettingsController', ['$scope', '$http', '$l
};

// Update a user profile
$scope.updateUserProfile = function() {
$scope.success = $scope.error = null;
var user = new Users($scope.user);

user.$update(function(response) {
$scope.success = true;
Authentication.user = response;
}, function(response) {
$scope.error = response.data.message;
});
$scope.updateUserProfile = function(isValid) {
if (isValid){
$scope.success = $scope.error = null;
var user = new Users($scope.user);

user.$update(function(response) {
$scope.success = true;
Authentication.user = response;
}, function(response) {
$scope.error = response.data.message;
});
} else {
$scope.submitted = true;
}
};

// Change user password
Expand All @@ -64,4 +68,4 @@ angular.module('users').controller('SettingsController', ['$scope', '$http', '$l
});
};
}
]);
]);

0 comments on commit cfb0e1b

Please sign in to comment.