aboutsummaryrefslogtreecommitdiff
path: root/app/views/api/oauth2/authorize.php
blob: 216693879ae56361a32678a04843dc79715b842f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
 * @var \League\OAuth2\Server\Entities\ClientEntityInterface $client
 * @var array $scopes
 * @var string $state
 * @var string $authToken
 * @var StudipController $controller
 */
?>
<section class="oauth authorize">
    <header>
        <h1><?= _('Autorisierungsanfrage') ?></h1>
    </header>

    <p>
        <?= sprintf(
            _('Die Applikation <strong>"%s"</strong> möchte auf Ihre Daten zugreifen.'),
            htmlReady($client->getName())
            ) ?>
    </p>

    <? if (count($scopes) > 0) { ?>
        <div class="scopes">
            <p><strong><?= _('Diese Applikation hat Zugriff auf:') ?></strong></p>
            <ul>
                <? foreach ($scopes as $scope) { ?>
                    <li><?= htmlReady($scope->description) ?></li>
                <? } ?>
            </ul>
        </div>
    <? } ?>

    <div class="buttons">
        <form action="<?= $controller->url_for('api/oauth2/authorize') ?>" method="post">
            <?= \CSRFProtection::tokenTag() ?>
            <input type="hidden" name="_method" value="delete">
            <input type="hidden" name="state" value="<?= htmlReady($state) ?>">
            <input type="hidden" name="client_id" value="<?= htmlReady($client->getIdentifier()) ?>">
            <input type="hidden" name="auth_token" value="<?= htmlReady($authToken) ?>">
            <?= Studip\Button::create(_('Verweigern'), 'deny') ?>
        </form>

        <form action="<?= $controller->url_for('api/oauth2/authorize') ?>" method="post">
            <?= \CSRFProtection::tokenTag() ?>
            <input type="hidden" name="state" value="<?= htmlReady($state) ?>">
            <input type="hidden" name="client_id" value="<?= htmlReady($client->getIdentifier()) ?>">
            <input type="hidden" name="auth_token" value="<?= htmlReady($authToken) ?>">
            <?= Studip\Button::create(_('Erlauben'), 'allow') ?>
        </form>
    </div>

    <p>
        <?= Avatar::getAvatar($GLOBALS['user']->id)->getImageTag(Avatar::SMALL) ?>

        <?= sprintf(
            _('Angemeldet als <strong>%s</strong> (%s)'),
            htmlReady(User::findCurrent()->getFullName()),
            htmlReady(User::findCurrent()->username)
            ) ?><br>
    </p>

    <form action="<?= URLHelper::getLink('dispatch.php/logout') ?>" method="post">
        <button class="as-link">
            <small>
                <?= sprintf(
                    _('Sind sie nicht <strong>%s</strong>, so melden Sie sich bitte ab und versuchen es erneut.'),
                    htmlReady(User::findCurrent()->getFullName())
                ) ?>
            </small>
        </button>
    </form>
</section>