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 fosuser_confirmation: true
from_email: no-reply@wallabag.org 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 fosuser_confirmation: true
from_email: no-reply@wallabag.org 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 fosuser_confirmation: true
from_email: no-reply@wallabag.org 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 fosuser_confirmation: true
from_email: no-reply@wallabag.org from_email: no-reply@wallabag.org
# set to true to prevent changing password
demo: false

View file

@ -57,6 +57,7 @@ class ConfigController extends Controller
$pwdForm->handleRequest($request); $pwdForm->handleRequest($request);
if ($pwdForm->isValid()) { if ($pwdForm->isValid()) {
if ($this->getParameter('demo') === false) {
$user->setPlainPassword($pwdForm->get('new_password')->getData()); $user->setPlainPassword($pwdForm->get('new_password')->getData());
$userManager->updateUser($user, true); $userManager->updateUser($user, true);
@ -64,6 +65,12 @@ class ConfigController extends Controller
'notice', 'notice',
'Password updated' 'Password updated'
); );
} else {
$this->get('session')->getFlashBag()->add(
'notice',
'In demonstration mode, you can`t change password.'
);
}
return $this->redirect($this->generateUrl('config').'#set4'); return $this->redirect($this->generateUrl('config').'#set4');
} }