Merge branch 'develop' into add_pdf_backend_hook

This commit is contained in:
Suraj Shetty 2025-03-06 13:18:09 +05:30 committed by GitHub
commit 902cb722ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 11 deletions

View file

@ -1120,8 +1120,9 @@ class DatabaseQuery:
tbl = tbl[4:-1]
frappe.throw(_("Please select atleast 1 column from {0} to sort/group").format(tbl))
if function in blacklisted_sql_functions:
frappe.throw(_("Cannot use {0} in order/group by").format(field))
# Check if the function is used anywhere in the field
if any(func in function for func in blacklisted_sql_functions):
frappe.throw(_("Cannot use {0} in order/group by").format(function))
def add_limit(self):
if self.limit_page_length:

View file

@ -259,7 +259,7 @@ class Recorder:
def dump(self):
if not self._recording:
return
profiler_output = self.process_profiler()
profiler_output = self.process_profiler() or ""
request_data = {
"uuid": self.uuid,
@ -277,7 +277,7 @@ class Recorder:
request_data["calls"] = self.calls
request_data["headers"] = self.headers
request_data["form_dict"] = self.form_dict
request_data["profile"] = profiler_output
request_data["profile"] = "".join(profiler_output.splitlines(keepends=True)[:200])
frappe.cache.hset(RECORDER_REQUEST_HASH, self.uuid, request_data)
if self.config.record_sql:

View file

@ -99,6 +99,23 @@
</div>
{% endfor %}
</div>
{% if login_with_frappe_cloud_url %}
<div class="social-login-buttons">
<div class="login-button-wrapper">
<a href="{{ login_with_frappe_cloud_url }}"
class="btn btn-block btn-default btn-sm btn-login-option btn-login-with-frappe-cloud">
<svg class="mr-2" width="24" height="20" viewBox="0 5 23 23" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M24.5011 14.1124C23.3954 12.4873 21.532 11.5477 19.594 11.6747C18.7616 10.1384 17.2211 9.12267 15.4198 9.0084C14.1651 8.93222 12.8979 9.3766 11.9165 10.24C11.2456 10.8367 10.7611 11.5223 10.463 12.2968C10.289 12.7539 9.89151 13.0459 9.46912 13.0459H6.5V15.5852H9.46912C10.9226 15.5852 12.2271 14.6584 12.7737 13.2237C12.9227 12.8301 13.1712 12.4873 13.5439 12.1571C14.0284 11.7255 14.662 11.4969 15.2583 11.535C16.1528 11.5985 16.7863 12.0175 17.1839 12.538C17.6063 13.0205 17.8423 13.7696 17.979 14.5187C18.774 14.2902 19.6437 14.0997 20.476 14.2394C21.1593 14.3536 21.7929 14.7218 22.2525 15.2678C22.327 15.3567 22.4016 15.4456 22.4637 15.5471C23.06 16.4232 23.1718 17.5024 22.7743 18.5689C22.414 19.5592 21.0847 20.4607 19.9791 20.4607H11.3326C10.1524 20.4607 9.18339 19.5592 9.03432 18.4038H6.54969C6.71119 20.9686 8.78585 23 11.3326 23H19.9915C22.1283 23 24.3769 21.451 25.1098 19.4704C25.7931 17.6167 25.5695 15.6614 24.5135 14.0997L24.5011 14.1124Z"
fill="currentColor" />
</svg>
{{ _("Login with Frappe Cloud") }}</a>
</div>
</div>
{% endif %}
{% if login_with_email_link %}
<div class="login-with-email-link social-login-buttons">
<div class="login-button-wrapper">

View file

@ -23,7 +23,8 @@ no_cache = True
def get_context(context):
from frappe.integrations.frappe_providers.frappecloud_billing import is_fc_site
from frappe.integrations.frappe_providers.frappecloud_billing import get_site_login_url
from frappe.utils.frappecloud import on_frappecloud
redirect_to = frappe.local.request.args.get("redirect-to")
redirect_to = sanitize_redirect(redirect_to)
@ -39,12 +40,6 @@ def get_context(context):
frappe.local.flags.redirect_location = redirect_to
raise frappe.Redirect
if is_fc_site():
from frappe.integrations.frappe_providers.frappecloud_billing import get_site_login_url
frappe.local.flags.redirect_location = get_site_login_url()
raise frappe.Redirect
context.no_header = True
context.for_test = "login.html"
context["title"] = "Login"
@ -117,6 +112,11 @@ def get_context(context):
context["login_label"] = f" {_('or')} ".join(login_label)
context["login_with_email_link"] = frappe.get_system_settings("login_with_email_link")
context["login_with_frappe_cloud_url"] = (
f"{get_site_login_url()}?site={frappe.local.site}"
if on_frappecloud() and frappe.conf.get("fc_communication_secret")
else None
)
return context