From 2ba5b63b6534d7058d86c2a09f5968d8e7454f94 Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Thu, 7 Nov 2024 16:30:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=20select?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Auth/__init__.py | 4 ++-- App/Auth/sql/auth.sql | 2 +- App/Auth/templates/auth.html | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/App/Auth/__init__.py b/App/Auth/__init__.py index 4d4ad1e..6e92707 100644 --- a/App/Auth/__init__.py +++ b/App/Auth/__init__.py @@ -9,14 +9,14 @@ def auth(): return render_template('auth.html') else: data = request.form.to_dict() - data['table'] = 'internal_users' if 'internal' in data else 'external_users' + print(data) auth_data = auth_model(data) if auth_data.status: session.update({ 'login': auth_data.result[0]['login'], + 'access_user': data['access'], 'role': auth_data.result[0]['user_role'], 'db_config': current_app.config['db_config'], - 'access_user': 'in' if 'internal' in data else 'ext', 'permanent': True }) return redirect(url_for('index')) diff --git a/App/Auth/sql/auth.sql b/App/Auth/sql/auth.sql index 0902578..4fb90bf 100644 --- a/App/Auth/sql/auth.sql +++ b/App/Auth/sql/auth.sql @@ -1,4 +1,4 @@ -SELECT login, user_role FROM $table +SELECT login, user_role FROM $access WHERE login = '$login' AND password = '$password' LIMIT 1; \ No newline at end of file diff --git a/App/Auth/templates/auth.html b/App/Auth/templates/auth.html index 5ce4b62..3bed3b2 100644 --- a/App/Auth/templates/auth.html +++ b/App/Auth/templates/auth.html @@ -13,10 +13,15 @@
-

Внутренний пользователь

+

+ Уровень доступа: + +

-