mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
add a username for demonstration mode
This commit is contained in:
parent
c3b43c8a3e
commit
d8d56448c9
5 changed files with 14 additions and 10 deletions
|
@ -46,5 +46,6 @@ parameters:
|
|||
|
||||
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 default account
|
||||
# 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
|
||||
|
|
|
@ -36,5 +36,6 @@ parameters:
|
|||
|
||||
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 default account
|
||||
# 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
|
||||
|
|
|
@ -36,5 +36,6 @@ parameters:
|
|||
|
||||
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 default account
|
||||
# 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
|
||||
|
|
|
@ -36,5 +36,6 @@ parameters:
|
|||
|
||||
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 default account
|
||||
# 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
|
||||
|
|
|
@ -57,7 +57,12 @@ class ConfigController extends Controller
|
|||
$pwdForm->handleRequest($request);
|
||||
|
||||
if ($pwdForm->isValid()) {
|
||||
if ($this->getParameter('demo') === false) {
|
||||
if ($this->getParameter('demo') === true && $this->getParameter('demo_username') === $user->getUsername()) {
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
'notice',
|
||||
'In demonstration mode, you can\'t change password for this user.'
|
||||
);
|
||||
} else {
|
||||
$user->setPlainPassword($pwdForm->get('new_password')->getData());
|
||||
$userManager->updateUser($user, true);
|
||||
|
||||
|
@ -65,11 +70,6 @@ class ConfigController extends Controller
|
|||
'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');
|
||||
|
|
Loading…
Reference in a new issue