mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-11 16:45:42 +00:00
fix: Require guests to login
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import Sidebar from 'picocrank/vue/components/Sidebar.vue';
|
||||
import Header from 'picocrank/vue/components/Header.vue';
|
||||
import { HugeiconsIcon } from '@hugeicons/vue'
|
||||
@@ -67,6 +68,8 @@ import { UserCircle02Icon } from '@hugeicons/core-free-icons'
|
||||
import { DashboardSquare01Icon } from '@hugeicons/core-free-icons'
|
||||
import logoUrl from '../../OliveTinLogo.png';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const sidebar = ref(null);
|
||||
const username = ref('guest');
|
||||
const isLoggedIn = ref(false);
|
||||
@@ -107,7 +110,14 @@ async function requestInit() {
|
||||
try {
|
||||
const initResponse = await window.client.init({})
|
||||
|
||||
// Store init response first so the login view can read options (e.g., authLocalLogin)
|
||||
window.initResponse = initResponse
|
||||
|
||||
// Check if login is required and redirect if so (after storing initResponse)
|
||||
if (initResponse.loginRequired) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
window.initError = false
|
||||
window.initErrorMessage = ''
|
||||
window.initCompleted = true
|
||||
|
||||
Reference in New Issue
Block a user