From bf58ac96671ac38032746d3debe9b3b478f5b46c Mon Sep 17 00:00:00 2001 From: Alaguraj0361 Date: Mon, 12 Oct 2026 12:51:12 +0530 Subject: [PATCH] fix(auth): set csrf=False on /web/login to prevent session expired errors after restart --- addons/dine360_dashboard/controllers/main.py | 6 ++++-- addons/dine360_dashboard_website/controllers/main.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/dine360_dashboard/controllers/main.py b/addons/dine360_dashboard/controllers/main.py index dfcdf92..d0130ec 100644 --- a/addons/dine360_dashboard/controllers/main.py +++ b/addons/dine360_dashboard/controllers/main.py @@ -31,11 +31,13 @@ class SafeStats(dict): return self.__missing__(key) if default is None else default class CustomHome(Home): - @http.route('/web/login', type='http', auth="public") + @http.route('/web/login', type='http', auth="public", csrf=False, sitemap=False) def web_login(self, *args, **kw): response = super(CustomHome, self).web_login(*args, **kw) if request.params.get('login_success') and request.session.uid: - return request.redirect('/') + redirect = kw.get('redirect') or request.params.get('redirect') + if not redirect: + return request.redirect('/') return response def get_dashboard_context(active_page='dashboard'): diff --git a/addons/dine360_dashboard_website/controllers/main.py b/addons/dine360_dashboard_website/controllers/main.py index ca9d8a0..f4ae699 100644 --- a/addons/dine360_dashboard_website/controllers/main.py +++ b/addons/dine360_dashboard_website/controllers/main.py @@ -6,11 +6,13 @@ from odoo.addons.website.controllers.main import Website from odoo.addons.dine360_dashboard.controllers.main import render_dashboard class CustomHomeWebsite(Home): - @http.route('/web/login', type='http', auth="public", website=True) + @http.route('/web/login', type='http', auth="public", website=True, csrf=False, sitemap=False) def web_login(self, *args, **kw): response = super(CustomHomeWebsite, self).web_login(*args, **kw) if request.params.get('login_success') and request.session.uid: - return request.redirect('/') + redirect = kw.get('redirect') or request.params.get('redirect') + if not redirect: + return request.redirect('/') return response class ImageHomeWebsite(Website):