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);
}
} elseif ($room->access === Room::ACCESS_INTERNAL || $room->access == Room::ACCESS_INTERNAL_RESTRICTED) {
return new RedirectResponse(
$this->urlGenerator->linkToRoute('core.login.showLoginForm', [
'redirect_url' => $this->urlGenerator->linkToRoute(
'bbb.join.index',
['token' => $this->token]
),
])
);
return new RedirectResponse($this->getLoginUrl());
} elseif (empty($displayname) || strlen($displayname) < 3 || ($room->access === Room::ACCESS_PASSWORD && $password !== $room->password)) {
$response = new TemplateResponse($this->appName, 'join', [
'room' => $room->name,
'wrongdisplayname' => !empty($displayname) && strlen($displayname) < 3,
'passwordRequired' => $room->access === Room::ACCESS_PASSWORD,
'wrongPassword' => $password !== $room->password && $password !== '',
'loginUrl' => $this->getLoginUrl(),
], 'guest');
return $response;
@ -139,4 +133,13 @@ class JoinController extends Controller {
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">
<h2><?php p($_['room']) ?></h2>
<?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 if (isset($_['wrongdisplayname']) && $_['wrongdisplayname']): ?>
<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"
class="svg icon-confirm input-button-inline" value="" />
<?php endif; ?>
<p class="login"><a href="<?php print_unescaped($_['loginUrl']); ?>"><?php p($l->t('Have an account? Log in.')); ?></a></p>
</div>
</fieldset>
</form>

View File

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