From 679c61531f9df3444ea407f2d2fcc99f5cea82b3 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 20 Dec 2021 11:07:29 +0530 Subject: [PATCH] fix: renamed hook and moved template --- frappe/templates/signup.html | 22 ++++++++++++++++++++++ frappe/www/login.html | 29 +---------------------------- frappe/www/login.py | 13 ++++++++++--- 3 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 frappe/templates/signup.html diff --git a/frappe/templates/signup.html b/frappe/templates/signup.html new file mode 100644 index 0000000000..87865ba092 --- /dev/null +++ b/frappe/templates/signup.html @@ -0,0 +1,22 @@ +
+
+
+ + +
+
+ + +
+
+
+ + + +
+
diff --git a/frappe/www/login.html b/frappe/www/login.html index b938885a1a..927f451965 100644 --- a/frappe/www/login.html +++ b/frappe/www/login.html @@ -131,34 +131,7 @@
{{ logo_section() }} {%- if not disable_signup -%} - - {% if custom_signup_form %} - {{ custom_signup_form }} - {% else %} - - {% endif %} - + {{ signup_form_template }} {%- else -%}
{{_("Signup Disabled")}} diff --git a/frappe/www/login.py b/frappe/www/login.py index 2f7c96702c..5b241132f4 100644 --- a/frappe/www/login.py +++ b/frappe/www/login.py @@ -12,6 +12,7 @@ from frappe.utils.password import get_decrypted_password from frappe.utils.html_utils import get_icon_html from frappe.integrations.oauth2_logins import decoder_compat from frappe.website.utils import get_home_page +from frappe.utils.jinja import guess_is_path no_cache = True @@ -40,9 +41,15 @@ def get_context(context): context["app_name"] = (frappe.db.get_single_value('Website Settings', 'app_name') or frappe.get_system_settings("app_name") or _("Frappe")) - custom_signup = frappe.get_hooks("custom_signup_form") - if custom_signup and len(custom_signup) and custom_signup[0]: - context["custom_signup_form"] = frappe.get_template(custom_signup[0]).render() + signup_form_template = frappe.get_hooks("signup_form_template") + if signup_form_template and len(signup_form_template) and signup_form_template[0]: + path = signup_form_template[0] + if not guess_is_path(path): + path = frappe.get_attr(signup_form_template[0])() + else: + path = "frappe/templates/signup.html" + if path: + context["signup_form_template"] = frappe.get_template(path).render() providers = [i.name for i in frappe.get_all("Social Login Key", filters={"enable_social_login":1}, order_by="name")] for provider in providers: