diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@smile.fr> | 2016-02-18 13:31:22 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-02-22 11:43:29 +0100 |
commit | d8d56448c993bdf4811a193f96e5ff44ed026417 (patch) | |
tree | c0d518e96fde7076f0c5d2885c449ac7df8e1305 | |
parent | c3b43c8a3ee5bc65296110a8c57c037461089745 (diff) | |
download | wallabag-d8d56448c993bdf4811a193f96e5ff44ed026417.tar.gz wallabag-d8d56448c993bdf4811a193f96e5ff44ed026417.tar.zst wallabag-d8d56448c993bdf4811a193f96e5ff44ed026417.zip |
add a username for demonstration mode
-rw-r--r-- | app/config/parameters.yml.dist | 3 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.mysql | 3 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.pgsql | 3 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.sqlite | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 12 |
5 files changed, 14 insertions, 10 deletions
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index b71e5393..5f22b147 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -46,5 +46,6 @@ parameters: | |||
46 | 46 | ||
47 | from_email: no-reply@wallabag.org | 47 | from_email: no-reply@wallabag.org |
48 | 48 | ||
49 | # 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 | 49 | # 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 |
50 | demo: false | 50 | demo: false |
51 | demo_username: wallabag | ||
diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql index 1e21e26a..126e11eb 100644 --- a/app/config/tests/parameters.yml.dist.mysql +++ b/app/config/tests/parameters.yml.dist.mysql | |||
@@ -36,5 +36,6 @@ parameters: | |||
36 | 36 | ||
37 | from_email: no-reply@wallabag.org | 37 | from_email: no-reply@wallabag.org |
38 | 38 | ||
39 | # 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 | 39 | # 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 |
40 | demo: false | 40 | demo: false |
41 | demo_username: wallabag | ||
diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql index 3e1b0b81..8fc33a94 100644 --- a/app/config/tests/parameters.yml.dist.pgsql +++ b/app/config/tests/parameters.yml.dist.pgsql | |||
@@ -36,5 +36,6 @@ parameters: | |||
36 | 36 | ||
37 | from_email: no-reply@wallabag.org | 37 | from_email: no-reply@wallabag.org |
38 | 38 | ||
39 | # 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 | 39 | # 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 |
40 | demo: false | 40 | demo: false |
41 | demo_username: wallabag | ||
diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite index eedb8469..8e3d49b3 100644 --- a/app/config/tests/parameters.yml.dist.sqlite +++ b/app/config/tests/parameters.yml.dist.sqlite | |||
@@ -36,5 +36,6 @@ parameters: | |||
36 | 36 | ||
37 | from_email: no-reply@wallabag.org | 37 | from_email: no-reply@wallabag.org |
38 | 38 | ||
39 | # 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 | 39 | # 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 |
40 | demo: false | 40 | demo: false |
41 | demo_username: wallabag | ||
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 31b59845..9ff79ba9 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -57,18 +57,18 @@ class ConfigController extends Controller | |||
57 | $pwdForm->handleRequest($request); | 57 | $pwdForm->handleRequest($request); |
58 | 58 | ||
59 | if ($pwdForm->isValid()) { | 59 | if ($pwdForm->isValid()) { |
60 | if ($this->getParameter('demo') === false) { | 60 | if ($this->getParameter('demo') === true && $this->getParameter('demo_username') === $user->getUsername()) { |
61 | $user->setPlainPassword($pwdForm->get('new_password')->getData()); | ||
62 | $userManager->updateUser($user, true); | ||
63 | |||
64 | $this->get('session')->getFlashBag()->add( | 61 | $this->get('session')->getFlashBag()->add( |
65 | 'notice', | 62 | 'notice', |
66 | 'Password updated' | 63 | 'In demonstration mode, you can\'t change password for this user.' |
67 | ); | 64 | ); |
68 | } else { | 65 | } else { |
66 | $user->setPlainPassword($pwdForm->get('new_password')->getData()); | ||
67 | $userManager->updateUser($user, true); | ||
68 | |||
69 | $this->get('session')->getFlashBag()->add( | 69 | $this->get('session')->getFlashBag()->add( |
70 | 'notice', | 70 | 'notice', |
71 | 'In demonstration mode, you can\'t change password.' | 71 | 'Password updated' |
72 | ); | 72 | ); |
73 | } | 73 | } |
74 | 74 | ||