diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-02-22 14:18:34 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-02-22 14:18:34 +0100 |
commit | 2aadeea8cd968a2e32631b166097748611a520f6 (patch) | |
tree | 2a167eaae0edea08060abfd132aec3c4a7239207 /src/Wallabag/CoreBundle/Controller/ConfigController.php | |
parent | 2b71f68c95acd20b9ee5e6dc4d67a1ec649fc440 (diff) | |
parent | b6c00b0b807108cd54ab32fa73f9c196f4f12d97 (diff) | |
download | wallabag-2aadeea8cd968a2e32631b166097748611a520f6.tar.gz wallabag-2aadeea8cd968a2e32631b166097748611a520f6.tar.zst wallabag-2aadeea8cd968a2e32631b166097748611a520f6.zip |
Merge pull request #1683 from wallabag/v2-demo
Demonstration mode to prevent password changes
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/ConfigController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 6eb621d8..1791eac2 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -57,13 +57,16 @@ class ConfigController extends Controller | |||
57 | $pwdForm->handleRequest($request); | 57 | $pwdForm->handleRequest($request); |
58 | 58 | ||
59 | if ($pwdForm->isValid()) { | 59 | if ($pwdForm->isValid()) { |
60 | $user->setPlainPassword($pwdForm->get('new_password')->getData()); | 60 | if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) { |
61 | $userManager->updateUser($user, true); | 61 | $message = 'In demonstration mode, you can\'t change password for this user.'; |
62 | } else { | ||
63 | $message = 'Password updated'; | ||
62 | 64 | ||
63 | $this->get('session')->getFlashBag()->add( | 65 | $user->setPlainPassword($pwdForm->get('new_password')->getData()); |
64 | 'notice', | 66 | $userManager->updateUser($user, true); |
65 | 'Password updated' | 67 | } |
66 | ); | 68 | |
69 | $this->get('session')->getFlashBag()->add('notice', $message); | ||
67 | 70 | ||
68 | return $this->redirect($this->generateUrl('config').'#set4'); | 71 | return $this->redirect($this->generateUrl('config').'#set4'); |
69 | } | 72 | } |