diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-06-26 13:36:53 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-08 13:27:17 +0200 |
commit | e4b46f77ef2984b33f4dff0efea0585c7ab0cfbf (patch) | |
tree | cdfb6738aba0705a6e5d7cac22260509ffb19de8 /src | |
parent | d9b0673dbb1138e805e039610cef893e49abe3d8 (diff) | |
download | wallabag-e4b46f77ef2984b33f4dff0efea0585c7ab0cfbf.tar.gz wallabag-e4b46f77ef2984b33f4dff0efea0585c7ab0cfbf.tar.zst wallabag-e4b46f77ef2984b33f4dff0efea0585c7ab0cfbf.zip |
work
Diffstat (limited to 'src')
14 files changed, 65 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 91cdcae5..0a306d57 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -251,4 +251,24 @@ class ConfigController extends Controller | |||
251 | 251 | ||
252 | return $config; | 252 | return $config; |
253 | } | 253 | } |
254 | |||
255 | /** | ||
256 | * Delete account for current user. | ||
257 | * | ||
258 | * @Route("/account/delete", name="delete_account") | ||
259 | * | ||
260 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | ||
261 | */ | ||
262 | public function deleteAccountAction() | ||
263 | { | ||
264 | $em = $this->get('fos_user.user_manager'); | ||
265 | $em->deleteUser($this->getUser()); | ||
266 | |||
267 | $this->get('session')->getFlashBag()->add( | ||
268 | 'notice', | ||
269 | 'flashes.account.notice.account_deleted' | ||
270 | ); | ||
271 | |||
272 | return $this->redirect($this->generateUrl('fos_user_security_logout')); | ||
273 | } | ||
254 | } | 274 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 2652a102..69bfe7b3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | # client_created: 'New client created.' | 487 | # client_created: 'New client created.' |
488 | # client_deleted: 'Client deleted' | 488 | # client_deleted: 'Client deleted' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index e0f29b61..f4d13442 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | client_created: 'Neuer Client erstellt.' | 487 | client_created: 'Neuer Client erstellt.' |
488 | client_deleted: 'Client gelöscht' | 488 | client_deleted: 'Client gelöscht' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index b8e98112..6ddb38a0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -485,6 +485,9 @@ flashes: | |||
485 | notice: | 485 | notice: |
486 | client_created: 'New client %name% created.' | 486 | client_created: 'New client %name% created.' |
487 | client_deleted: 'Client %name% deleted' | 487 | client_deleted: 'Client %name% deleted' |
488 | account: | ||
489 | notice: | ||
490 | account_deleted: 'Account deleted' | ||
488 | user: | 491 | user: |
489 | notice: | 492 | notice: |
490 | added: 'User "%username%" added' | 493 | added: 'User "%username%" added' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 70633bd7..05b03938 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | client_created: 'Nuevo cliente creado.' | 487 | client_created: 'Nuevo cliente creado.' |
488 | client_deleted: 'Cliente suprimido' | 488 | client_deleted: 'Cliente suprimido' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 074ab7a8..3a01a8ed 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -485,3 +485,6 @@ flashes: | |||
485 | notice: | 485 | notice: |
486 | # client_created: 'New client created.' | 486 | # client_created: 'New client created.' |
487 | # client_deleted: 'Client deleted' | 487 | # client_deleted: 'Client deleted' |
488 | account: | ||
489 | notice: | ||
490 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 6d85a5ae..09445836 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | client_created: 'Nouveau client %name% créé' | 487 | client_created: 'Nouveau client %name% créé' |
488 | client_deleted: 'Client %name% supprimé' | 488 | client_deleted: 'Client %name% supprimé' |
489 | account: | ||
490 | notice: | ||
491 | account_deleted: 'Compte supprimé' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 15f7e774..93a11aee 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | client_created: 'Nuovo client creato.' | 487 | client_created: 'Nuovo client creato.' |
488 | client_deleted: 'Client eliminato' | 488 | client_deleted: 'Client eliminato' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 1d10be2a..8cadf9a3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | client_created: 'Novèl client creat' | 487 | client_created: 'Novèl client creat' |
488 | client_deleted: 'Client suprimit' | 488 | client_deleted: 'Client suprimit' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 547e9c8b..d392272f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | client_created: 'Nowy klient utworzony.' | 487 | client_created: 'Nowy klient utworzony.' |
488 | client_deleted: 'Klient usunięty' | 488 | client_deleted: 'Klient usunięty' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 2b1d4f6d..f2bce442 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -486,3 +486,6 @@ flashes: | |||
486 | notice: | 486 | notice: |
487 | # client_created: 'New client created.' | 487 | # client_created: 'New client created.' |
488 | # client_deleted: 'Client deleted' | 488 | # client_deleted: 'Client deleted' |
489 | account: | ||
490 | notice: | ||
491 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 8cfc245a..d2bf0504 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -485,3 +485,6 @@ flashes: | |||
485 | notice: | 485 | notice: |
486 | # client_created: 'New client created.' | 486 | # client_created: 'New client created.' |
487 | # client_deleted: 'Client deleted' | 487 | # client_deleted: 'Client deleted' |
488 | account: | ||
489 | notice: | ||
490 | # account_deleted: 'Account deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index 270c077f..cebde1ac 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig | |||
@@ -167,6 +167,7 @@ | |||
167 | {{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} | 167 | {{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} |
168 | {{ form_widget(form.user._token) }} | 168 | {{ form_widget(form.user._token) }} |
169 | </form> | 169 | </form> |
170 | <a class='btn red' href='{{ path('delete_account') }}'>{{ 'config.user.delete_account' | trans }}</a> | ||
170 | </div> | 171 | </div> |
171 | 172 | ||
172 | <div id="set4" class="col s12"> | 173 | <div id="set4" class="col s12"> |
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index d98ae76a..eb7774cd 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php | |||
@@ -25,7 +25,7 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
25 | * @UniqueEntity("email") | 25 | * @UniqueEntity("email") |
26 | * @UniqueEntity("username") | 26 | * @UniqueEntity("username") |
27 | */ | 27 | */ |
28 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface | 28 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface, \Serializable |
29 | { | 29 | { |
30 | /** | 30 | /** |
31 | * @var int | 31 | * @var int |
@@ -240,4 +240,14 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
240 | 240 | ||
241 | return false; | 241 | return false; |
242 | } | 242 | } |
243 | |||
244 | public function serialize() | ||
245 | { | ||
246 | return serialize($this->id); | ||
247 | } | ||
248 | |||
249 | public function unserialize($serialized) | ||
250 | { | ||
251 | $this->id = unserialize($serialized); | ||
252 | } | ||
243 | } | 253 | } |