Move the whole app under /auth/, fix static build.
This commit is contained in:
Binary file not shown.
@@ -2,9 +2,9 @@
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<link rel="icon" href="/src/assets/icon.webp">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
<title>Passkey Authentication</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.0",
|
||||
"vite": "^7.0.4",
|
||||
"vite-plugin-vue-devtools": "^7.7.7"
|
||||
"vite": "^7.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
frontend/src/assets/icon.webp
Normal file
BIN
frontend/src/assets/icon.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -1,6 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { registerUser, authenticateUser, registerWithToken } from '@/utils/passkey'
|
||||
import aWebSocket from '@/utils/awaitable-websocket'
|
||||
|
||||
export const useAuthStore = defineStore('auth', {
|
||||
state: () => ({
|
||||
@@ -102,18 +101,6 @@ export const useAuthStore = defineStore('auth', {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
async addNewCredential() {
|
||||
this.isLoading = true;
|
||||
try {
|
||||
const result = await registerWithToken()
|
||||
await this.loadCredentials()
|
||||
return result;
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to add new credential: ${error.message}`)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
async deleteCredential(credentialId) {
|
||||
const response = await fetch('/auth/delete-credential', {
|
||||
method: 'POST',
|
||||
@@ -138,24 +125,5 @@ export const useAuthStore = defineStore('auth', {
|
||||
this.currentCredentials = []
|
||||
this.aaguidInfo = {}
|
||||
},
|
||||
async checkResetCookieAndRegister() {
|
||||
const passphrase = getCookie('reset')
|
||||
if (passphrase) {
|
||||
// Abandon existing session
|
||||
await fetch('/auth/logout', { method: 'POST', credentials: 'include' })
|
||||
|
||||
// Register additional token for the user
|
||||
try {
|
||||
const result = await registerUserFromCookie()
|
||||
await this.setSessionCookie(result.session_token)
|
||||
this.currentUser = {
|
||||
user_id: result.user_id,
|
||||
user_name: result.user_name,
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to register additional token:', error)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function registerCredential() {
|
||||
return register('/auth/ws/add_credential')
|
||||
}
|
||||
export async function registerWithToken(token) {
|
||||
return register('/auth/ws/add_device_credential', {token})
|
||||
return register('/auth/ws/add_device_credential', { token })
|
||||
}
|
||||
|
||||
export async function authenticateUser() {
|
||||
|
||||
@@ -2,19 +2,18 @@ import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
},
|
||||
},
|
||||
base: '/auth/',
|
||||
server: {
|
||||
port: 3000,
|
||||
proxy: {
|
||||
@@ -26,7 +25,7 @@ export default defineConfig({
|
||||
}
|
||||
},
|
||||
build: {
|
||||
outDir: '../static/dist',
|
||||
outDir: '../passkeyauth/frontend-static',
|
||||
emptyOutDir: true,
|
||||
assetsDir: 'assets'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user