Merge pull request #3080 from mkuron/oauth

OAuth improvements
This commit is contained in:
André Peters 2019-10-22 21:00:20 +02:00 committed by GitHub
commit e0486ea5a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -31,7 +31,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
<div class="panel-heading"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?= $lang['login']['login']; ?></div> <div class="panel-heading"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?= $lang['login']['login']; ?></div>
<div class="panel-body"> <div class="panel-body">
<div class="text-center mailcow-logo"><img src="<?=($main_logo = customize('get', 'main_logo')) ? $main_logo : '/img/cow_mailcow.svg';?>" alt="mailcow"></div> <div class="text-center mailcow-logo"><img src="<?=($main_logo = customize('get', 'main_logo')) ? $main_logo : '/img/cow_mailcow.svg';?>" alt="mailcow"></div>
<legend><?=$UI_TEXTS['main_name'];?></legend> <legend><?= isset($_SESSION['oauth2_request']) ? $lang['oauth2']['authorize_app'] : $UI_TEXTS['main_name'];?></legend>
<form method="post" autofill="off"> <form method="post" autofill="off">
<div class="form-group"> <div class="form-group">
<label class="sr-only" for="login_user"><?= $lang['login']['username']; ?></label> <label class="sr-only" for="login_user"><?= $lang['login']['username']; ?></label>
@ -49,6 +49,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-success" value="Login"><?= $lang['login']['login']; ?></button> <button type="submit" class="btn btn-success" value="Login"><?= $lang['login']['login']; ?></button>
<?php if(!isset($_SESSION['oauth2_request'])): ?>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button type="button" <?=(isset($_SESSION['mailcow_locale']) && count($AVAILABLE_LANGUAGES) === 1) ? 'disabled="true"' : '' ?> class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" <?=(isset($_SESSION['mailcow_locale']) && count($AVAILABLE_LANGUAGES) === 1) ? 'disabled="true"' : '' ?> class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="lang-sm lang-lbl" lang="<?= $_SESSION['mailcow_locale']; ?>"></span> <span class="caret"></span> <span class="lang-sm lang-lbl" lang="<?= $_SESSION['mailcow_locale']; ?>"></span> <span class="caret"></span>
@ -63,6 +64,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
?> ?>
</ul> </ul>
</div> </div>
<?php endif ?>
</div> </div>
</form> </form>
<?php <?php
@ -72,6 +74,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
<?php <?php
endif; endif;
?> ?>
<?php if(!isset($_SESSION['oauth2_request'])): ?>
<legend><?=$UI_TEXTS['apps_name'];?></legend> <legend><?=$UI_TEXTS['apps_name'];?></legend>
<?php <?php
foreach ($MAILCOW_APPS as $app): foreach ($MAILCOW_APPS as $app):
@ -89,10 +92,12 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
endforeach; endforeach;
} }
} }
endif;
?> ?>
</div> </div>
</div> </div>
</div> </div>
<?php if(!isset($_SESSION['oauth2_request'])): ?>
<div class="col-md-offset-3 col-md-6"> <div class="col-md-offset-3 col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
@ -112,6 +117,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
</div> </div>
</div> </div>
</div> </div>
<?php endif ?>
</div> </div>
</div><!-- /.container --> </div><!-- /.container -->
<?php <?php

View File

@ -17,6 +17,7 @@ if (!empty($mailbox)) {
'identifier' => $token['user_id'], 'identifier' => $token['user_id'],
'email' => (!empty($mailbox['username']) ? $mailbox['username'] : ''), 'email' => (!empty($mailbox['username']) ? $mailbox['username'] : ''),
'full_name' => (!empty($mailbox['name']) ? $mailbox['name'] : 'mailcow administrative user'), 'full_name' => (!empty($mailbox['name']) ? $mailbox['name'] : 'mailcow administrative user'),
'displayName' => (!empty($mailbox['name']) ? $mailbox['name'] : 'mailcow administrative user'),
'created' => (!empty($mailbox['created']) ? $mailbox['created'] : ''), 'created' => (!empty($mailbox['created']) ? $mailbox['created'] : ''),
'modified' => (!empty($mailbox['modified']) ? $mailbox['modified'] : ''), 'modified' => (!empty($mailbox['modified']) ? $mailbox['modified'] : ''),
'active' => (!empty($mailbox['active']) ? $mailbox['active'] : ''), 'active' => (!empty($mailbox['active']) ? $mailbox['active'] : ''),