Skip to content

Commit 7376795

Browse files
committed
[MIG] auth_oauth_autologin: Migration to 18.0
1 parent 53b9029 commit 7376795

File tree

12 files changed

+211
-95
lines changed

12 files changed

+211
-95
lines changed

auth_oauth_autologin/README.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
====================
62
Auth Oauth Autologin
73
====================
@@ -17,17 +13,17 @@ Auth Oauth Autologin
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
24-
:target: https://github.com/OCA/server-auth/tree/17.0/auth_oauth_autologin
20+
:target: https://github.com/OCA/server-auth/tree/18.0/auth_oauth_autologin
2521
:alt: OCA/server-auth
2622
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/server-auth-17-0/server-auth-17-0-auth_oauth_autologin
23+
:target: https://translation.odoo-community.org/projects/server-auth-18-0/server-auth-18-0-auth_oauth_autologin
2824
:alt: Translate me on Weblate
2925
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=18.0
3127
:alt: Try me on Runboat
3228

3329
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -79,7 +75,7 @@ Bug Tracker
7975
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
8076
In case of trouble, please check there if your issue has already been reported.
8177
If you spotted it first, help us to smash it by providing a detailed and welcomed
82-
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_oauth_autologin%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
78+
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_oauth_autologin%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
8379

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

@@ -91,6 +87,13 @@ Authors
9187

9288
* ACSONE SA/NV
9389

90+
Contributors
91+
------------
92+
93+
- `Trobz <https://trobz.com>`__:
94+
95+
- Tuan Nguyen <tuanna@trobz.com>
96+
9497
Maintainers
9598
-----------
9699

@@ -112,6 +115,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
112115

113116
|maintainer-sbidoul|
114117

115-
This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/17.0/auth_oauth_autologin>`_ project on GitHub.
118+
This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/18.0/auth_oauth_autologin>`_ project on GitHub.
116119

117120
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

auth_oauth_autologin/__manifest__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
"name": "Auth Oauth Autologin",
66
"summary": """
77
Automatically redirect to the OAuth provider for login""",
8-
"version": "17.0.1.0.0",
8+
"version": "18.0.1.0.0",
99
"license": "AGPL-3",
1010
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
1111
"maintainers": ["sbidoul"],
1212
"website": "https://github.com/OCA/server-auth",
1313
"depends": ["auth_oauth"],
1414
"data": ["views/auth_oauth_provider.xml"],
1515
"demo": [],
16-
"assets": {"web.assets_frontend": ["auth_oauth_autologin/static/src/js/*.js"]},
1716
}

auth_oauth_autologin/controllers/main.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ def _autologin_link(self):
2020
if len(providers) == 1:
2121
return providers[0].get("auth_link")
2222

23-
@http.route(
24-
"/auth/auto_login_redirect_link",
25-
type="json",
26-
auth="none",
27-
)
28-
def auto_login_redirect_link(self, *args, **kwargs):
29-
redirect = kwargs.get("redirect")
30-
if self._autologin_disabled(redirect):
31-
return False
32-
request.params["redirect"] = redirect
33-
auth_link = self._autologin_link()
34-
return auth_link
23+
@http.route()
24+
def web_login(self, *args, **kw):
25+
# Odoo 18 uses deep links, so the full URL path is available to the server.
26+
# We can perform a server-side redirect if autologin is enabled.
27+
if request.httprequest.method == "GET" and not self._autologin_disabled(
28+
request.httprequest.url
29+
):
30+
auth_link = self._autologin_link()
31+
if auth_link:
32+
return request.redirect(auth_link, 303, local=False)
33+
return super().web_login(*args, **kw)

auth_oauth_autologin/i18n/auth_oauth_autologin.pot

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 17.0\n"
7+
"Project-Id-Version: Odoo Server 18.0+e\n"
88
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-11-21 04:41+0000\n"
10+
"PO-Revision-Date: 2025-11-21 04:41+0000\n"
911
"Last-Translator: \n"
1012
"Language-Team: \n"
1113
"MIME-Version: 1.0\n"

auth_oauth_autologin/i18n/it.po

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 17.0\n"
7+
"Project-Id-Version: Odoo Server 18.0+e\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"PO-Revision-Date: 2025-06-17 08:26+0000\n"
10-
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11-
"Language-Team: none\n"
12-
"Language: it\n"
9+
"POT-Creation-Date: 2025-11-21 04:32+0000\n"
10+
"PO-Revision-Date: 2025-11-21 04:32+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
1313
"MIME-Version: 1.0\n"
1414
"Content-Type: text/plain; charset=UTF-8\n"
1515
"Content-Transfer-Encoding: \n"
16-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17-
"X-Generator: Weblate 5.10.4\n"
16+
"Plural-Forms: \n"
1817

