From: Jeremy Benoist Date: Mon, 22 Feb 2016 10:38:25 +0000 (+0100) Subject: Use internal config instead for demo X-Git-Tag: 2.0.0-beta.1~16^2~2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=a4f42c59f0d8a408cf9f5d7971146866530012d3;p=github%2Fwallabag%2Fwallabag.git Use internal config instead for demo --- diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml index 719e51ea..b627376e 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml @@ -25,3 +25,5 @@ modify_settings: "apply" piwik_host: Host of your website in Piwik piwik_site_id: ID of your website in Piwik piwik_enabled: Enable Piwik +demo_mode_enabled: "Enable demo mode ? (only used for the wallabag public demo)" +demo_mode_username: "Demo user" diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml index ab5dfc72..084eb6df 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml @@ -25,3 +25,5 @@ modify_settings: "appliquer" piwik_host: URL de votre site dans Piwik piwik_site_id: ID de votre site dans Piwik piwik_enabled: Activer Piwik +demo_mode_enabled: "Activer le mode démo ? (utiliser uniquement pour la démo publique de wallabag)" +demo_mode_username: "Utilisateur de la démo" diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 5f22b147..7c7413fb 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -45,7 +45,3 @@ parameters: fosuser_confirmation: true 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 demo_user account - demo: false - demo_username: wallabag diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql index 126e11eb..1951f021 100644 --- a/app/config/tests/parameters.yml.dist.mysql +++ b/app/config/tests/parameters.yml.dist.mysql @@ -35,7 +35,3 @@ parameters: fosuser_confirmation: true 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 demo_user account - demo: false - demo_username: wallabag diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql index 8fc33a94..36ad6cde 100644 --- a/app/config/tests/parameters.yml.dist.pgsql +++ b/app/config/tests/parameters.yml.dist.pgsql @@ -35,7 +35,3 @@ parameters: fosuser_confirmation: true 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 demo_user account - demo: false - demo_username: wallabag diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite index 8e3d49b3..6564014a 100644 --- a/app/config/tests/parameters.yml.dist.sqlite +++ b/app/config/tests/parameters.yml.dist.sqlite @@ -35,7 +35,3 @@ parameters: fosuser_confirmation: true 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 demo_user account - demo: false - demo_username: wallabag diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 93520f9a..2e241757 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -327,6 +327,16 @@ class InstallCommand extends ContainerAwareCommand 'value' => '1', 'section' => 'analytics', ], + [ + 'name' => 'demo_mode_enabled', + 'value' => '0', + 'section' => 'misc', + ], + [ + 'name' => 'demo_mode_username', + 'value' => 'wallabag', + 'section' => 'misc', + ], ]; foreach ($settings as $setting) { diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 9ff79ba9..87196b0e 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -57,7 +57,7 @@ class ConfigController extends Controller $pwdForm->handleRequest($request); if ($pwdForm->isValid()) { - if ($this->getParameter('demo') === true && $this->getParameter('demo_username') === $user->getUsername()) { + if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) { $this->get('session')->getFlashBag()->add( 'notice', 'In demonstration mode, you can\'t change password for this user.' diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index 10b60f30..1f4cafdf 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php @@ -125,6 +125,16 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface 'value' => '1', 'section' => 'analytics', ], + [ + 'name' => 'demo_mode_enabled', + 'value' => '0', + 'section' => 'misc', + ], + [ + 'name' => 'demo_mode_username', + 'value' => 'wallabag', + 'section' => 'misc', + ], ]; foreach ($settings as $setting) {