Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
Adrià Vilanova Martínez | 5af8651 | 2023-12-02 20:44:16 +0100 | [diff] [blame] | 2 | /* |
| 3 | * hores |
| 4 | * Copyright (c) 2023 Adrià Vilanova Martínez |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Affero General Public License as |
| 8 | * published by the Free Software Foundation, either version 3 of the |
| 9 | * License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Affero General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Affero General Public |
| 17 | * License along with this program. |
| 18 | * If not, see http://www.gnu.org/licenses/. |
| 19 | */ |
| 20 | |
Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 21 | require_once("core.php"); |
| 22 | |
| 23 | if (security::isAllowed(security::ADMIN)) { |
| 24 | security::go("home.php"); |
| 25 | } elseif ($conf["enableWorkerUI"] && security::isAllowed(security::WORKER)) { |
| 26 | security::go("workerhome.php"); |
| 27 | } |
| 28 | ?> |
| 29 | <!DOCTYPE html> |
| 30 | <html> |
| 31 | <head> |
| 32 | <title><?php echo $conf["appName"]; ?></title> |
| 33 | <?php visual::includeHead(); ?> |
| 34 | <link rel="stylesheet" href="css/index.css"> |
| 35 | <script src="js/index.js"></script> |
| 36 | </head> |
| 37 | <?php visual::printBodyTag(); ?> |
| 38 | <div class="login mdl-shadow--4dp"> |
| 39 | <h2><?=security::htmlsafe($conf["appName"])?></h2> |
| 40 | <form action="signin.php" method="POST" autocomplete="off" id="formulario"> |
| 41 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 42 | <input class="mdl-textfield__input" type="text" name="username" id="username" autocomplete="off" data-required> |
| 43 | <label class="mdl-textfield__label" for="username">Nombre de usuario</label> |
| 44 | </div> |
| 45 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 46 | <input class="mdl-textfield__input" type="password" name="password" id="password" autocomplete="off" data-required> |
| 47 | <label class="mdl-textfield__label" for="password">Contraseña</label> |
| 48 | </div> |
| 49 | <p><button type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Iniciar sesión</button><?php if ($conf["enableRecovery"]) { ?> <button id="recoverybtn" class="mdl-button mdl-js-button mdl-js-ripple-effect">Recuperar contraseña</button><?php } ?></p> |
| 50 | </form> |
| 51 | </div> |
| 52 | |
| 53 | <?php |
| 54 | if ($conf["enableRecovery"]) { |
| 55 | ?> |
| 56 | <dialog class="mdl-dialog" id="recovery"> |
| 57 | <form action="dostartrecovery.php" method="POST" enctype="multipart/form-data"> |
| 58 | <h4 class="mdl-dialog__title">Recuperar contraseña</h4> |
| 59 | <div class="mdl-dialog__content"> |
| 60 | <p>Para recuperarla, introduce los siguientes datos:</p> |
| 61 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 62 | <input class="mdl-textfield__input" type="email" name="email" id="email" autocomplete="off" data-required> |
| 63 | <label class="mdl-textfield__label" for="email">Correo electrónico</label> |
| 64 | </div> |
| 65 | <br> |
| 66 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 67 | <input class="mdl-textfield__input" type="text" name="dni" id="dni" autocomplete="off" data-required> |
| 68 | <label class="mdl-textfield__label" for="dni">DNI/NIF con letras mayúsculas</label> |
| 69 | </div> |
| 70 | </div> |
| 71 | <div class="mdl-dialog__actions"> |
| 72 | <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Recuperar</button> |
| 73 | <button onclick="event.preventDefault(); document.querySelector('#recovery').close();" class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button> |
| 74 | </div> |
| 75 | </form> |
| 76 | </dialog> |
| 77 | <?php |
| 78 | } |
| 79 | |
| 80 | visual::smartSnackbar([ |
| 81 | ["wrong", "Usuario y/o contraseña incorrecto."], |
| 82 | ["empty", "Por favor, rellena todos los campos."], |
| 83 | ["logout", "Has cerrado la sesión correctamente."], |
| 84 | ["unsupported", "Todavía no puedes acceder como trabajador a la interfaz de trabajador."], |
| 85 | ["unexpected", "Ha ocurrido un error inesperado."], |
| 86 | ["recovery", "Si los datos que has proporcionado son correctos, se ha enviado un mensaje al correo electrónico indicado para proceder con la recuperación."], |
| 87 | ["recovery2failed", "No se puede proceder con la recuperación, seguramente porque el enlace de recuperación ha expirado."], |
| 88 | ["recoverycompleted", "Se ha cambiado la contraseña correctamente. Puedes iniciar sesión ahora con la nueva contraseña."], |
| 89 | ["secondfactorwrongcode", "El código de verificación no es correcto."], |
| 90 | ["signinthrottled", "No se ha podido verificar si el usuario y contraseña son correctos. Por favor, prueba de iniciar sesión de nuevo en unos instantes."] |
| 91 | ]); |
| 92 | ?> |
| 93 | </body> |
| 94 | </html> |