blob: 9b5ecd19ff3522b982a3b27a553b3999b6afcde4 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3
4if (security::userType() !== security::UNKNOWN || !isset($_SESSION["firstfactorid"]) || !secondFactor::isEnabled($_SESSION["firstfactorid"])) {
5 security::goHome();
6}
7
8secondFactor::checkAvailability();
9
10$hasSecurityKeys = secondFactor::hasSecurityKeys($_SESSION["firstfactorid"]);
11?>
12<!DOCTYPE html>
13<html>
14<head>
15 <title><?php echo $conf["appName"]; ?></title>
16 <?php visual::includeHead(); ?>
17 <link rel="stylesheet" href="css/index.css">
18 <style>
19 .login {
20 max-width: 500px;
21 }
22
23 .mdl-tabs__tab-bar {
24 height: auto;
25 }
26
27 .mdl-tabs__tab {
28 overflow: visible;
29 height: 100%;
30 line-height: 1.5;
31 padding-top: 14px;
32 padding-bottom: 14px;
33 }
34
35 .mdl-tabs__panel {
36 padding-top: 16px;
37 }
38
39 #content .mdl-spinner {
40 margin: 16px auto;
41 }
42
43 #webauthn {
44 text-align: center;
45 }
46 </style>
47</head>
48<?php visual::printBodyTag(); ?>
49 <div class="login mdl-shadow--4dp">
50 <h2>Verificación en dos pasos</h2>
51 <div id="content">
52 <div class="mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
53 <div class="mdl-tabs__tab-bar">
54 <a href="#totp" class="mdl-tabs__tab<?=($hasSecurityKeys ? "" : " is-active")?>">Código de verificación</a>
55 <?php if ($hasSecurityKeys) { ?><a href="#webauthn" class="mdl-tabs__tab is-active">Llave de seguridad</a><?php } ?>
56 </div>
57
58 <div class="mdl-tabs__panel<?=($hasSecurityKeys ? "" : " is-active")?>" id="totp">
59 <p>Introduce el código de verificación generado por tu aplicación para móviles.</p>
60
61 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
62 <input class="mdl-textfield__input" type="text" name="code" id="code" autocomplete="off" inputmode="numeric" pattern="[0-9]{6}" data-required>
63 <label class="mdl-textfield__label" for="code">Código de verificación</label>
64 </div>
65 <br>
66 <button id="verify" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Verificar</button>
67 </div>
68
69 <?php
70 if ($hasSecurityKeys) {
71 ?>
72 <div class="mdl-tabs__panel is-active" id="webauthn">
73 <p>Cuando estés listo para autenticarte, pulsa el siguiente botón:</p>
74
75 <button id="startwebauthn" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Usar llave de seguridad</button>
76 </div>
77 <?php
78 }
79 ?>
80 </div>
81 </div>
82 </div>
83
84 <div class="mdl-snackbar mdl-js-snackbar">
85 <div class="mdl-snackbar__text"></div>
86 <button type="button" class="mdl-snackbar__action"></button>
87 </div>
88
89 <script src="js/common_webauthn.js"></script>
90 <script src="js/secondfactor.js"></script>
91</body>
92</html>