]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Demonstration mode to prevent password changes
authorNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>
Wed, 17 Feb 2016 16:02:12 +0000 (17:02 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 22 Feb 2016 10:43:28 +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 7c7413fb9b276c5c4338724c41d90c25f53a7679..dd9ec60ac9c21fb167bbafe23113f8bb8338edae 100644 (file)
@@ -45,3 +45,6 @@ parameters:
     fosuser_confirmation: true
 
     from_email: no-reply@wallabag.org
+
+    # set to true to prevent changing password
+    demo: false
index 1951f02166f81d2d8d0ccab80963d3fd9e3062ee..3d5df619404c4901aa08bcdb9ace8e76098cd25e 100644 (file)
@@ -35,3 +35,6 @@ parameters:
     fosuser_confirmation: true
 
     from_email: no-reply@wallabag.org
+
+    # set to true to prevent changing password
+    demo: false
index 36ad6cde5393ee5706b42b22b6818367aac7a3e4..dd29b7372b5c59a3efb69b9f1f8241e7c5fcdccb 100644 (file)
@@ -35,3 +35,6 @@ parameters:
     fosuser_confirmation: true
 
     from_email: no-reply@wallabag.org
+
+    # set to true to prevent changing password
+    demo: false
index 6564014aa09f5b8c1bf0fa1a0d1673b88cfef103..0e3256e609080288012d58fb411098afe67ac568 100644 (file)
@@ -35,3 +35,6 @@ parameters:
     fosuser_confirmation: true
 
     from_email: no-reply@wallabag.org
+
+    # set to true to prevent changing password
+    demo: false
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');
         }