From 5df0507fe3c97a4a4544f48380830f2af3d673ae Mon Sep 17 00:00:00 2001
From: Benjamin Willig
Date: Wed, 20 Mar 2024 15:53:10 +0100
Subject: [PATCH] [MIG] auth_oauth_autlogin: Migration to 16.0
---
auth_oauth_autologin/README.rst | 12 ++++++------
auth_oauth_autologin/__manifest__.py | 7 +++++--
auth_oauth_autologin/controllers/main.py | 6 ++++--
auth_oauth_autologin/static/description/index.html | 9 +++++----
auth_oauth_autologin/static/src/js/web_login.js | 13 +++++--------
.../odoo/addons/auth_oauth_autologin | 1 +
setup/auth_oauth_autologin/setup.py | 6 ++++++
7 files changed, 32 insertions(+), 22 deletions(-)
create mode 120000 setup/auth_oauth_autologin/odoo/addons/auth_oauth_autologin
create mode 100644 setup/auth_oauth_autologin/setup.py
diff --git a/auth_oauth_autologin/README.rst b/auth_oauth_autologin/README.rst
index a5fa072c72..027b48ad65 100644
--- a/auth_oauth_autologin/README.rst
+++ b/auth_oauth_autologin/README.rst
@@ -7,7 +7,7 @@ Auth Oauth Autologin
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:9395fedcb46bfe2a9f26dd469563a46cb045fac746acb65aae1d5ab75e0638eb
+ !! source digest: sha256:b39eab35ecf9f611b79515461079fc6ba8a002fc432515c31009b6c70eff01c3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,13 +17,13 @@ Auth Oauth Autologin
: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/13.0/auth_oauth_autologin
+ :target: https://github.com/OCA/server-auth/tree/16.0/auth_oauth_autologin
: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-13-0/server-auth-13-0-auth_oauth_autologin
+ :target: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_oauth_autologin
: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=13.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -73,7 +73,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -106,6 +106,6 @@ Current `maintainer `__:
|maintainer-sbidoul|
-This module is part of the `OCA/server-auth `_ project on GitHub.
+This module is part of the `OCA/server-auth `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/auth_oauth_autologin/__manifest__.py b/auth_oauth_autologin/__manifest__.py
index 7f9568428a..e6150962af 100644
--- a/auth_oauth_autologin/__manifest__.py
+++ b/auth_oauth_autologin/__manifest__.py
@@ -5,12 +5,15 @@
"name": "Auth Oauth Autologin",
"summary": """
Automatically redirect to the OAuth provider for login""",
- "version": "13.0.1.1.0",
+ "version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"maintainers": ["sbidoul"],
"website": "https://github.com/OCA/server-auth",
"depends": ["auth_oauth"],
- "data": ["views/assets.xml", "views/auth_oauth_provider.xml"],
+ "data": ["views/auth_oauth_provider.xml"],
"demo": [],
+ "assets": {
+ "web.assets_frontend": ["auth_oauth_autologin/static/src/js/web_login.js"]
+ },
}
diff --git a/auth_oauth_autologin/controllers/main.py b/auth_oauth_autologin/controllers/main.py
index d81162565e..2bc8aafa61 100644
--- a/auth_oauth_autologin/controllers/main.py
+++ b/auth_oauth_autologin/controllers/main.py
@@ -12,7 +12,7 @@
class OAuthAutoLogin(OAuthLogin):
def _autologin_disabled(self, redirect):
url = urlparse(redirect)
- params = dict(parse_qsl(url.query))
+ params = dict(parse_qsl(url.query, keep_blank_values=True))
return "no_autologin" in params or "oauth_error" in params or "error" in params
def _autologin_link(self):
@@ -21,7 +21,9 @@ def _autologin_link(self):
return providers[0].get("auth_link")
@http.route(
- "/auth/auto_login_redirect_link", type="json", auth="none",
+ "/auth/auto_login_redirect_link",
+ type="json",
+ auth="none",
)
def auto_login_redirect_link(self, *args, **kwargs):
redirect = kwargs.get("redirect")
diff --git a/auth_oauth_autologin/static/description/index.html b/auth_oauth_autologin/static/description/index.html
index 2f7dba138b..343b7b94bd 100644
--- a/auth_oauth_autologin/static/description/index.html
+++ b/auth_oauth_autologin/static/description/index.html
@@ -1,3 +1,4 @@
+
@@ -366,9 +367,9 @@ Auth Oauth Autologin
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:9395fedcb46bfe2a9f26dd469563a46cb045fac746acb65aae1d5ab75e0638eb
+!! source digest: sha256:b39eab35ecf9f611b79515461079fc6ba8a002fc432515c31009b6c70eff01c3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This modules implements an automatic redirection to the configured OAuth
provider login page, if there is one and only one enabled. This effectively
makes the regular Odoo login screen invisible in normal circumstances.
@@ -415,7 +416,7 @@
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
diff --git a/auth_oauth_autologin/static/src/js/web_login.js b/auth_oauth_autologin/static/src/js/web_login.js
index 836f404694..3c7b11735c 100644
--- a/auth_oauth_autologin/static/src/js/web_login.js
+++ b/auth_oauth_autologin/static/src/js/web_login.js
@@ -1,15 +1,12 @@
-odoo.define("auth_oauth_autologin.redirect", function(require) {
+odoo.define("auth_oauth_autologin.redirect", function (require) {
"use strict";
- var publicWidget = require("web.public.widget");
+ const publicWidget = require("web.public.widget");
- publicWidget.registry.authOauthAutologinWidget = publicWidget.Widget.extend({
+ publicWidget.registry.login.include({
selector: ".oe_login_form",
- /**
- * @override
- */
- start: function() {
+ start: function () {
const def = this._super.apply(this, arguments);
let url = window.location.href;
if (url.includes("/web/login")) {
@@ -20,7 +17,7 @@ odoo.define("auth_oauth_autologin.redirect", function(require) {
params: {
redirect: url,
},
- }).then(function(result) {
+ }).then(function (result) {
if (result) {
window.location = result;
}
diff --git a/setup/auth_oauth_autologin/odoo/addons/auth_oauth_autologin b/setup/auth_oauth_autologin/odoo/addons/auth_oauth_autologin
new file mode 120000
index 0000000000..2910cd9e90
--- /dev/null
+++ b/setup/auth_oauth_autologin/odoo/addons/auth_oauth_autologin
@@ -0,0 +1 @@
+../../../../auth_oauth_autologin
\ No newline at end of file
diff --git a/setup/auth_oauth_autologin/setup.py b/setup/auth_oauth_autologin/setup.py
new file mode 100644
index 0000000000..28c57bb640
--- /dev/null
+++ b/setup/auth_oauth_autologin/setup.py
@@ -0,0 +1,6 @@
+import setuptools
+
+setuptools.setup(
+ setup_requires=['setuptools-odoo'],
+ odoo_addon=True,
+)