From b77810322d721572d17a8fed014550b8c263130a Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 15 Nov 2024 20:23:59 +0530 Subject: [PATCH] fix: added billing.py to handle csrf token issue --- frappe/www/billing.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 frappe/www/billing.py diff --git a/frappe/www/billing.py b/frappe/www/billing.py new file mode 100644 index 0000000000..4dfd736ac6 --- /dev/null +++ b/frappe/www/billing.py @@ -0,0 +1,22 @@ +import frappe +from frappe.utils import cint + +no_cache = 1 + + +def get_context(context): + frappe.db.commit() # nosemgrep + context = frappe._dict() + context.boot = get_boot() + return context + + +def get_boot(): + return frappe._dict( + { + "site_name": frappe.local.site, + "read_only_mode": frappe.flags.read_only, + "csrf_token": frappe.sessions.get_csrf_token(), + "setup_complete": cint(frappe.get_system_settings("setup_complete")), + } + )