Allow setting email to nothing.

Previously, once an email is added to an account, it was not possible to
remove it. Now an empty email address is accepted.
This commit is contained in:
Matthew Ross 2015-11-08 16:12:32 -05:00
parent 27ca92f2fd
commit 252de39ac0

View File

@ -135,20 +135,15 @@ function ($scope, $interval, UserService) {
$scope.changeEmail = function(newEmailFormData) {
$scope.emailFormData.isSaving = true;
if (newEmailFormData.newEmail === '') {
newEmailFormData.setAlert('Email cannot be blank.');
newEmailFormData.isSaving = false;
} else {
UserService.changeEmail(newEmailFormData.newEmail)
.success(function(data) {
$scope.alerts.showAlerts(data.alerts);
$scope.updateUsers(data.data);
$scope.loadCurrentUser();
UserService.changeEmail(newEmailFormData.newEmail)
.success(function(data) {
$scope.alerts.showAlerts(data.alerts);
$scope.updateUsers(data.data);
$scope.loadCurrentUser();
newEmailFormData.isSaving = false;
newEmailFormData.newUsername = '';
});
}
newEmailFormData.isSaving = false;
newEmailFormData.newUsername = '';
});
};
$scope.updatingDefaultBoard = false;