blob: 62a5eb3f25e90738f7c8af12ded3c014a36b7ab1 (
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
|
<form action="<?= htmlReady(Request::url()) ?>" method="post" class="default">
<input type="hidden" name="tfa-nonce" value="<?= htmlReady($__nonce) ?>">
<fieldset>
<legend><?= _('Zwei-Faktor-Authentifizierung') ?></legend>
<? if ($blocked): ?>
<?= MessageBox::warning(_('Sie haben zu viele ungültige Versuche'), [sprintf(
_('Versuchen Sie es in %u Minute(n) erneut'),
ceil((time() - $blocked) / 60)
)])->hideClose() ?>
<? else: ?>
<p><?= htmlReady($text ?: _('Bitte geben Sie ein gültiges Token ein')) ?></p>
<? if ($secret->type === 'app' && !$secret->confirmed): ?>
<?= formatReady(Config::get()->TFA_TEXT_APP) ?>
<p>
<?= _('Scannen Sie diesen Code mit Ihrer App ein und geben Sie '
. 'anschliessend ein gültiges Token ein.') ?>
</p>
<div class="tfa-app-code">
<code class="qr"><?= $secret->getProvisioningUri() ?></code>
</div>
<? elseif ($secret->type === 'app' && $secret->confirmed): ?>
<p>
<?= _('Das notwendige Token wird von der von Ihnen verknüpften App generiert.') ?>
</p>
<? elseif ($secret->type === 'email'): ?>
<p>
<?= sprintf(
_('Das notwendige Token wurde Ihnen per E-Mail zugesendet und ist %u Minuten gültig.'),
TFASecret::getValidationDuration('email') / 60
) ?>
</p>
<? endif; ?>
<div class="tfa-code-input">
<? ob_start(); ?>
<div class="tfa-code-wrapper">
<? for ($i = 0; $i < 6; $i += 1): ?>
<input required type="number" name="tfacode-input[<?= $i ?>]" value=""
max="9" pattern="[0-9]*" maxlength="1" class="no-hint"
<? if ($i === 0) echo 'autofocus'; ?>>
<? endfor; ?>
</div>
<?php
// We need to strip all whitespace between html nodes so that they have no
// visual gap between them.
$__content = ob_get_clean();
$__content = trim($__content);
$__content = preg_replace('/>\s+</', '><', $__content);
print $__content;
?>
</div>
<? if ($global): ?>
<label>
<input type="checkbox" name="tfa-trusted" value="1">
<? if ($duration > 0): ?>
<?= sprintf(
ngettext(
'Diesem Gerät für %u Tag vertrauen.',
'Diesem Gerät für %u Tage vertrauen.',
$duration
),
$duration
) ?>
<? else: ?>
<?= _('Diesem Gerät dauerhaft vertrauen') ?>
<? endif; ?>
</label>
<? endif; ?>
</fieldset>
<footer>
<?= Studip\Button::createAccept(_('Prüfen')) ?>
<? if ($global && !$secret->confirmed): ?>
<?= Studip\LinkButton::createCancel(
_('Abbrechen'),
URLHelper::getURL('dispatch.php/tfa/abort')
) ?>
<? endif; ?>
</footer>
<? endif; ?>
</form>
|