]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/ConfigController.php
Demonstration mode to prevent password changes
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / ConfigController.php
index 6eb621d875f36275c02908b9428c378144e2ba4d..04b54644385516d1d54032e7ca11886e1e4c74bb 100644 (file)
@@ -57,13 +57,20 @@ class ConfigController extends Controller
         $pwdForm->handleRequest($request);
 
         if ($pwdForm->isValid()) {
-            $user->setPlainPassword($pwdForm->get('new_password')->getData());
-            $userManager->updateUser($user, true);
-
-            $this->get('session')->getFlashBag()->add(
-                'notice',
-                'Password updated'
-            );
+            if ($this->getParameter('demo') === false) {
+                $user->setPlainPassword($pwdForm->get('new_password')->getData());
+                $userManager->updateUser($user, true);
+
+                $this->get('session')->getFlashBag()->add(
+                    'notice',
+                    'Password updated'
+                );
+            } else {
+                $this->get('session')->getFlashBag()->add(
+                    'notice',
+                    'In demonstration mode, you can`t change password.'
+                );
+            }
 
             return $this->redirect($this->generateUrl('config').'#set4');
         }