From 77895bbcfc3efa8614ba011732f27d5f69faa386 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Tue, 3 Aug 2021 12:43:01 +0530 Subject: [PATCH 01/23] feat: Support for Column comparison in DatabaseQuery --- frappe/model/db_query.py | 7 ++++++- frappe/query_builder/__init__.py | 2 +- frappe/query_builder/utils.py | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py index 7ed681644f..f007c4874b 100644 --- a/frappe/model/db_query.py +++ b/frappe/model/db_query.py @@ -3,6 +3,7 @@ """build query for doclistview and return results""" import frappe.defaults +from frappe.query_builder.utils import Column import frappe.share from frappe import _ import frappe.permissions @@ -546,8 +547,12 @@ class DatabaseQuery(object): value = flt(f.value) fallback = 0 + if isinstance(f.value, Column): + quote = '"' if frappe.conf.db_type == 'postgres' else "`" + value = f"{tname}.{quote}{f.value}{quote}" + # escape value - if isinstance(value, str) and not f.operator.lower() == 'between': + elif isinstance(value, str) and not f.operator.lower() == 'between': value = f"{frappe.db.escape(value, percent=False)}" if ( diff --git a/frappe/query_builder/__init__.py b/frappe/query_builder/__init__.py index 798c34b6cc..cf39550100 100644 --- a/frappe/query_builder/__init__.py +++ b/frappe/query_builder/__init__.py @@ -1 +1 @@ -from frappe.query_builder.utils import get_query_builder +from frappe.query_builder.utils import Column, Data, get_query_builder diff --git a/frappe/query_builder/utils.py b/frappe/query_builder/utils.py index b52a3606e8..30e48f7e60 100644 --- a/frappe/query_builder/utils.py +++ b/frappe/query_builder/utils.py @@ -4,9 +4,26 @@ from typing import Any, Callable, Dict from pypika import Query import frappe + from .builder import MariaDB, Postgres +class Column: + """Represents a Database Column""" + def __init__(self, name) -> None: + self.name = name + + def __str__(self) -> str: + return self.name + +class Data: + """Represents a Data value...Specifically non column types""" + def __init__(self, name) -> None: + self.name = name + + def __str__(self) -> str: + return self.name + class db_type_is(Enum): MARIADB = "mariadb" POSTGRES = "postgres" From 85834d7a000759af5526c7b3f93d04b44bf6bc88 Mon Sep 17 00:00:00 2001 From: lukptr Date: Thu, 9 Sep 2021 15:51:15 +0700 Subject: [PATCH 02/23] feat: Able to use custom port for database load balancers --- frappe/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 38904c68d0..ff08924e72 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -235,12 +235,16 @@ def connect_replica(): from frappe.database import get_db user = local.conf.db_name password = local.conf.db_password + port = None if local.conf.different_credentials_for_replica: user = local.conf.replica_db_name password = local.conf.replica_db_password + + if local.conf.replica_db_port: + port = local.conf.replica_db_port - local.replica_db = get_db(host=local.conf.replica_host, user=user, password=password) + local.replica_db = get_db(host=local.conf.replica_host, user=user, password=password, port=port) # swap db connections local.primary_db = local.db From 1ee23859447834f166bc4dbdd05cbd2e7c8e510a Mon Sep 17 00:00:00 2001 From: lukptr <17918335+lukptr@users.noreply.github.com> Date: Thu, 9 Sep 2021 16:19:19 +0700 Subject: [PATCH 03/23] feat: custom database port for read-only replica configuration --- frappe/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index ff08924e72..64e445973f 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -235,14 +235,11 @@ def connect_replica(): from frappe.database import get_db user = local.conf.db_name password = local.conf.db_password - port = None + port = local.conf.replica_db_port if local.conf.different_credentials_for_replica: user = local.conf.replica_db_name password = local.conf.replica_db_password - - if local.conf.replica_db_port: - port = local.conf.replica_db_port local.replica_db = get_db(host=local.conf.replica_host, user=user, password=password, port=port) From 53a72f48c5482a887cefd6ef2032bb10a7fbe780 Mon Sep 17 00:00:00 2001 From: Summayya Date: Sun, 12 Sep 2021 23:17:13 +0530 Subject: [PATCH 04/23] fix(UI): freset password page --- frappe/templates/styles/card_style.css | 35 +++++++++++++++ frappe/www/update-password.html | 62 ++++++++++++++------------ 2 files changed, 69 insertions(+), 28 deletions(-) diff --git a/frappe/templates/styles/card_style.css b/frappe/templates/styles/card_style.css index cf90ff0bd5..410f6d535a 100644 --- a/frappe/templates/styles/card_style.css +++ b/frappe/templates/styles/card_style.css @@ -10,22 +10,57 @@ background-color: #fff; box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1); } + +.for-reset-password { + margin: 80px 0; +} + +.for-reset-password .page-card { + border: 0; + max-width: 450px; + margin: auto; + padding: 40px 60px; + border-radius: 10px; + box-shadow: 0px 2px 6px rgba(17, 43, 66, 0.08), 0px 1px 4px rgba(17, 43, 66, 0.1); +} + .page-card .page-card-head { padding: 10px 15px; margin: -15px; margin-bottom: 15px; border-bottom: 1px solid #d1d8dd; } + +.for-reset-password .page-card .page-card-head { + border-bottom: 0; +} + +.page-card-head h4 { + font-size: 18px; + font-weight: 600; +} + +#reset-password .form-group { + margin-bottom: 10px; +} .page-card .page-card-head .indicator { color: #36414C; font-size: 14px; } + +.sign-up-message { + margin-top: 20px; + font-size: 13px; + color: #687178; +} .page-card .page-card-head .indicator::before { margin: 0 6px 0.5px 0px; } + .page-card .btn { margin-top: 30px; } + .page-card p { font-size: 14px; } diff --git a/frappe/www/update-password.html b/frappe/www/update-password.html index d12be86d12..d336fa945d 100644 --- a/frappe/www/update-password.html +++ b/frappe/www/update-password.html @@ -1,32 +1,39 @@ {% extends "templates/web.html" %} {% block title %} {{_("Reset Password")}} {% endblock %} - +{% block head_include %} +{{ include_style('login.bundle.css') }} +{% endblock %} {% block page_content %} - -
-
- {{ _("Reset Password") if frappe.db.get_default('company') else _("Set Password")}} -
-
- -
- - +
+
+
+

{{ _("Reset Password") if frappe.db.get_default('company') else _("Set Password")}}

- - - +
+ +
+ + +
+ + +
+ {%- if not disable_signup -%} + + {%- endif -%} +
+