feat: show login option

pull/75/head
sualko 2020-08-31 16:27:13 +02:00
parent e3c7eb2bbb
commit 39acceb24d
3 changed files with 19 additions and 10 deletions

View File

@ -95,20 +95,14 @@ class JoinController extends Controller {
$presentation = new Presentation($u, $filename); $presentation = new Presentation($u, $filename);
} }
} elseif ($room->access === Room::ACCESS_INTERNAL || $room->access == Room::ACCESS_INTERNAL_RESTRICTED) { } elseif ($room->access === Room::ACCESS_INTERNAL || $room->access == Room::ACCESS_INTERNAL_RESTRICTED) {
return new RedirectResponse( return new RedirectResponse($this->getLoginUrl());
$this->urlGenerator->linkToRoute('core.login.showLoginForm', [
'redirect_url' => $this->urlGenerator->linkToRoute(
'bbb.join.index',
['token' => $this->token]
),
])
);
} elseif (empty($displayname) || strlen($displayname) < 3 || ($room->access === Room::ACCESS_PASSWORD && $password !== $room->password)) { } elseif (empty($displayname) || strlen($displayname) < 3 || ($room->access === Room::ACCESS_PASSWORD && $password !== $room->password)) {
$response = new TemplateResponse($this->appName, 'join', [ $response = new TemplateResponse($this->appName, 'join', [
'room' => $room->name, 'room' => $room->name,
'wrongdisplayname' => !empty($displayname) && strlen($displayname) < 3, 'wrongdisplayname' => !empty($displayname) && strlen($displayname) < 3,
'passwordRequired' => $room->access === Room::ACCESS_PASSWORD, 'passwordRequired' => $room->access === Room::ACCESS_PASSWORD,
'wrongPassword' => $password !== $room->password && $password !== '', 'wrongPassword' => $password !== $room->password && $password !== '',
'loginUrl' => $this->getLoginUrl(),
], 'guest'); ], 'guest');
return $response; return $response;
@ -139,4 +133,13 @@ class JoinController extends Controller {
return $this->room; return $this->room;
} }
private function getLoginUrl(): string {
return $this->urlGenerator->linkToRoute('core.login.showLoginForm', [
'redirect_url' => $this->urlGenerator->linkToRoute(
'bbb.join.index',
['token' => $this->token]
),
]);
}
} }

View File

@ -8,7 +8,7 @@
<fieldset class="warning bbb"> <fieldset class="warning bbb">
<h2><?php p($_['room']) ?></h2> <h2><?php p($_['room']) ?></h2>
<?php if (!isset($_['wrongdisplayname']) || !$_['wrongdisplayname']): ?> <?php if (!isset($_['wrongdisplayname']) || !$_['wrongdisplayname']): ?>
<p><?php p($l->t('Please enter your name!')); ?></p> <p class="warning-info"><?php p($l->t('Please enter your name!')); ?></p>
<?php endif; ?> <?php endif; ?>
<?php if (isset($_['wrongdisplayname']) && $_['wrongdisplayname']): ?> <?php if (isset($_['wrongdisplayname']) && $_['wrongdisplayname']): ?>
<div class="warning"><?php p($l->t('The name must be at least 3 characters long.')); ?></div> <div class="warning"><?php p($l->t('The name must be at least 3 characters long.')); ?></div>
@ -32,7 +32,7 @@
<input type="submit" id="displayname-submit" <input type="submit" id="displayname-submit"
class="svg icon-confirm input-button-inline" value="" /> class="svg icon-confirm input-button-inline" value="" />
<?php endif; ?> <?php endif; ?>
<p class="login"><a href="<?php print_unescaped($_['loginUrl']); ?>"><?php p($l->t('Have an account? Log in.')); ?></a></p>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View File

@ -33,4 +33,10 @@
height: 45px; height: 45px;
background-color: transparent !important; background-color: transparent !important;
} }
.login {
margin-top: 1.5em;
text-align: center;
font-weight: normal;
}
} }