rhertogh /
yii2-oauth2-server
| 1 | <?php |
||
| 2 | |||
| 3 | // phpcs:disable Generic.Files.LineLength.TooLong |
||
| 4 | use rhertogh\Yii2Oauth2Server\interfaces\components\authorization\client\Oauth2ClientAuthorizationRequestInterface; |
||
| 5 | use rhertogh\Yii2Oauth2Server\interfaces\components\authorization\EndSession\Oauth2EndSessionAuthorizationRequestInterface; |
||
| 6 | use yii\helpers\Html; |
||
| 7 | use yii\web\View; |
||
| 8 | use yii\widgets\ActiveForm; |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 9 | // phpcs:enable Generic.Files.LineLength.TooLong |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var View $this |
||
| 13 | * @var Oauth2EndSessionAuthorizationRequestInterface $endSessionAuthorizationRequest |
||
| 14 | */ |
||
| 15 | |||
| 16 | |||
| 17 | // Note: using long class names to avoid any conflict. |
||
| 18 | ?> |
||
| 19 | <style> |
||
| 20 | .oauth2_authorize-client-wrapper { |
||
| 21 | display: inline-flex; |
||
| 22 | flex-direction: column; |
||
| 23 | justify-content: center; |
||
| 24 | align-items: center; |
||
| 25 | |||
| 26 | width: 100%; |
||
| 27 | height: calc(100vh - 100px); |
||
| 28 | } |
||
| 29 | |||
| 30 | .oauth2_authorize-client-modal { |
||
| 31 | background: white; |
||
| 32 | border-radius: 3px; |
||
| 33 | border: 1px solid rgba(0, 0, 0, 0.5); |
||
| 34 | box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1); |
||
| 35 | width: 500px; |
||
| 36 | } |
||
| 37 | |||
| 38 | .oauth2_authorize-client-content { |
||
| 39 | margin: 10px; |
||
| 40 | } |
||
| 41 | |||
| 42 | .oauth2_authorize-client-modal-title { |
||
| 43 | text-align: center; |
||
| 44 | margin-top: 5px; |
||
| 45 | } |
||
| 46 | |||
| 47 | .oauth2_authorize-client-requested-scopes, |
||
| 48 | .oauth2_authorize-client-previously-approved-scopes { |
||
| 49 | margin: 15px; |
||
| 50 | } |
||
| 51 | |||
| 52 | .oauth2_authorize-client-modal-footer { |
||
| 53 | display: inline-flex; |
||
| 54 | flex-direction: row; |
||
| 55 | justify-content: flex-end; |
||
| 56 | gap: 20px; |
||
| 57 | width: 100%; |
||
| 58 | padding: 10px 25px; |
||
| 59 | } |
||
| 60 | |||
| 61 | .oauth2_authorize-client-modal-button { |
||
| 62 | font: inherit; |
||
| 63 | cursor: pointer; |
||
| 64 | display: inline-block; |
||
| 65 | text-align: center; |
||
| 66 | text-decoration: none; |
||
| 67 | margin: 2px 0; |
||
| 68 | border: solid 2px transparent; |
||
| 69 | border-radius: 3px; |
||
| 70 | padding: 7px 25px; |
||
| 71 | color: #ffffff; |
||
| 72 | background-color: #aaaaaa; |
||
| 73 | } |
||
| 74 | |||
| 75 | .oauth2_authorize-client-modal-button:active { |
||
| 76 | transform: translateY(1px); |
||
| 77 | filter: saturate(150%); |
||
| 78 | } |
||
| 79 | |||
| 80 | .oauth2_authorize-client-modal-button:hover { |
||
| 81 | background-color: #999999; |
||
| 82 | } |
||
| 83 | |||
| 84 | .oauth2_authorize-client-modal-button-primary { |
||
| 85 | background-color: #227700; |
||
| 86 | } |
||
| 87 | |||
| 88 | .oauth2_authorize-client-modal-button-primary:hover { |
||
| 89 | background-color: #226600; |
||
| 90 | } |
||
| 91 | |||
| 92 | #oauth2_authorize-client-previously-approved-scopes-toggle.open span { |
||
| 93 | display: inline-block; |
||
| 94 | transform: rotate(-180deg); |
||
| 95 | } |
||
| 96 | |||
| 97 | </style> |
||
| 98 | <?php |
||
| 99 | $client = $endSessionAuthorizationRequest->getClient(); |
||
| 100 | ?> |
||
| 101 | <div class="oauth2_authorize-client-wrapper"> |
||
| 102 | <div class="oauth2_authorize-client-modal"> |
||
| 103 | <?php $form = ActiveForm::begin(['id' => 'oauth2-end-session-authorization-request-form']) ?> |
||
| 104 | <div class="oauth2_authorize-client-content"> |
||
| 105 | <h3 class="oauth2_authorize-client-modal-title oauth2_authorize-client-modal-title_no-scopes"> |
||
| 106 | <?php |
||
| 107 | if ($client) { |
||
| 108 | echo Yii::t('oauth2', '{clientName} requested to log you out from {appName}, is this OK?', [ |
||
| 109 | 'clientName' => Html::encode($client->getName()), |
||
| 110 | 'appName' => Yii::$app->name, |
||
| 111 | ]); |
||
| 112 | } else { |
||
| 113 | echo Yii::t('oauth2', 'Do you want to log out from {appName}?', [ |
||
| 114 | 'appName' => Yii::$app->name, |
||
| 115 | ]); |
||
| 116 | } |
||
| 117 | ?> |
||
| 118 | </h3> |
||
| 119 | </div> |
||
| 120 | <div class="oauth2_authorize-client-modal-footer"> |
||
| 121 | <button |
||
| 122 | type="submit" |
||
| 123 | name="<?= Html::getInputName($endSessionAuthorizationRequest, 'authorizationStatus') ?>" |
||
| 124 | value="<?= Oauth2ClientAuthorizationRequestInterface::AUTHORIZATION_DENIED ?>" |
||
| 125 | class="oauth2_authorize-client-modal-button" |
||
| 126 | > |
||
| 127 | <?= Yii::t('oauth2', 'No') ?> |
||
| 128 | </button> |
||
| 129 | <button |
||
| 130 | type="submit" |
||
| 131 | name="<?= Html::getInputName($endSessionAuthorizationRequest, 'authorizationStatus') ?>" |
||
| 132 | value="<?= Oauth2ClientAuthorizationRequestInterface::AUTHORIZATION_APPROVED ?>" |
||
| 133 | class="oauth2_authorize-client-modal-button oauth2_authorize-client-modal-button-primary" |
||
| 134 | > |
||
| 135 | <?= Yii::t('oauth2', 'Yes') ?> |
||
| 136 | </button> |
||
| 137 | </div> |
||
| 138 | <?php ActiveForm::end() ?> |
||
| 139 | </div> |
||
| 140 | </div> |
||
| 141 |