Skip to content

Commit

Permalink
Implementación de Autenticación y Seguridad Mejorada
Browse files Browse the repository at this point in the history
  • Loading branch information
livrasand committed Oct 14, 2024
1 parent e439b58 commit 5391b7f
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 192 deletions.
321 changes: 169 additions & 152 deletions app.py

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions templates/activate_2fa.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="es">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PM738JMZ22"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-PM738JMZ22');
</script>

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet" />

<!-- link icons -->
<script src="https://kit.fontawesome.com/59784df54a.js" crossorigin="anonymous"></script>
<title>Activar 2FA - Kingdom Hall Attendant</title>
</head>
<body>
<a class="styles_module_wtLink__f24f44fb styles_module_wtLink_Utility__f24f44fb styles_module_wtLink_Default__f24f44fb styles_module_wtLink_Light__f24f44fb styles_module_wtBodyMedium__f24f44fb styles_module_logoLink__8a4eaeaf styles_module_dark__8a4eaeaf Nav_navTopLogo__LpSb7" href="https://www.getkha.org/" >
<img src="{{ url_for('static', filename='images/313010479-cfab1393-8ae1-4b3f-9895-7022272f1262.jpeg') }}" style="width:50px;border-radius: 25%;"></a>

<nav id="wt-top-navigation-n_XG1HoVuvytluhKz8jtu" class="styles_module_container__05ad3f7f Nav_globalNavContainer__BzVy1"><div class="styles_module_menuGroup__a75ea064"><div class="styles_module_menuBar__a75ea064 styles_module_buttonsSection__33aa50d8"><a class="styles_module_wtLink__f24f44fb styles_module_wtLink_Navigational__f24f44fb styles_module_wtLink_Neutral__f24f44fb styles_module_wtLink_Light__f24f44fb styles_module_wtLabelMediumSemi__f24f44fb styles_module_navLink__0a0665ea" href="/login" data-prevent-routing="true" data-testid="Iniciar sesión">Iniciar sesión</a><a class="styles_module_wtButton__38691ab2 styles_module_wtButton_XSmall__38691ab2 styles_module_wtButtonPrimaryNeutral_Light__38691ab2" href="/signup" data-testid="Registrarse">Registrarse</a></div></div></nav>
<div class="container">
<h1>Active la Autenticación 2FA</h1>
{% if qr_code_path %}
<p style="max-width: 450px;">Escanea el código QR utilizando Google Authenticator, Microsoft Authenticator o cualquier aplicación de autenticación de tu elección compatible con códigos de un solo uso (TOTP) para activar la verificación en dos pasos (2FA) y mejorar la seguridad de tu cuenta:</p>
<img src="{{ url_for('static', filename='qrcodes/' + qr_code_path.split('\\')[-1]) }}" alt="Código QR" style="width: 150px;">
<p>Después de escanear, <a href="/login" style="margin-top: 20px;color: rgb(41, 126, 255); cursor: pointer;">Inicia sesión nuevamente</a>.</p>
{% else %}
<p>Error al generar el código QR. Por favor, inténtalo de nuevo.</p>
{% endif %}
</div>
</body>
</html>
19 changes: 0 additions & 19 deletions templates/auth.html

This file was deleted.

18 changes: 0 additions & 18 deletions templates/authorize.html

This file was deleted.

2 changes: 1 addition & 1 deletion templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<!-- link icons -->
<script src="https://kit.fontawesome.com/59784df54a.js" crossorigin="anonymous"></script>
<title>Kingdom Hall Attendant</title>
<title>Inicia sesión - Kingdom Hall Attendant</title>
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="preload" href="https://github.githubassets.com/assets/mona-sans-d1bf285e9b9b.woff2" as="font" type="font/woff2" crossorigin="">

Expand Down
4 changes: 3 additions & 1 deletion templates/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@

<body>
<div class="container" style="max-width: 450px;">
<a href="https://www.getkha.org/" class="logo-link">
<a href="/" class="logo-link">
<img src="{{ url_for('static', filename='images/313010479-cfab1393-8ae1-4b3f-9895-7022272f1262.jpeg') }}" style="width:100px;border-radius: 25%;">
</a>

<span class="github-head" style="margin-top: 45px;">
¡Vuelve pronto!
</span>

<p>O vuelve a <a href="{{ url_for('login') }}" style="color: rgb(41, 126, 255); cursor: pointer;font-size: 16px;font-weight: 500;line-height: 24px;letter-spacing: -0.4px;">Iniciar sesión</a></p>
</div>
</body>

