aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2016-02-17 17:02:12 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-02-22 11:43:28 +0100
commit6c9f50a6622cdc5c9f975cfb14994db1d9b3ab1b (patch)
tree15c0e663e552273039676d8d6d8cef53d0d6ddfb
parent12b5a8cea12c7c8b10ede7fd00d1f07ca06b1033 (diff)
downloadwallabag-6c9f50a6622cdc5c9f975cfb14994db1d9b3ab1b.tar.gz
wallabag-6c9f50a6622cdc5c9f975cfb14994db1d9b3ab1b.tar.zst
wallabag-6c9f50a6622cdc5c9f975cfb14994db1d9b3ab1b.zip
Demonstration mode to prevent password changes
-rw-r--r--app/config/parameters.yml.dist3
-rw-r--r--app/config/tests/parameters.yml.dist.mysql3
-rw-r--r--app/config/tests/parameters.yml.dist.pgsql3
-rw-r--r--app/config/tests/parameters.yml.dist.sqlite3
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php21
5 files changed, 26 insertions, 7 deletions
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index 7c7413fb..dd9ec60a 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -45,3 +45,6 @@ parameters:
45 fosuser_confirmation: true 45 fosuser_confirmation: true
46 46
47 from_email: no-reply@wallabag.org 47 from_email: no-reply@wallabag.org
48
49 # set to true to prevent changing password
50 demo: false
diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql
index 1951f021..3d5df619 100644
--- a/app/config/tests/parameters.yml.dist.mysql
+++ b/app/config/tests/parameters.yml.dist.mysql
@@ -35,3 +35,6 @@ parameters:
35 fosuser_confirmation: true 35 fosuser_confirmation: true
36 36
37 from_email: no-reply@wallabag.org 37 from_email: no-reply@wallabag.org
38
39 # set to true to prevent changing password
40 demo: false
diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql
index 36ad6cde..dd29b737 100644
--- a/app/config/tests/parameters.yml.dist.pgsql
+++ b/app/config/tests/parameters.yml.dist.pgsql
@@ -35,3 +35,6 @@ parameters:
35 fosuser_confirmation: true 35 fosuser_confirmation: true
36 36
37 from_email: no-reply@wallabag.org 37 from_email: no-reply@wallabag.org
38
39 # set to true to prevent changing password
40 demo: false
diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite
index 6564014a..0e3256e6 100644
--- a/app/config/tests/parameters.yml.dist.sqlite
+++ b/app/config/tests/parameters.yml.dist.sqlite
@@ -35,3 +35,6 @@ parameters:
35 fosuser_confirmation: true 35 fosuser_confirmation: true
36 36
37 from_email: no-reply@wallabag.org 37 from_email: no-reply@wallabag.org
38
39 # set to true to prevent changing password
40 demo: false
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 6eb621d8..04b54644 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -57,13 +57,20 @@ class ConfigController extends Controller
57 $pwdForm->handleRequest($request); 57 $pwdForm->handleRequest($request);
58 58
59 if ($pwdForm->isValid()) { 59 if ($pwdForm->isValid()) {
60 $user->setPlainPassword($pwdForm->get('new_password')->getData()); 60 if ($this->getParameter('demo') === false) {
61 $userManager->updateUser($user, true); 61 $user->setPlainPassword($pwdForm->get('new_password')->getData());
62 62 $userManager->updateUser($user, true);
63 $this->get('session')->getFlashBag()->add( 63
64 'notice', 64 $this->get('session')->getFlashBag()->add(
65 'Password updated' 65 'notice',
66 ); 66 'Password updated'
67 );
68 } else {
69 $this->get('session')->getFlashBag()->add(
70 'notice',
71 'In demonstration mode, you can`t change password.'
72 );
73 }
67 74
68 return $this->redirect($this->generateUrl('config').'#set4'); 75 return $this->redirect($this->generateUrl('config').'#set4');
69 } 76 }