use Shaarli\Container\ShaarliContainer;
use Shaarli\Front\Exception\OpenShaarliPasswordException;
use Shaarli\Front\Exception\ShaarliFrontException;
+use Shaarli\Render\TemplatePage;
use Slim\Http\Request;
use Slim\Http\Response;
use Throwable;
$this->assignView(
'pagetitle',
- t('Change password') .' - '. $this->container->conf->get('general.title', 'Shaarli')
+ t('Change password') . ' - ' . $this->container->conf->get('general.title', 'Shaarli')
);
}
/**
- * GET /password - Displays the change password template
+ * GET /admin/password - Displays the change password template
*/
public function index(Request $request, Response $response): Response
{
- return $response->write($this->render('changepassword'));
+ return $response->write($this->render(TemplatePage::CHANGE_PASSWORD));
}
/**
- * POST /password - Change admin password - existing and new passwords need to be provided.
+ * POST /admin/password - Change admin password - existing and new passwords need to be provided.
*/
public function change(Request $request, Response $response): Response
{
return $response
->withStatus(400)
- ->write($this->render('changepassword'))
+ ->write($this->render(TemplatePage::CHANGE_PASSWORD))
;
}
return $response
->withStatus(400)
- ->write($this->render('changepassword'))
+ ->write($this->render(TemplatePage::CHANGE_PASSWORD))
;
}
// Save new password
// Salt renders rainbow-tables attacks useless.
- $this->container->conf->set('credentials.salt', sha1(uniqid('', true) .'_'. mt_rand()));
+ $this->container->conf->set('credentials.salt', sha1(uniqid('', true) . '_' . mt_rand()));
$this->container->conf->set(
'credentials.hash',
sha1(
$this->saveSuccessMessage(t('Your password has been changed'));
- return $response->write($this->render('changepassword'));
+ return $response->write($this->render(TemplatePage::CHANGE_PASSWORD));
}
}