Nxing/Caddy forward_auth support. Various fixes to bugs created in earlier edits. Vite server needs different base in dev mode, fixed.

This commit is contained in:
Leo Vasanko
2025-07-13 16:54:53 -06:00
parent 99b5187a33
commit 1c79132e22
6 changed files with 42 additions and 26 deletions

View File

@@ -31,7 +31,11 @@ const handleLogin = async () => {
authStore.showMessage('Starting authentication...', 'info')
await authStore.authenticate()
authStore.showMessage('Authentication successful!', 'success', 2000)
authStore.currentView = 'profile'
if (location.pathname.startsWith('/auth/')) {
authStore.currentView = 'profile'
} else {
location.reload()
}
} catch (error) {
authStore.showMessage(`Authentication failed: ${error.message}`, 'error')
}

View File

@@ -5,7 +5,7 @@
<form @submit.prevent="handleRegister">
<input
type="text"
v-model="username"
v-model="user_name"
placeholder="Enter username"
required
:disabled="authStore.isLoading"
@@ -13,7 +13,7 @@
<button
type="submit"
class="btn-primary"
:disabled="authStore.isLoading || !username.trim()"
:disabled="authStore.isLoading || !user_name.trim()"
>
{{ authStore.isLoading ? 'Registering...' : 'Register Passkey' }}
</button>

View File

@@ -15,7 +15,7 @@ export async function register(url, options) {
}
export async function registerUser(user_name) {
return register('/auth/ws/new_user_registration', { user_name })
return register('/auth/ws/register_new', { user_name })
}
export async function registerCredential() {

View File

@@ -4,7 +4,7 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
export default defineConfig(({ command, mode }) => ({
plugins: [
vue(),
],
@@ -13,7 +13,7 @@ export default defineConfig({
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
base: '/auth/',
base: command == 'build' ? '/auth/' : '/',
server: {
port: 3000,
proxy: {
@@ -29,4 +29,4 @@ export default defineConfig({
emptyOutDir: true,
assetsDir: 'assets'
}
})
}))