This commit is contained in:
2018-11-05 23:36:46 +00:00
parent a198bfcfb9
commit a9e8bfdaa3
8 changed files with 209 additions and 70 deletions

View File

@@ -1,47 +1,50 @@
<template>
<div id="login">
<h1>Login</h1>
<input type="text" name="username" v-model="input.username" placeholder="Username" />
<input type="password" name="password" v-model="input.password" placeholder="Password" />
<input type="text" name="username" v-model="input.username" placeholder="Username">
<input type="password" name="password" v-model="input.password" placeholder="Password">
<button type="button" v-on:click="login()">Login</button>
</div>
</template>
<script>
export default {
name: 'Login',
data() {
return {
input: {
username: "",
password: ""
}
}
},
methods: {
login() {
if(this.input.username != "" && this.input.password != "") {
if(this.input.username == this.$store.state.mockAccount.username && this.input.password == this.$store.state.mockAccount.password) {
this.$emit("authenticated", true);
this.$router.replace({ name: "secure" });
} else {
console.log("The username and / or password is incorrect");
}
} else {
console.log("A username and password must be present");
}
}
export default {
name: "Login",
data() {
return {
input: {
username: "",
password: ""
}
};
},
methods: {
login() {
if (this.input.username != "" && this.input.password != "") {
if (
this.input.username == this.$store.state.mockAccount.username &&
this.input.password == this.$store.state.mockAccount.password
) {
this.$emit("authenticated", true);
this.$router.replace({ name: "secure" });
} else {
alert("The username and / or password is incorrect");
}
} else {
alert("A username and password must be present");
}
}
}
};
</script>
<style scoped>
#login {
width: 500px;
border: 1px solid #CCCCCC;
background-color: #FFFFFF;
margin: auto;
margin-top: 200px;
padding: 20px;
}
</style>
#login {
width: 500px;
border: 1px solid #cccccc;
background-color: #ffffff;
margin: auto;
margin-top: 200px;
padding: 20px;
}
</style>