Skip to content

Commit

Permalink
Fixed user setting issue
Browse files Browse the repository at this point in the history
Bugzilla: 1654623
tendrl-github-id: Tendrl#1091
  • Loading branch information
gnehapk committed Dec 6, 2018
1 parent 34100fb commit 75bc626
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/modules/base/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
vm.userScope.formSubmitInProgress = true;
if (_validateUIFields()) {
vm.userScope.user.notification = vm.userScope.user.email_notifications;

//this gets checked when user has entered password and then deleted
if (!vm.userScope.user.password.length) {
delete vm.userScope.user.password;
}

userStore.editUser(vm.userScope.user)
.then(function(data) {
vm.showUserSetting = false;
Expand Down Expand Up @@ -128,8 +134,6 @@
.then(function(data) {
vm.userScope.isDataLoading = false;
vm.userScope.user = data;
vm.userScope.user["password"] = "";
vm.userScope.user["confirmPassword"] = "";
});
}

Expand Down Expand Up @@ -158,9 +162,6 @@
//vm.userScope.errorMsg = "Password and Confirm Password doesn't match.";
isFormValid = false;
Notifications.message("danger", "", "Your password and confirmation password do not match. Go to My Settings to reset your password.");
} else if (form.password.$invalid) {
vm.userScope.errorMsg = "Password should be 8 characters minimum";
isFormValid = false;
} else if (form.email.$invalid) {
vm.userScope.errorMsg = "Please enter Email id.";
isFormValid = false;
Expand All @@ -170,7 +171,16 @@
}

function _isPasswordSame() {
if (vm.userScope.user.password == vm.userScope.user.confirmPassword) {

if (typeof vm.userScope.user.password === "undefined") {
vm.userScope.user.password = "";
}

if (typeof vm.userScope.user.confirmPassword === "undefined") {
vm.userScope.user.confirmPassword = "";
}

if (vm.userScope.user.password === vm.userScope.user.confirmPassword) {
return true;
} else {
return false;
Expand Down

0 comments on commit 75bc626

Please sign in to comment.