Use internal config instead for demo

This commit is contained in:
Jeremy Benoist 2016-02-22 11:38:25 +01:00
parent d8d56448c9
commit a4f42c59f0
9 changed files with 25 additions and 17 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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) {

View file

@ -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.'

View file

@ -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) {