Coverage for seedboxsync/front/views/auth/logout.py: 100%
10 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
1#
2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr>
3#
4# For the full copyright and license information, please view the LICENSE
5# file that was distributed with this source code.
6#
7"""SeedboxSync Flask view for authentication handling."""
9from flask import redirect, url_for
10from flask_login import logout_user
11from werkzeug.wrappers.response import Response
12from seedboxsync.front.login_manager import login_required
13from seedboxsync.front.views import bp_auth as bp
16@bp.route("/logout")
17@login_required # type: ignore[untyped-decorator]
18def logout() -> str | Response:
19 """
20 Log out the current user and redirect to the application homepage.
22 Clears the current session through Flask-Login before executing the redirect.
24 Returns:
25 str | Response: HTTP redirect response targeting the homepage view.
26 """
27 logout_user()
28 return redirect(url_for("frontend.homepage"))