feat: add session-based authentication to the web interface and API routes
Build and Push / build (nucleus, amd64, linux) (push) Successful in 16s
Build and Push / build (nucleus, amd64, linux) (push) Successful in 16s
This commit is contained in:
+13
-1
@@ -6,9 +6,10 @@
|
||||
<img src="/favicon.svg" alt="Nucleus Logo" class="w-8 h-8 drop-shadow-md" />
|
||||
<h1 class="text-xl font-bold text-heading">Nucleus</h1>
|
||||
</div>
|
||||
<nav class="flex space-x-4">
|
||||
<nav class="flex space-x-4 items-center" v-if="$route.path !== '/login'">
|
||||
<router-link to="/" class="px-3 py-2 rounded-md text-sm font-medium transition-colors hover:bg-border-subtle hover:text-heading" active-class="bg-bg text-accent shadow-inner">Targets</router-link>
|
||||
<router-link to="/scans" class="px-3 py-2 rounded-md text-sm font-medium transition-colors hover:bg-border-subtle hover:text-heading" active-class="bg-bg text-accent shadow-inner">Scans History</router-link>
|
||||
<button @click="logout" class="ml-4 px-3 py-1.5 border border-border-subtle rounded-md text-sm font-medium text-body hover:text-red-400 hover:border-red-400/50 transition-colors hover:cursor-pointer">Logout</button>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
@@ -20,3 +21,14 @@
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const logout = async () => {
|
||||
await fetch('/api/auth/logout', { method: 'POST' })
|
||||
router.push('/login')
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user