uptime-kuma/src/components/Login.vue

78 lines
2.1 KiB
Vue
Raw Normal View History

2021-06-25 09:55:49 -04:00
<template>
<div class="form-container">
<div class="form">
<form @submit.prevent="submit">
<h1 class="h3 mb-3 fw-normal"></h1>
<div class="form-floating">
<input type="text" class="form-control" id="floatingInput" placeholder="Username" v-model="username">
<label for="floatingInput">Username</label>
</div>
<div class="form-floating mt-3">
<input type="password" class="form-control" id="floatingPassword" placeholder="Password" v-model="password">
<label for="floatingPassword">Password</label>
</div>
2021-07-18 07:00:59 -04:00
<div class="form-check mb-3 mt-3 d-flex justify-content-center">
<div class="form-check">
2021-07-01 10:16:02 -04:00
<input type="checkbox" value="remember-me" class="form-check-input" id="remember" v-model="$root.remember">
2021-06-25 09:55:49 -04:00
<label class="form-check-label" for="remember">
Remember me
</label>
2021-07-18 07:00:59 -04:00
</div>
2021-06-25 09:55:49 -04:00
</div>
<button class="w-100 btn btn-primary" type="submit" :disabled="processing">Login</button>
<div class="alert alert-danger mt-3" role="alert" v-if="res && !res.ok">
{{ res.msg }}
</div>
</form>
</div>
</div>
</template>
<script>
export default {
data() {
return {
processing: false,
username: "",
password: "",
2021-07-01 10:16:02 -04:00
2021-06-25 09:55:49 -04:00
res: null,
}
},
methods: {
submit() {
this.processing = true;
this.$root.login(this.username, this.password, (res) => {
this.processing = false;
this.res = res;
})
}
}
}
</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>