1918
#. module: auth_oauth_autologin
2019
#: model:ir.model.fields,field_description:auth_oauth_autologin.field_auth_oauth_provider__autologin
@@ -27,10 +26,10 @@ msgid ""
2726
"If exactly one enabled provider has this checked, the login screen redirects"
2827
" to the OAuth provider."
2928
msgstr ""
30-
"Se un solo provider abilitato ha selezionato questa opzione, la schermata di "
31-
"accesso reindirizza al provider OAuth."
29+
"Se un solo provider abilitato ha selezionato questa opzione, la schermata di"
30+
" accesso reindirizza al provider OAuth."
3231

3332
#. module: auth_oauth_autologin
3433
#: model:ir.model,name:auth_oauth_autologin.model_auth_oauth_provider
3534
msgid "OAuth2 provider"
36-
msgstr "Provider OAuth2"
35+
msgstr "Fornitore OAuth2"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Trobz](https://trobz.com):
2+
- Tuan Nguyen \<<tuanna@trobz.com>\>
-9.23 KB
Binary file not shown.

auth_oauth_autologin/static/description/index.html

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Auth Oauth Autologin</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="auth-oauth-autologin">
364+
<h1 class="title">Auth Oauth Autologin</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="auth-oauth-autologin">
370-
<h1>Auth Oauth Autologin</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:435818516444b963cf87e2c9fdb478ece9d33f578cde5960255b34cb5ffd84cd
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-auth/tree/17.0/auth_oauth_autologin"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-auth-17-0/server-auth-17-0-auth_oauth_autologin"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-auth&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-auth/tree/18.0/auth_oauth_autologin"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-auth-18-0/server-auth-18-0-auth_oauth_autologin"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-auth&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>This modules implements an automatic redirection to the configured OAuth
379374
provider login page, if there is one and only one enabled. This
380375
effectively makes the regular Odoo login screen invisible in normal
@@ -387,13 +382,14 @@ <h1>Auth Oauth Autologin</h1>
387382
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
388383
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
389384
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
390-
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
385+
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
386+
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
391387
</ul>
392388
</li>
393389
</ul>
394390
</div>
395391
<div class="section" id="configuration">
396-
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
392+
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
397393
<p>Configure OAuth providers in Settings &gt; Users and Companies, and make
398394
sure there is one and only one that has both the enabled and automatic
399395
login flags set.</p>
@@ -413,29 +409,38 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
413409
the user back in Odoo, in a fresh session.</p>
414410
</div>
415411
<div class="section" id="usage">
416-
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
412+
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
417413
<p>When configured, the Odoo login page redirects to the OAuth identify
418414
provider for authentication and login in Odoo. To access the regular
419415
Odoo login page, visit <tt class="docutils literal"><span class="pre">/web/login?no_autologin</span></tt>.</p>
420416
</div>
421417
<div class="section" id="bug-tracker">
422-
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
418+
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
423419
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-auth/issues">GitHub Issues</a>.
424420
In case of trouble, please check there if your issue has already been reported.
425421
If you spotted it first, help us to smash it by providing a detailed and welcomed
426-
<a class="reference external" href="https://github.com/OCA/server-auth/issues/new?body=module:%20auth_oauth_autologin%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
422+
<a class="reference external" href="https://github.com/OCA/server-auth/issues/new?body=module:%20auth_oauth_autologin%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
427423
<p>Do not contact contributors directly about support or help with technical issues.</p>
428424
</div>
429425
<div class="section" id="credits">
430-
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
426+
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
431427
<div class="section" id="authors">
432-
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
428+
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
433429
<ul class="simple">
434430
<li>ACSONE SA/NV</li>
435431
</ul>
436432
</div>
433+
<div class="section" id="contributors">
434+
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
435+
<ul class="simple">
436+
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
437+
<li>Tuan Nguyen &lt;<a class="reference external" href="mailto:tuanna&#64;trobz.com">tuanna&#64;trobz.com</a>&gt;</li>
438+
</ul>
439+
</li>
440+
</ul>
441+
</div>
437442
<div class="section" id="maintainers">
438-
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
443+
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
439444
<p>This module is maintained by the OCA.</p>
440445
<a class="reference external image-reference" href="https://odoo-community.org">
441446
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -445,11 +450,10 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
445450
promote its widespread use.</p>
446451
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
447452
<p><a class="reference external image-reference" href="https://github.com/sbidoul"><img alt="sbidoul" src="https://github.com/sbidoul.png?size=40px" /></a></p>
448-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/17.0/auth_oauth_autologin">OCA/server-auth</a> project on GitHub.</p>
453+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/18.0/auth_oauth_autologin">OCA/server-auth</a> project on GitHub.</p>
449454
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
450455
</div>
451456
</div>
452457
</div>
453-
</div>
454458
</body>
455459
</html>

auth_oauth_autologin/static/src/js/web_login.esm.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_oauth_auto_login

0 commit comments

Comments
 (0)