]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/ConfigController.php
add refresh-token grant-type
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / ConfigController.php
index 6eb621d875f36275c02908b9428c378144e2ba4d..1930a2ae4357c30997d3c2a9a97148e9bdacc7a3 100644 (file)
@@ -16,7 +16,6 @@ use Wallabag\CoreBundle\Form\Type\RssType;
 use Wallabag\CoreBundle\Form\Type\TaggingRuleType;
 use Wallabag\CoreBundle\Form\Type\UserInformationType;
 use Wallabag\CoreBundle\Tools\Utils;
-use Wallabag\UserBundle\Entity\User;
 
 class ConfigController extends Controller
 {
@@ -57,13 +56,16 @@ class ConfigController extends Controller
         $pwdForm->handleRequest($request);
 
         if ($pwdForm->isValid()) {
-            $user->setPlainPassword($pwdForm->get('new_password')->getData());
-            $userManager->updateUser($user, true);
+            if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) {
+                $message = 'In demonstration mode, you can\'t change password for this user.';
+            } else {
+                $message = 'Password updated';
 
-            $this->get('session')->getFlashBag()->add(
-                'notice',
-                'Password updated'
-            );
+                $user->setPlainPassword($pwdForm->get('new_password')->getData());
+                $userManager->updateUser($user, true);
+            }
+
+            $this->get('session')->getFlashBag()->add('notice', $message);
 
             return $this->redirect($this->generateUrl('config').'#set4');
         }