feat(minor): redirect after login from NotPermittedPage (#18946)

* redirect after login from NotPermittedPage
This commit is contained in:
PeterG 2022-11-21 15:11:18 +05:45 committed by GitHub
parent e594c35a3a
commit 4ec7d2dbba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,9 +14,10 @@ class NotPermittedPage(TemplatePage):
return True
def render(self):
action = f"/login?redirect-to={frappe.request.path}"
frappe.local.message_title = _("Not Permitted")
frappe.local.response["context"] = dict(
indicator_color="red", primary_action="/login", primary_label=_("Login"), fullpage=True
indicator_color="red", primary_action=action, primary_label=_("Login"), fullpage=True
)
self.set_standard_path("message")
return super().render()