Demonstration mode to prevent password changes

This commit is contained in:
Nicolas Lœuillet 2016-02-17 17:02:12 +01:00 committed by Jeremy Benoist
parent 12b5a8cea1
commit 6c9f50a662
5 changed files with 25 additions and 6 deletions

View file

@ -45,3 +45,6 @@ parameters:
fosuser_confirmation: true
from_email: no-reply@wallabag.org
# set to true to prevent changing password
demo: false

View file

@ -35,3 +35,6 @@ parameters:
fosuser_confirmation: true
from_email: no-reply@wallabag.org
# set to true to prevent changing password
demo: false

View file

@ -35,3 +35,6 @@ parameters:
fosuser_confirmation: true
from_email: no-reply@wallabag.org
# set to true to prevent changing password
demo: false

View file

@ -35,3 +35,6 @@ parameters:
fosuser_confirmation: true
from_email: no-reply@wallabag.org
# set to true to prevent changing password
demo: false

View 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);
if ($this->getParameter('demo') === false) {
$user->setPlainPassword($pwdForm->get('new_password')->getData());
$userManager->updateUser($user, true);
$this->get('session')->getFlashBag()->add(
'notice',
'Password updated'
);
$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');
}