This commit is contained in:
Thomas Citharel 2016-06-26 13:36:53 +02:00 committed by Jeremy Benoist
parent d9b0673dbb
commit e4b46f77ef
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
14 changed files with 65 additions and 1 deletions

View file

@ -251,4 +251,24 @@ class ConfigController extends Controller
return $config;
}
/**
* Delete account for current user.
*
* @Route("/account/delete", name="delete_account")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function deleteAccountAction()
{
$em = $this->get('fos_user.user_manager');
$em->deleteUser($this->getUser());
$this->get('session')->getFlashBag()->add(
'notice',
'flashes.account.notice.account_deleted'
);
return $this->redirect($this->generateUrl('fos_user_security_logout'));
}
}

View file

@ -486,3 +486,6 @@ flashes:
notice:
# client_created: 'New client created.'
# client_deleted: 'Client deleted'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -486,3 +486,6 @@ flashes:
notice:
client_created: 'Neuer Client erstellt.'
client_deleted: 'Client gelöscht'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -485,6 +485,9 @@ flashes:
notice:
client_created: 'New client %name% created.'
client_deleted: 'Client %name% deleted'
account:
notice:
account_deleted: 'Account deleted'
user:
notice:
added: 'User "%username%" added'

View file

@ -486,3 +486,6 @@ flashes:
notice:
client_created: 'Nuevo cliente creado.'
client_deleted: 'Cliente suprimido'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -485,3 +485,6 @@ flashes:
notice:
# client_created: 'New client created.'
# client_deleted: 'Client deleted'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -486,3 +486,6 @@ flashes:
notice:
client_created: 'Nouveau client %name% créé'
client_deleted: 'Client %name% supprimé'
account:
notice:
account_deleted: 'Compte supprimé'

View file

@ -486,3 +486,6 @@ flashes:
notice:
client_created: 'Nuovo client creato.'
client_deleted: 'Client eliminato'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -486,3 +486,6 @@ flashes:
notice:
client_created: 'Novèl client creat'
client_deleted: 'Client suprimit'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -486,3 +486,6 @@ flashes:
notice:
client_created: 'Nowy klient utworzony.'
client_deleted: 'Klient usunięty'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -486,3 +486,6 @@ flashes:
notice:
# client_created: 'New client created.'
# client_deleted: 'Client deleted'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -485,3 +485,6 @@ flashes:
notice:
# client_created: 'New client created.'
# client_deleted: 'Client deleted'
account:
notice:
# account_deleted: 'Account deleted'

View file

@ -167,6 +167,7 @@
{{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_widget(form.user._token) }}
</form>
<a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.user.delete_account' | trans }}</a>
</div>
<div id="set4" class="col s12">

View file

@ -25,7 +25,7 @@ use Wallabag\CoreBundle\Entity\Entry;
* @UniqueEntity("email")
* @UniqueEntity("username")
*/
class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface
class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface, \Serializable
{
/**
* @var int
@ -240,4 +240,14 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
return false;
}
public function serialize()
{
return serialize($this->id);
}
public function unserialize($serialized)
{
$this->id = unserialize($serialized);
}
}