use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
+use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\TaggingRule;
$pwdForm->handleRequest($request);
if ($pwdForm->isValid()) {
- $user->setPlainPassword($pwdForm->get('new_password')->getData());
- $userManager->updateUser($user, true);
-
- $this->get('session')->getFlashBag()->add(
- 'notice',
- 'Password updated'
- );
+ 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.'
+ );
+ } else {
+ $user->setPlainPassword($pwdForm->get('new_password')->getData());
+ $userManager->updateUser($user, true);
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Password updated'
+ );
+ }
return $this->redirect($this->generateUrl('config').'#set4');
}
*
* @Route("/generate-token", name="generate_token")
*
- * @return JsonResponse
+ * @return RedirectResponse|JsonResponse
*/
public function generateTokenAction(Request $request)
{
*
* @Route("/tagging-rule/delete/{id}", requirements={"id" = "\d+"}, name="delete_tagging_rule")
*
- * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ * @return RedirectResponse
*/
public function deleteTaggingRuleAction(TaggingRule $rule)
{