Added password confirmation when deleteing account (#7402)

This commit is contained in:
Keith Holliday
2016-05-22 02:55:52 +01:00
committed by Matteo Pagliazzi
parent e3c79fbdfa
commit 1a19c9d2a6
2 changed files with 13 additions and 10 deletions

View File

@@ -177,13 +177,16 @@ habitrpg.controller('SettingsCtrl',
$rootScope.$state.go('tasks');
}
$scope['delete'] = function(){
$http['delete'](ApiUrl.get() + '/api/v3/user')
.success(function(res, code){
if (res.err) return alert(res.err);
localStorage.clear();
window.location.href = '/logout';
});
$scope['delete'] = function(password) {
$http({
url: ApiUrl.get() + '/api/v3/user',
method: 'DELETE',
data: {password: password},
})
.then(function(res, code) {
localStorage.clear();
window.location.href = '/logout';
});
}
$scope.enterCoupon = function(code) {