aboutsummaryrefslogtreecommitdiff
path: root/templates/loginform.php
blob: edbd565f82336e8e4ee2648732f82b23dbc7a608 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
# Lifter010: TODO
use Studip\Button, Studip\LinkButton;

// Get background images (this should be resolved differently since mobile
// browsers might still download the desktop background)
if (!match_route('web_migrate.php')) {
    $bg_desktop = LoginBackground::getRandomPicture('desktop');
    if ($bg_desktop) {
        $bg_desktop = $bg_desktop->getURL();
    } else {
        $bg_desktop = URLHelper::getURL('pictures/loginbackgrounds/1.jpg');
    }
    $bg_mobile = LoginBackground::getRandomPicture('mobile');
    if ($bg_mobile) {
        $bg_mobile = $bg_mobile->getURL();
    } else {
        $bg_mobile = URLHelper::getURL('pictures/loginbackgrounds/2.jpg');
    }
} else {
    $bg_desktop = URLHelper::getURL('pictures/loginbackgrounds/1.jpg');
    $bg_mobile = URLHelper::getURL('pictures/loginbackgrounds/2.jpg');
}
?>
<main id="content">
    <div id="background-desktop" style="background: url(<?= $bg_desktop ?>) no-repeat top left/cover;"></div>
    <div id="background-mobile" style="background: url(<?= $bg_mobile ?>) no-repeat top left/cover;"></div>
    <? if ($loginerror): ?>
        <!-- failed login code -->
        <?= MessageBox::error(_('Bei der Anmeldung trat ein Fehler auf!'), [
            $error_msg,
            sprintf(
                _('Bitte wenden Sie sich bei Problemen an: <a href="mailto:%1$s">%1$s</a>'),
                $GLOBALS['UNI_CONTACT']
            )
        ]) ?>
    <? endif; ?>

    <?= implode('', PageLayout::getMessages()); ?>

    <div id="loginbox">
        <form class="default" name="login" method="post" action="<?= URLHelper::getLink(Request::url(), ['cancel_login' => NULL]) ?>">
            <header>
                <h1 style="margin: 0; padding-bottom:10px;">
                    <?=_('Herzlich willkommen!')?>
                </h1>
            </header>
            <section>
                <label>
                    <?= _('Benutzername:') ?>
                    <input type="text" <?= mb_strlen($uname) ? '' : 'autofocus' ?>
                           id="loginname" name="loginname"
                           value="<?= htmlReady($uname) ?>"
                           size="20"
                           autocorrect="off" autocapitalize="off">
                </label>
            </section>
            <section>
                <label for="password">
                    <?= _('Passwort:') ?>
                    <input type="password" <?= mb_strlen($uname) ? 'autofocus' : '' ?>
                           id="password" name="password" size="20">
                </label>
            </section>
                <?= CSRFProtection::tokenTag() ?>
                <input type="hidden" name="login_ticket" value="<?=Seminar_Session::get_ticket();?>">
                <input type="hidden" name="resolution"  value="">
                <input type="hidden" name="device_pixel_ratio" value="1">
                <?= Button::createAccept(_('Anmelden'), _('Login')); ?>
                <?= LinkButton::create(_('Abbrechen'), URLHelper::getURL('index.php', ['cancel_login' => 1], true)) ?>
        </form>

        <div>
            <? if (Config::get()->ENABLE_REQUEST_NEW_PASSWORD_BY_USER && in_array('Standard', $GLOBALS['STUDIP_AUTH_PLUGIN'])): ?>
                <a href="<?= URLHelper::getLink('dispatch.php/new_password?cancel_login=1') ?>">
            <? else: ?>
                <a href="mailto:<?= $GLOBALS['UNI_CONTACT'] ?>?subject=<?= rawurlencode('Stud.IP Passwort vergessen - '.Config::get()->UNI_NAME_CLEAN) ?>&amp;body=<?= rawurlencode('Ich habe mein Passwort vergessen. Bitte senden Sie mir ein Neues.\nMein Nutzername: ' . htmlReady($uname) . "\n") ?>">
            <? endif; ?>
                    <?= _('Passwort vergessen') ?>
                </a>
            <? if ($self_registration_activated): ?>
                /
                <a href="<?= URLHelper::getLink('register1.php?cancel_login=1') ?>">
                    <?= _('Registrieren') ?>
                </a>
            <? endif; ?>
        </div>
    </div>
</main>

<script type="text/javascript" language="javascript">
//<![CDATA[
$(function () {
    $('form[name=login]').submit(function () {
        $('input[name=resolution]', this).val( screen.width + 'x' + screen.height );
        $('input[name=device_pixel_ratio]').val(window.devicePixelRatio || 1);
    });
});
// -->
</script>