Merge pull request #3925 from ebiagogo/develop

Fixed bug #3007 where using wrong "old password" when changing password ...
This commit is contained in:
Tyler Renelle 2014-08-26 14:00:18 -06:00
commit 96532ed6bd
3 changed files with 15 additions and 10 deletions

View file

@ -234,8 +234,12 @@ window.habitrpg = angular.module('habitrpg',
window.location.href = '/logout';
// 400 range?
} else if (response < 500) {
} else if (response.status < 500) {
$rootScope.$broadcast('responseText', response.data.err || response.data);
// Need to reject the prompse so the error is handled correctly
if (response.status === 401) {
return $q.reject(response);
}
// Error
} else {

View file

@ -124,8 +124,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
$scope.$apply(function(){
$http.post(url, data).success(function() {
window.location.reload(true);
}).error(function(err) {
alert(err);
}).error(function(data) {
alert(data.err);
});
})
}
@ -144,8 +144,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
$scope.$apply(function(){
$http.post(url, data).success(function() {
window.location.reload(true);
}).error(function(err) {
alert(err);
}).error(function(data) {
alert(data.err);
});
})
}

View file

@ -23,7 +23,7 @@ habitrpg.controller('SettingsCtrl',
window.location.reload();
});
}
}
}
$scope.toggleStickyHeader = function(){
$rootScope.$on('userSynced', function(){
@ -85,7 +85,7 @@ habitrpg.controller('SettingsCtrl',
$scope.changeUser = {};
})
.error(function(data){
alert(data);
alert(data.err);
});
}
@ -94,12 +94,13 @@ habitrpg.controller('SettingsCtrl',
return alert(window.env.t('fillAll'));
}
$http.post(API_URL + '/api/v2/user/change-password', changePass)
.success(function(){
.success(function(data, status, headers, config){
if (data.err) return alert(data.err);
alert(window.env.t('passSuccess'));
$scope.changePass = {};
})
.error(function(data){
alert(data);
.error(function(data, status, headers, config){
alert(data.err);
});
}