From 1155e226aba052721cd8c969da40ad1dce2684e9 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Sat, 2 Mar 2024 16:34:15 +0100 Subject: [PATCH] Rename --- README.md | 3 ++- app.py | 16 ++++++++-------- i18n/en_US.yaml | 8 ++++++-- lotosa.py => latosa.py | 2 +- static/main.css | 3 +++ templates/index.html | 9 +++++++++ 6 files changed, 29 insertions(+), 12 deletions(-) rename lotosa.py => latosa.py (98%) diff --git a/README.md b/README.md index 7b41c25..681c16a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# lotosa +# LaToSa +LaToSa is a backend for [SaToSa](https://github.com/IdentityPython/SATOSA) and allows you to use local accounts for authentication diff --git a/app.py b/app.py index cc29f7e..28ebdac 100644 --- a/app.py +++ b/app.py @@ -6,7 +6,7 @@ from flask import (Flask, flash, redirect, render_template, request, from flask_login import LoginManager, login_required, login_user, logout_user from forms import LoginForm -from lotosa import LoToSa +from latosa import LaToSa from user import User app = Flask(__name__) @@ -19,12 +19,12 @@ app.config.update( login_manager = LoginManager() login_manager.init_app(app) -lotosa = LoToSa(app) +latosa = LaToSa(app) @login_manager.user_loader def load_user(user_id) -> Union[User, None]: - for user in lotosa.get_users(): + for user in latosa.get_users(): if user.uid == user_id: return user return None @@ -32,24 +32,24 @@ def load_user(user_id) -> Union[User, None]: @app.route('/', methods=['GET', 'POST']) def index(): - i18n = lotosa.get_i18n(request) + i18n = latosa.get_i18n(request) form = LoginForm() if request.method == 'POST': username = form.username.data password = form.password.data - user = lotosa.login_user(username, password) + user = latosa.login_user(username, password) if user: login_user(user) - flash('Logged in successfully.') + flash(i18n['login']['success']) return redirect(url_for('admin')) - flash('Logged in faled, please try again.') + flash(i18n['login']['failed']) return render_template('index.html', i18n=i18n, form=form) @app.route('/admin', methods=['GET']) @login_required def admin(): - i18n = lotosa.get_i18n(request) + i18n = latosa.get_i18n(request) return render_template('admin.html', i18n=i18n) diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index 233cd9e..7a95726 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -1,5 +1,9 @@ head: - title: LoToSA + title: LaToSa body: - h1: LoToSA + h1: Local Auth to SAML + +login: + failed: Login failed, please try again. + success: Login successful. diff --git a/lotosa.py b/latosa.py similarity index 98% rename from lotosa.py rename to latosa.py index 973b55a..b74d4ae 100644 --- a/lotosa.py +++ b/latosa.py @@ -7,7 +7,7 @@ from flask import Flask, request from user import User -class LoToSa: +class LaToSa: def __init__(self, app: Flask): self.users = [ diff --git a/static/main.css b/static/main.css index e69de29..391b722 100644 --- a/static/main.css +++ b/static/main.css @@ -0,0 +1,3 @@ +ul { + list-style-type: none; +} diff --git a/templates/index.html b/templates/index.html index 706f1b1..f9f545d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,6 +13,15 @@ + {% with messages = get_flashed_messages() %} + {% if messages %} + + {% endif %} + {% endwith %} {% block content %}

{{i18n.body.h1}}