]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
add a username for demonstration mode
authorNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>
Thu, 18 Feb 2016 12:31:22 +0000 (13:31 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 22 Feb 2016 10:43:29 +0000 (11:43 +0100)
app/config/parameters.yml.dist
app/config/tests/parameters.yml.dist.mysql
app/config/tests/parameters.yml.dist.pgsql
app/config/tests/parameters.yml.dist.sqlite
src/Wallabag/CoreBundle/Controller/ConfigController.php

index b71e5393ca41846e6ff4875fdb4551cd8679444a..5f22b147fa5736bce1e0d7992f72d620c6d2201b 100644 (file)
@@ -46,5 +46,6 @@ parameters:
 
     from_email: no-reply@wallabag.org
 
-    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the default account
+    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the demo_user account
     demo: false
+    demo_username: wallabag
index 1e21e26a4f6005895893492cd11a4fc16f178555..126e11eb1d32a12eb6c1a8ea752a6130038a366c 100644 (file)
@@ -36,5 +36,6 @@ parameters:
 
     from_email: no-reply@wallabag.org
 
-    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the default account
+    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the demo_user account
     demo: false
+    demo_username: wallabag
index 3e1b0b819ef526cf5a1b135bea79433b02b00dc7..8fc33a94ce8298e6a6cb138d4e4a414b63069c1c 100644 (file)
@@ -36,5 +36,6 @@ parameters:
 
     from_email: no-reply@wallabag.org
 
-    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the default account
+    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the demo_user account
     demo: false
+    demo_username: wallabag
index eedb846910f3d80743d700f7e457515de5b323c3..8e3d49b358a7edb9fbd52cb186744767e51d3dbd 100644 (file)
@@ -36,5 +36,6 @@ parameters:
 
     from_email: no-reply@wallabag.org
 
-    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the default account
+    # this parameter is only used for the wallabag public demo, it means user won't be able to change the password of the demo_user account
     demo: false
+    demo_username: wallabag
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'
                 );
             }