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:
@@ -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')
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
})
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user