up
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
<template>
|
||||
<div class="login-container">
|
||||
<h2>Login</h2>
|
||||
<form @submit.prevent="login">
|
||||
<div>
|
||||
<input
|
||||
v-model="loginForm.login"
|
||||
placeholder="Login"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const loginForm = ref({ login: '', password: '' })
|
||||
const error = ref('')
|
||||
|
||||
async function login() {
|
||||
try {
|
||||
const res = await fetch('/api/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(loginForm.value)
|
||||
})
|
||||
|
||||
if (res.ok) {
|
||||
router.push('/')
|
||||
} else {
|
||||
error.value = 'Invalid credentials'
|
||||
}
|
||||
} catch (e) {
|
||||
error.value = 'Network error'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-container {
|
||||
max-width: 300px;
|
||||
margin: 100px auto;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
margin: 5px 0;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@@ -1,75 +0,0 @@
|
||||
<template>
|
||||
<div class="setup-container">
|
||||
<h2>Setup Admin Account</h2>
|
||||
<form @submit.prevent="setup">
|
||||
<div>
|
||||
<input
|
||||
v-model="form.login"
|
||||
placeholder="Admin login (min 3 chars)"
|
||||
required
|
||||
minlength="3"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
placeholder="Password (min 6 chars)"
|
||||
required
|
||||
minlength="6"
|
||||
/>
|
||||
</div>
|
||||
<button type="submit">Create Admin</button>
|
||||
</form>
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const form = ref({ login: '', password: '' })
|
||||
const error = ref('')
|
||||
|
||||
async function setup() {
|
||||
try {
|
||||
const res = await fetch('/api/setup', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(form.value)
|
||||
})
|
||||
|
||||
const data = await res.json()
|
||||
|
||||
if (res.ok) {
|
||||
router.push('/login')
|
||||
} else {
|
||||
error.value = data.error || 'Setup failed'
|
||||
}
|
||||
} catch (e) {
|
||||
error.value = 'Network error'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.setup-container {
|
||||
max-width: 300px;
|
||||
margin: 100px auto;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
margin: 5px 0;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,6 @@ import io.vertx.ext.web.handler.StaticHandler;
|
||||
import io.vertx.ext.web.sstore.LocalSessionStore;
|
||||
import io.vertx.ext.web.sstore.SessionStore;
|
||||
|
||||
import io.vertx.ext.web.sstore.redis.RedisSessionStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import su.xserver.iikocon.config.AppConfig;
|
||||
@@ -23,7 +22,6 @@ import su.xserver.iikocon.service.DataBaseService;
|
||||
import su.xserver.iikocon.service.HealthCheckService;
|
||||
import su.xserver.iikocon.service.RedisService;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user