diff --git a/.gitignore b/.gitignore index 89bf24f..5651e58 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ library/data/*.csv library/data/*.seg library/data/MAIN_WRITELOCK library/files/*.pdf +settings_development.toml diff --git a/library/app.py b/library/app.py index 8cfbd58..7049399 100644 --- a/library/app.py +++ b/library/app.py @@ -80,6 +80,8 @@ def index_books(filename: str, image_folder: str): def settings_from_file(): settings = {} + if os.path.isfile("settings_development.toml"): + with open("settings_development.toml", "rb") as settings_file: + return tomllib.load(settings_file) with open("settings.toml", "rb") as settings_file: - settings = tomllib.load(settings_file) - return settings + return tomllib.load(settings_file) diff --git a/library/application/user/forgotpassword.py b/library/application/user/forgotpassword.py index eda9882..c15187e 100644 --- a/library/application/user/forgotpassword.py +++ b/library/application/user/forgotpassword.py @@ -11,7 +11,7 @@ from sqlalchemy.exc import ( InterfaceError, InvalidRequestError, ) -from usermodel import User +from application.models.usermodel import User def ForgotPassword(mail): diff --git a/library/application/user/loginuser.py b/library/application/user/loginuser.py index 4966680..e07009a 100644 --- a/library/application/user/loginuser.py +++ b/library/application/user/loginuser.py @@ -2,7 +2,7 @@ from flask import abort, flash, redirect, render_template, request, url_for from flask_bcrypt import check_password_hash from flask_login import login_user from forms.loginform import LoginForm -from usermodel import User +from application.models.usermodel import User def LoginUser(): @@ -26,4 +26,4 @@ def LoginUser(): return render_template("login.html", loginform=loginform) except Exception as e: flash(e, "danger") - return render_template("login.html", loginform=loginform) + return render_template("user/login.html", loginform=loginform) diff --git a/library/application/user/registeruser.py b/library/application/user/registeruser.py index d12ae9d..4381053 100644 --- a/library/application/user/registeruser.py +++ b/library/application/user/registeruser.py @@ -10,7 +10,7 @@ from sqlalchemy.exc import ( InterfaceError, InvalidRequestError, ) -from usermodel import User +from application.models.usermodel import User from werkzeug.routing import BuildError @@ -62,4 +62,4 @@ def RegisterUser(): db.session.rollback() registerform.email.errors.append("Unknown error occured!") flash("An error occured !", "danger") - return render_template("register.html", registerform=registerform) + return render_template("user/register.html", registerform=registerform) diff --git a/library/application/user/resetpassword.py b/library/application/user/resetpassword.py index 9ee436d..67a7cf1 100644 --- a/library/application/user/resetpassword.py +++ b/library/application/user/resetpassword.py @@ -12,7 +12,7 @@ from sqlalchemy.exc import ( InterfaceError, InvalidRequestError, ) -from usermodel import User +from application.models.usermodel import User from werkzeug.routing import BuildError diff --git a/library/page.py b/library/page.py index a0f04df..91c3ce0 100644 --- a/library/page.py +++ b/library/page.py @@ -9,6 +9,11 @@ import os import bcrypt from app import create_app, login_manager from application.csvparser import CsvParser +from application.user.loginuser import LoginUser +from application.user.registeruser import RegisterUser +from application.user.forgotpassword import ForgotPassword +from application.user.resetpassword import ResetPassword + from flask import Blueprint, redirect, render_template, request, session from flask_wtf.csrf import CSRFProtect, CSRFError from flask_login import ( @@ -24,6 +29,8 @@ from requests import get from search import search from werkzeug.utils import secure_filename + + APP = create_app() csrf = CSRFProtect() csrf.init_app(APP) diff --git a/library/static/css/style.css b/library/static/css/style.css index ace4389..a5b6d78 100644 --- a/library/static/css/style.css +++ b/library/static/css/style.css @@ -179,3 +179,12 @@ a:active { text-decoration: none; } margin: 3em 1em 1em 1em; } } +div#auth_buttons{ + position: fixed; + top: 0.5em; + right: 0.5em; + display:flex; + flex-direction: row; + justify-content: center; + align-items: center; +} diff --git a/library/templates/index.html b/library/templates/index.html index 8d46aca..db76139 100644 --- a/library/templates/index.html +++ b/library/templates/index.html @@ -4,6 +4,26 @@ +
+ {% if not current_user.is_authenticated %} +
+ + + +
+
+ + + +
+ {% else %} +
+ + + +
+ {% endif %} +
{% for id, pubinfo in publications.items() %}