Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions buzz/api/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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():
Expand Down
10 changes: 9 additions & 1 deletion buzz/events/doctype/buzz_event_form/buzz_event_form.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"route",
"copy_to_clipboard",
"publish",
"login_required",
"column_break_main",
"auto_close_at",
"section_break_success",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions buzz/events/doctype/buzz_event_form/buzz_event_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions dashboard/src/components/LoginDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand Down Expand Up @@ -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.");
Expand Down
4 changes: 1 addition & 3 deletions dashboard/src/data/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export const session = reactive({
}
},
onSuccess() {
userResource.reload()
session.user = sessionUser()
session.login.reset()
window.location.reload()
},
}),
logout: createResource({
Expand Down
Loading