2021-07-11 05:47:57 +00:00
|
|
|
<template>
|
|
|
|
<div class="form-container">
|
|
|
|
<div class="form">
|
|
|
|
<form @submit.prevent="submit">
|
|
|
|
<div>
|
2021-07-27 17:47:13 +00:00
|
|
|
<object width="64" height="64" data="/icon.svg" />
|
|
|
|
<div style="font-size: 28px; font-weight: bold; margin-top: 5px;">
|
|
|
|
Uptime Kuma
|
|
|
|
</div>
|
2021-07-11 05:47:57 +00:00
|
|
|
</div>
|
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<p class="mt-3">
|
|
|
|
Create your admin account
|
|
|
|
</p>
|
2021-07-11 05:47:57 +00:00
|
|
|
|
|
|
|
<div class="form-floating">
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="floatingInput" v-model="username" type="text" class="form-control" placeholder="Username" required>
|
2021-07-11 05:47:57 +00:00
|
|
|
<label for="floatingInput">Username</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-floating mt-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="floatingPassword" v-model="password" type="password" class="form-control" placeholder="Password" required>
|
2021-07-11 05:47:57 +00:00
|
|
|
<label for="floatingPassword">Password</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-floating mt-3">
|
2021-07-27 17:47:13 +00:00
|
|
|
<input id="repeat" v-model="repeatPassword" type="password" class="form-control" placeholder="Repeat Password" required>
|
2021-07-11 05:47:57 +00:00
|
|
|
<label for="repeat">Repeat Password</label>
|
|
|
|
</div>
|
|
|
|
|
2021-07-27 17:47:13 +00:00
|
|
|
<button class="w-100 btn btn-primary mt-3" type="submit" :disabled="processing">
|
|
|
|
Create
|
|
|
|
</button>
|
2021-07-11 05:47:57 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-07-27 17:47:13 +00:00
|
|
|
import { useToast } from "vue-toastification"
|
2021-07-11 05:47:57 +00:00
|
|
|
const toast = useToast()
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
processing: false,
|
|
|
|
username: "",
|
|
|
|
password: "",
|
|
|
|
repeatPassword: "",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$root.getSocket().emit("needSetup", (needSetup) => {
|
|
|
|
if (! needSetup) {
|
|
|
|
this.$router.push("/")
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit() {
|
|
|
|
this.processing = true;
|
|
|
|
|
|
|
|
if (this.password !== this.repeatPassword) {
|
|
|
|
toast.error("Repeat password do not match.")
|
|
|
|
this.processing = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$root.getSocket().emit("setup", this.username, this.password, (res) => {
|
|
|
|
this.processing = false;
|
|
|
|
this.$root.toastRes(res)
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
this.$router.push("/")
|
|
|
|
}
|
|
|
|
})
|
2021-07-27 17:47:13 +00:00
|
|
|
},
|
|
|
|
},
|
2021-07-11 05:47:57 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
.form-container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding-top: 40px;
|
|
|
|
padding-bottom: 40px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.form {
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
max-width: 330px;
|
|
|
|
padding: 15px;
|
|
|
|
margin: auto;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|