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,10 +177,13 @@ 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);
|
||||
$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';
|
||||
});
|
||||
|
||||
@@ -55,11 +55,11 @@ script(type='text/ng-template', id='modals/delete.html')
|
||||
.modal-header
|
||||
h4=env.t('deleteAccount')
|
||||
.modal-body
|
||||
p!=env.t('deleteText', {deleteWord: 'DELETE'})
|
||||
p!=env.t('deleteText', {deleteWord: 'Your password'})
|
||||
br
|
||||
.row
|
||||
.col-md-6
|
||||
input.form-control(type='text', ng-model='_deleteAccount')
|
||||
input.form-control(type='password', ng-model='_deleteAccount')
|
||||
.modal-footer
|
||||
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