From 26260e6619abdeb2d8bfb7c7972468c43eef8699 Mon Sep 17 00:00:00 2001 From: vishwajeet-13 Date: Fri, 8 May 2026 00:19:24 +0530 Subject: [PATCH 1/5] feat: validate phone field --- buzz/api/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/buzz/api/__init__.py b/buzz/api/__init__.py index 06e636e..590d074 100644 --- a/buzz/api/__init__.py +++ b/buzz/api/__init__.py @@ -317,6 +317,14 @@ def get_event_booking_data(event_route: str) -> dict: return data +def validate_custom_fields(custom_fields_data: dict, phone_field_map: dict) -> None: + for field_name, field_value in custom_fields_data.items(): + if field_value and field_name in phone_field_map: + frappe.utils.validate_phone_number_with_country_code( + str(field_value), phone_field_map[field_name] + ) + + @frappe.whitelist(allow_guest=True) # nosemgrep: frappe-semgrep-rules.rules.security.guest-whitelisted-method def process_booking( attendees: list[dict], @@ -416,6 +424,16 @@ def process_booking( "fieldtype": field_def["fieldtype"], }, ) + + phone_fields = frappe.db.get_all( + "Buzz Custom Field", + filters={"event": event, "enabled": 1, "fieldtype": "Phone"}, + fields=["fieldname", "label"], + ) + phone_map = {cf["fieldname"]: cf["label"] for cf in phone_fields} + + if booking_custom_fields: + validate_custom_fields(booking_custom_fields, phone_map) if event_doc.category == "Webinars": for attendee in attendees: if not (attendee.get("last_name") or "").strip(): @@ -440,6 +458,8 @@ def process_booking( ) custom_fields = attendee.get("custom_fields", {}) + if custom_fields: + validate_custom_fields(custom_fields, phone_map) attendee_row = { "first_name": first_name, "last_name": last_name, From 84cdc576c7f1495cd3bacebc4dde760aca1abab3 Mon Sep 17 00:00:00 2001 From: vishwajeet-13 Date: Fri, 8 May 2026 11:19:56 +0530 Subject: [PATCH 2/5] fix: remove in booking level --- buzz/api/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/buzz/api/__init__.py b/buzz/api/__init__.py index 590d074..06fc381 100644 --- a/buzz/api/__init__.py +++ b/buzz/api/__init__.py @@ -432,8 +432,6 @@ def process_booking( ) phone_map = {cf["fieldname"]: cf["label"] for cf in phone_fields} - if booking_custom_fields: - validate_custom_fields(booking_custom_fields, phone_map) if event_doc.category == "Webinars": for attendee in attendees: if not (attendee.get("last_name") or "").strip(): From 2e5321f1c98aec0e1de62350ab1e6e4d7e60fc4e Mon Sep 17 00:00:00 2001 From: vishwajeet-13 Date: Thu, 14 May 2026 19:55:06 +0530 Subject: [PATCH 3/5] feat: frappe version 16 compatiblity --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5dac320..1f57dcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,4 +60,4 @@ indent-style = "tab" # docstring-code-format = true [tool.bench.frappe-dependencies] -frappe = ">=16.0.0-dev,<18.0.0" \ No newline at end of file +frappe = ">=16.0.0,<18.0.0" \ No newline at end of file From bcd376a7d118560155ee96b03d4033c246e40818 Mon Sep 17 00:00:00 2001 From: Rahul Agrawal <12agrawalrahul@gmail.com> Date: Thu, 21 May 2026 16:30:03 +0530 Subject: [PATCH 4/5] feat: allow users to configure login required per form --- buzz/api/forms.py | 5 ++--- .../doctype/buzz_event_form/buzz_event_form.json | 10 +++++++++- buzz/events/doctype/buzz_event_form/buzz_event_form.py | 1 + dashboard/src/components/LoginDialog.vue | 5 +---- dashboard/src/data/session.ts | 4 +--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/buzz/api/forms.py b/buzz/api/forms.py index 8eb95ff..72c7b28 100644 --- a/buzz/api/forms.py +++ b/buzz/api/forms.py @@ -154,9 +154,8 @@ def get_auto_set_fields(form_doctype: str): def get_custom_form_data(event_route: str, form_route: str) -> dict: event_doc, form_row = validate_custom_form(event_route, form_route) form_doctype = form_row.form_doctype - allow_guest_submission = sbool(event_doc.allow_guest_booking) - if not allow_guest_submission and frappe.session.user == "Guest": + if sbool(form_row.login_required) and frappe.session.user == "Guest": frappe.throw(_("Please log in to submit this form"), frappe.AuthenticationError) event_data = { @@ -239,7 +238,7 @@ def submit_custom_form( event_doc, form_row = validate_custom_form(event_route, form_route) form_doctype = form_row.form_doctype - if not event_doc.allow_guest_booking and frappe.session.user == "Guest": + if sbool(form_row.login_required) and frappe.session.user == "Guest": frappe.throw(_("Please login to submit this form"), frappe.AuthenticationError) if form_row.auto_close_at and get_datetime(form_row.auto_close_at) < now_datetime(): diff --git a/buzz/events/doctype/buzz_event_form/buzz_event_form.json b/buzz/events/doctype/buzz_event_form/buzz_event_form.json index b1b7662..39e5d3a 100644 --- a/buzz/events/doctype/buzz_event_form/buzz_event_form.json +++ b/buzz/events/doctype/buzz_event_form/buzz_event_form.json @@ -10,6 +10,7 @@ "route", "copy_to_clipboard", "publish", + "login_required", "column_break_main", "auto_close_at", "section_break_success", @@ -42,6 +43,13 @@ "in_list_view": 1, "label": "Publish" }, + { + "default": "0", + "fieldname": "login_required", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Login Required?" + }, { "fieldname": "column_break_main", "fieldtype": "Column Break" @@ -92,7 +100,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2026-04-14 19:33:17.779162", + "modified": "2026-05-21 16:15:20.760801", "modified_by": "Administrator", "module": "Events", "name": "Buzz Event Form", diff --git a/buzz/events/doctype/buzz_event_form/buzz_event_form.py b/buzz/events/doctype/buzz_event_form/buzz_event_form.py index 9f9245b..24e95ce 100644 --- a/buzz/events/doctype/buzz_event_form/buzz_event_form.py +++ b/buzz/events/doctype/buzz_event_form/buzz_event_form.py @@ -16,6 +16,7 @@ class BuzzEventForm(Document): closed_message: DF.SmallText | None closed_title: DF.Data | None form_doctype: DF.Link + login_required: DF.Check parent: DF.Data parentfield: DF.Data parenttype: DF.Data diff --git a/dashboard/src/components/LoginDialog.vue b/dashboard/src/components/LoginDialog.vue index 7e818f4..4ca22c3 100644 --- a/dashboard/src/components/LoginDialog.vue +++ b/dashboard/src/components/LoginDialog.vue @@ -237,7 +237,7 @@ import { userResource } from "@/data/user"; import { Button, Dialog, FormControl, createResource } from "frappe-ui"; import { computed, defineComponent, h, ref, watch } from "vue"; -const { is_open, close, on_success_callback } = useLoginDialog(); +const { is_open, close } = useLoginDialog(); const current_view = ref("login"); const error_message = ref(""); @@ -330,9 +330,6 @@ function handleLogin() { session.user = session.login.data?.user || document.cookie.match(/user_id=([^;]+)/)?.[1]; close(); - if (on_success_callback.value) { - on_success_callback.value(); - } }, onError(error) { error_message.value = error.messages?.[0] || __("Invalid email or password."); diff --git a/dashboard/src/data/session.ts b/dashboard/src/data/session.ts index e00fcf6..df826e9 100644 --- a/dashboard/src/data/session.ts +++ b/dashboard/src/data/session.ts @@ -27,9 +27,7 @@ export const session = reactive({ } }, onSuccess() { - userResource.reload() - session.user = sessionUser() - session.login.reset() + window.location.reload() }, }), logout: createResource({ From 864bd45c29bda6d36068bd1b70d925d415623795 Mon Sep 17 00:00:00 2001 From: Rahul Agrawal <12agrawalrahul@gmail.com> Date: Fri, 22 May 2026 17:43:42 +0530 Subject: [PATCH 5/5] fix: make Sign Up btn in modal more prominent --- dashboard/src/components/LoginDialog.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/src/components/LoginDialog.vue b/dashboard/src/components/LoginDialog.vue index 4ca22c3..c1b510d 100644 --- a/dashboard/src/components/LoginDialog.vue +++ b/dashboard/src/components/LoginDialog.vue @@ -94,7 +94,7 @@ {{ __("Don't have an account?") }}