From 938014de66a51a2becf97a006a644b5a0ec10f61 Mon Sep 17 00:00:00 2001 From: Haimonti Date: Sun, 3 Nov 2024 14:32:28 -0500 Subject: [PATCH] Create logout.py --- upFAR/backend/logout.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 upFAR/backend/logout.py diff --git a/upFAR/backend/logout.py b/upFAR/backend/logout.py new file mode 100644 index 0000000..9d7312d --- /dev/null +++ b/upFAR/backend/logout.py @@ -0,0 +1,12 @@ +from flask import Blueprint, url_for, redirect +from flask_login import LoginManager, login_required, logout_user + +logout = Blueprint('logout', __name__, template_folder='../frontend') +login_manager = LoginManager() +login_manager.init_app(logout) + +@logout.route('/logout') +@login_required +def show(): + logout_user() + return redirect(url_for('login.show') + '?success=logged-out')