Add enabling/disabling account deletion

This commit is contained in:
osaajani 2020-06-24 18:55:03 +02:00
parent 6216ff63bb
commit 2f26f0a7cd
3 changed files with 28 additions and 18 deletions

View File

@ -156,6 +156,13 @@ namespace controllers\publics;
*/
public function delete($csrf)
{
if (!ENABLE_ACCOUNT_DELETION)
{
\FlashMessage\FlashMessage::push('danger', 'Fonctionnalité désactivée.');
return $this->redirect(\descartes\Router::url('Account', 'show'));
}
if (!$this->verify_csrf($csrf))
{
\FlashMessage\FlashMessage::push('danger', 'Jeton CSRF invalid !');

View File

@ -20,6 +20,7 @@
'PWD_PID' => '/var/run/raspisms',
'APP_SECRET' => '%APP_SECRET%',
'ENABLE_COMMAND' => false,
'ENABLE_ACCOUNT_DELETION' => true,
//E-mail types
'EMAIL_RESET_PASSWORD' => [

View File

@ -60,24 +60,26 @@
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-trash-o fa-fw"></i> Supprimer ce compte</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Account', 'delete', ['csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="checkbox">
<label>
<input name="delete_account" type="checkbox" value="1" /> Je suis totalement sûr de vouloir supprimer ce compte
</label>
</div>
<div class="text-center">
<button class="btn btn-danger">Supprimer ce compte</button>
</div>
</form>
</div>
</div>
</div>
<?php if (ENABLE_ACCOUNT_DELETION) { ?>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-trash-o fa-fw"></i> Supprimer ce compte</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Account', 'delete', ['csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="checkbox">
<label>
<input name="delete_account" type="checkbox" value="1" /> Je suis totalement sûr de vouloir supprimer ce compte
</label>
</div>
<div class="text-center">
<button class="btn btn-danger">Supprimer ce compte</button>
</div>
</form>
</div>
</div>
<?php } ?>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">