Show "Wrong password" info when the conversation password was wrong

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-07-19 13:02:56 +02:00
Родитель 4474986a29
Коммит 8ee67f13c1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -179,7 +179,9 @@ class PageController extends Controller {
$this->talkSession->setPasswordForRoom($token, $token); $this->talkSession->setPasswordForRoom($token, $token);
} else { } else {
if ($passwordVerification['url'] === '') { if ($passwordVerification['url'] === '') {
return new TemplateResponse($this->appName, 'authenticate', [], 'guest'); return new TemplateResponse($this->appName, 'authenticate', [
'wrongpw' => $password !== '',
], 'guest');
} }
return new RedirectResponse($passwordVerification['url']); return new RedirectResponse($passwordVerification['url']);
@ -232,7 +234,9 @@ class PageController extends Controller {
$this->talkSession->setPasswordForRoom($token, $token); $this->talkSession->setPasswordForRoom($token, $token);
} else { } else {
if ($passwordVerification['url'] === '') { if ($passwordVerification['url'] === '') {
return new TemplateResponse($this->appName, 'authenticate', [], 'guest'); return new TemplateResponse($this->appName, 'authenticate', [
'wrongpw' => $password !== '',
], 'guest');
} }
return new RedirectResponse($passwordVerification['url']); return new RedirectResponse($passwordVerification['url']);

Просмотреть файл

@ -6,7 +6,7 @@
?> ?>
<form method="post"> <form method="post">
<fieldset class="warning"> <fieldset class="warning">
<?php if (!isset($_['wrongpw'])){ ?> <?php if (!$_['wrongpw']) { ?>
<div class="warning-info"><?php p($l->t('This conversation is password-protected')); ?></div> <div class="warning-info"><?php p($l->t('This conversation is password-protected')); ?></div>
<?php } else { ?> <?php } else { ?>
<div class="warning"><?php p($l->t('The password is wrong. Try again.')); ?></div> <div class="warning"><?php p($l->t('The password is wrong. Try again.')); ?></div>