Expand Down
8 changes: 7 additions & 1 deletion templates/sent.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@
<h2 style="color:rgb(20, 20, 21);font-size: 32px;line-height: 40px;font-weight: 700;letter-spacing: -0.4px;">¡Su enlace mágico está en camino!</h2>
<p style="color: rgb(50, 51, 52);margin-top: 32px;margin-bottom: 0px;font-size: 20px;line-height: 28px;font-weight: 500;letter-spacing: -0.4px;margin-bottom: 24px;">Lo hemos enviado a <strong>{{ email }}</strong></p>

{% if qr_code_path %}
<h2 style="color:rgb(20, 20, 21);font-size: 16px;line-height: 20px;font-weight: 500;letter-spacing: -0.4px;margin-bottom: 30px;">Escanea el código QR utilizando Google Authenticator, Microsoft Authenticator o cualquier aplicación de autenticación de tu elección compatible con códigos de un solo uso (TOTP) para activar la verificación en dos pasos (2FA) y mejorar la seguridad de tu cuenta.</h2>
<img src="{{ url_for('static', filename='qrcodes/' + qr_code_path.split('\\')[-1]) }}" alt="Código QR" style="width: 150px;">
{% endif %}


<p style="color: rgb(50, 51, 52);margin-top: 50px;font-size: 16px;font-weight: 500;line-height: 24px;letter-spacing: -0.4px;margin-bottom: 0;">Será redirigido desde el enlace del correo electrónico. Puede cerrar esta pestaña sin problemas.</p>
<a href="/sing-up-system" style="color: rgb(41, 126, 255); cursor: pointer;font-size: 16px;font-weight: 500;line-height: 24px;letter-spacing: -0.4px;">Más información</a> <span style="color: rgb(50, 51, 52);font-size: 16px;font-weight: 500;line-height: 24px;letter-spacing: -0.4px;">sobre nuestro sistema de inicio de sesión.</span>
<a href="{{ url_for('log_in_system') }}" style="color: rgb(41, 126, 255); cursor: pointer;font-size: 16px;font-weight: 500;line-height: 24px;letter-spacing: -0.4px;">Más información</a> <span style="color: rgb(50, 51, 52);font-size: 16px;font-weight: 500;line-height: 24px;letter-spacing: -0.4px;">sobre nuestro sistema de inicio de sesión.</span>
</div>
</div>
</body>
Expand Down
42 changes: 42 additions & 0 deletions templates/verify_2fa.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PM738JMZ22"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-PM738JMZ22');
</script>

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet" />

<!-- link icons -->
<script src="https://kit.fontawesome.com/59784df54a.js" crossorigin="anonymous"></script>
<title>Verificar 2FA - Kingdom Hall Attendant</title>
</head>
<body>
<a class="styles_module_wtLink__f24f44fb styles_module_wtLink_Utility__f24f44fb styles_module_wtLink_Default__f24f44fb styles_module_wtLink_Light__f24f44fb styles_module_wtBodyMedium__f24f44fb styles_module_logoLink__8a4eaeaf styles_module_dark__8a4eaeaf Nav_navTopLogo__LpSb7" href="https://www.getkha.org/" >
<img src="{{ url_for('static', filename='images/313010479-cfab1393-8ae1-4b3f-9895-7022272f1262.jpeg') }}" style="width:50px;border-radius: 25%;"></a>

<nav id="wt-top-navigation-n_XG1HoVuvytluhKz8jtu" class="styles_module_container__05ad3f7f Nav_globalNavContainer__BzVy1"><div class="styles_module_menuGroup__a75ea064"><div class="styles_module_menuBar__a75ea064 styles_module_buttonsSection__33aa50d8"><a class="styles_module_wtLink__f24f44fb styles_module_wtLink_Navigational__f24f44fb styles_module_wtLink_Neutral__f24f44fb styles_module_wtLink_Light__f24f44fb styles_module_wtLabelMediumSemi__f24f44fb styles_module_navLink__0a0665ea" href="/login" data-prevent-routing="true" data-testid="Iniciar sesión">Iniciar sesión</a><a class="styles_module_wtButton__38691ab2 styles_module_wtButton_XSmall__38691ab2 styles_module_wtButtonPrimaryNeutral_Light__38691ab2" href="/signup" data-testid="Registrarse">Registrarse</a></div></div></nav>
<div class="container">
<h1>Código de verificación:</h1>
<form action="{{ url_for('verify_2fa') }}" method="POST">
<div class="input-box">
<input type="text" id="codigo" name="codigo" required autocomplete="off">
</div>
<center>
<button type="submit">Verificar</button>
</center>
</form>
<a href="{{ url_for('login') }}" style="margin-top: 15px;color: rgb(41, 126, 255); cursor: pointer;">Regresar al inicio de sesión</a>
</div>
</body>
</html>

0 comments on commit 5391b7f

Please sign in to comment.