Skip to content

Commit c473ebb

Browse files
committed
fix(meeting): throw user to login page if the meeting isn't for guests
1 parent f21a833 commit c473ebb

3 files changed

Lines changed: 60 additions & 4 deletions

File tree

frontend/components.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ declare module "vue" {
5454
LucideHand: typeof import("~icons/lucide/hand")["default"];
5555
LucideHome: typeof import("~icons/lucide/home")["default"];
5656
LucideLoader: typeof import("~icons/lucide/loader")["default"];
57-
LucideMessageCircle: typeof import(
58-
"~icons/lucide/message-circle",
59-
)["default"];
6057
LucideMessageSquare: typeof import(
6158
"~icons/lucide/message-square",
6259
)["default"];

frontend/src/pages/Meeting.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@
161161
</template>
162162

163163
<script setup>
164-
import { Button, Spinner, createDocumentResource } from "frappe-ui";
164+
import {
165+
Button,
166+
Spinner,
167+
createDocumentResource,
168+
frappeRequest,
169+
} from "frappe-ui";
165170
import { computed, onMounted, onUnmounted, provide, ref, watch } from "vue";
166171
import { useRoute, useRouter } from "vue-router";
167172
@@ -665,6 +670,29 @@ onMounted(async () => {
665670
}
666671
}
667672
673+
// Check meeting access for unauthenticated users
674+
if (!session.isLoggedIn) {
675+
try {
676+
const accessData = await frappeRequest({
677+
url: "/api/method/meet.api.meeting.check_meeting_access",
678+
params: {
679+
meeting_id: meetingId.value,
680+
},
681+
});
682+
683+
if (!accessData.allow_guest) {
684+
router.push({
685+
name: "Login",
686+
query: { next: `/${meetingId.value}` },
687+
});
688+
return;
689+
}
690+
} catch (error) {
691+
console.error("Failed to check meeting access:", error);
692+
return;
693+
}
694+
}
695+
668696
// Check authentication and handle guest sessions
669697
if (!session.isLoggedIn) {
670698
const guestId = sessionStorage.getItem("guest_id");

meet/api/meeting.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,3 +651,34 @@ def update_meeting_settings(meeting_id: str, allow_guest: int, meeting_type: str
651651
"updated_fields": updated_fields,
652652
"message": "Meeting settings updated successfully",
653653
}
654+
655+
656+
@frappe.whitelist(allow_guest=True)
657+
@rate_limit(limit=10, seconds=5 * 60)
658+
def check_meeting_access(meeting_id: str) -> dict:
659+
"""
660+
Check if a meeting allows guest access without authentication
661+
662+
Args:
663+
meeting_id: The meeting ID to check
664+
665+
Returns:
666+
dict: Access information for the meeting
667+
"""
668+
try:
669+
meeting: SaeMeeting = frappe.get_doc("Sae Meeting", meeting_id)
670+
671+
return {
672+
"success": True,
673+
"allow_guest": meeting.allow_guest,
674+
}
675+
except frappe.DoesNotExistError:
676+
return {
677+
"success": False,
678+
"error": "Meeting not found",
679+
}
680+
except Exception as e:
681+
return {
682+
"success": False,
683+
"error": str(e),
684+
}

0 commit comments

Comments
 (0)