Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions auth_admin_passkey_totp_mail_enforce/tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def test_01_web_login_with_user_password_and_2fa(self):

# Reset session (login page displayed)
response = self.url_open("/web/session/logout")
self.assertEqual(response.request.path_url, "/web/login")
# Response url changed by module auth_logout_redirect
self.assertIn(
response.request.path_url, ["/web/login", "/web/logout_successful"]
)

# Enable passkey and set auth_admin_passkey_ignore_totp = True
config["auth_admin_passkey_password"] = self.sysadmin_passkey
Expand All @@ -76,7 +79,10 @@ def test_02_web_login_with_passkey_and_2fa(self):

# Reset session (login page displayed)
response = self.url_open("/web/session/logout")
self.assertEqual(response.request.path_url, "/web/login")
# Response url changed by module auth_logout_redirect
self.assertIn(
response.request.path_url, ["/web/login", "/web/logout_successful"]
)

# Enable passkey and set auth_admin_passkey_ignore_totp = True
config["auth_admin_passkey_password"] = self.sysadmin_passkey
Expand Down
108 changes: 108 additions & 0 deletions auth_logout_redirect/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
===============
Logout Redirect
===============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3303bcf2401ebc8059631f92c8cdefdbdea276313f93086ffeeacc571856e32a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
:target: https://github.com/OCA/server-auth/tree/17.0/auth_logout_redirect
:alt: OCA/server-auth
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-auth-17-0/server-auth-17-0-auth_logout_redirect
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a page displayed when users log out.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This is useful when a method redirects log in automatically, but an
option to stay logged out is still needed. Automatic redirection is
offered in the modules auth_oauth_autologin and auth_saml.

Configuration
=============

No configuration is needed when this module is used.

Usage
=====

The changes are visible once logged out of the application.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_logout_redirect%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* XCG SAS

Contributors
------------

- XCG SAS, part of `Orbeet <https://orbeet.io/>`__

- Vincent Hatakeyama vincent.hatakeyama@orbeet.io

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-vincent-hatakeyama| image:: https://github.com/vincent-hatakeyama.png?size=40px
:target: https://github.com/vincent-hatakeyama
:alt: vincent-hatakeyama

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-vincent-hatakeyama|

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/17.0/auth_logout_redirect>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions auth_logout_redirect/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import controllers
22 changes: 22 additions & 0 deletions auth_logout_redirect/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2025 XCG SAS
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Logout Redirect",
"summary": "Redirect on logout",
"version": "17.0.1.0.0",
"development_status": "Alpha",
"category": "Tools",
"website": "https://github.com/OCA/server-auth",
"author": "XCG SAS, Odoo Community Association (OCA)",
"maintainers": ["vincent-hatakeyama"],
"license": "AGPL-3",
"application": False,
"installable": True,
"preloadable": True,
"depends": [
"web",
],
"data": [
"views/webclient_templates.xml",
],
}
5 changes: 5 additions & 0 deletions auth_logout_redirect/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2025 XCG SAS
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import home
from . import session
15 changes: 15 additions & 0 deletions auth_logout_redirect/controllers/home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright © 2025 XCG SAS
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import http


class Home(http.Controller):
@http.route(
"/web/logout_successful", type="http", auth="none", website=False, sitemap=False
)
def logout_successful(self):
"""Landing page after successful logout.
Log out user if they were still logged in."""
if http.request.session.uid:
return http.request.redirect("/web/session/logout", 303)
return http.request.render("auth_logout_redirect.logout_successful")
15 changes: 15 additions & 0 deletions auth_logout_redirect/controllers/session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright © 2025 XCG SAS
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import http

from odoo.addons.web.controllers.session import Session


class SessionLogout(Session):
# If it was possible the default redirect would be changed.
# That does not work when http_routing is installed or any module that would change
# logout.
@http.route("/web/session/logout", type="http", auth="none")
def logout(self, redirect="/web"): # pylint: disable=unused-argument
return super().logout("web/logout_successful")
3 changes: 3 additions & 0 deletions auth_logout_redirect/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions auth_logout_redirect/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No configuration is needed when this module is used.
3 changes: 3 additions & 0 deletions auth_logout_redirect/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is useful when a method redirects log in automatically,
but an option to stay logged out is still needed.
Automatic redirection is offered in the modules auth_oauth_autologin and auth_saml.
2 changes: 2 additions & 0 deletions auth_logout_redirect/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- XCG SAS, part of [Orbeet](https://orbeet.io/)
- Vincent Hatakeyama <vincent.hatakeyama@orbeet.io>
1 change: 1 addition & 0 deletions auth_logout_redirect/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds a page displayed when users log out.
1 change: 1 addition & 0 deletions auth_logout_redirect/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The changes are visible once logged out of the application.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading