]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/ConfigController.php
add a username for demonstration mode
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / ConfigController.php
index 31b59845826594f5a19706713d3248275bab5248..9ff79ba9f4ce316bde300bc8edcbcfb9e4c53fe1 100644 (file)
@@ -57,18 +57,18 @@ class ConfigController extends Controller
         $pwdForm->handleRequest($request);
 
         if ($pwdForm->isValid()) {
-            if ($this->getParameter('demo') === false) {
-                $user->setPlainPassword($pwdForm->get('new_password')->getData());
-                $userManager->updateUser($user, true);
-
+            if ($this->getParameter('demo') === true && $this->getParameter('demo_username') === $user->getUsername()) {
                 $this->get('session')->getFlashBag()->add(
                     'notice',
-                    'Password updated'
+                    'In demonstration mode, you can\'t change password for this user.'
                 );
             } else {
+                $user->setPlainPassword($pwdForm->get('new_password')->getData());
+                $userManager->updateUser($user, true);
+
                 $this->get('session')->getFlashBag()->add(
                     'notice',
-                    'In demonstration mode, you can\'t change password.'
+                    'Password updated'
                 );
             }