mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Added password confirmation when deleteing account (#7402)
This commit is contained in:
committed by
Matteo Pagliazzi
parent
e3c79fbdfa
commit
1a19c9d2a6
@@ -177,13 +177,16 @@ habitrpg.controller('SettingsCtrl',
|
|||||||
$rootScope.$state.go('tasks');
|
$rootScope.$state.go('tasks');
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope['delete'] = function(){
|
$scope['delete'] = function(password) {
|
||||||
$http['delete'](ApiUrl.get() + '/api/v3/user')
|
$http({
|
||||||
.success(function(res, code){
|
url: ApiUrl.get() + '/api/v3/user',
|
||||||
if (res.err) return alert(res.err);
|
method: 'DELETE',
|
||||||
localStorage.clear();
|
data: {password: password},
|
||||||
window.location.href = '/logout';
|
})
|
||||||
});
|
.then(function(res, code) {
|
||||||
|
localStorage.clear();
|
||||||
|
window.location.href = '/logout';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.enterCoupon = function(code) {
|
$scope.enterCoupon = function(code) {
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ script(type='text/ng-template', id='modals/delete.html')
|
|||||||
.modal-header
|
.modal-header
|
||||||
h4=env.t('deleteAccount')
|
h4=env.t('deleteAccount')
|
||||||
.modal-body
|
.modal-body
|
||||||
p!=env.t('deleteText', {deleteWord: 'DELETE'})
|
p!=env.t('deleteText', {deleteWord: 'Your password'})
|
||||||
br
|
br
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
input.form-control(type='text', ng-model='_deleteAccount')
|
input.form-control(type='password', ng-model='_deleteAccount')
|
||||||
.modal-footer
|
.modal-footer
|
||||||
button.btn.btn-default(ng-click='$close()')=env.t('neverMind')
|
button.btn.btn-default(ng-click='$close()')=env.t('neverMind')
|
||||||
button.btn.btn-danger(ng-disabled='_deleteAccount != "DELETE"', ng-click='$close(); delete()')=env.t('deleteDo')
|
button.btn.btn-danger(ng-disabled='!_deleteAccount', ng-click='$close(); delete(_deleteAccount)')=env.t('deleteDo')
|
||||||
|
|||||||
Reference in New Issue
Block a user