This commit is contained in:
2018-11-08 21:40:30 +00:00
parent e694ed8be8
commit 5f46631f88
2 changed files with 13 additions and 26 deletions

View File

@@ -8,7 +8,8 @@ export default new Vuex.Store({
authenticated: false,
apiUrl: "http://localhost:7575/api/v8.0/",
userId: 0,
roles: 0
roles: 0,
navItems: []
},
mutations: {
authenticated(state, data) {

View File

@@ -1,7 +1,6 @@
<template>
<v-container fluid>
<v-layout row wrap>
<v-layout row wrap="">
<v-flex xs12 class="text-xs-center" mt-5>
<h1>Login</h1>
</v-flex>
@@ -9,19 +8,16 @@
<form>
<v-layout column>
<v-flex>
<v-text-field
name="username"
v-model="input.username"
label="Username"
required></v-text-field>
<v-text-field name="username" v-model="input.username" label="Username" required></v-text-field>
</v-flex>
<v-flex>
<v-text-field
name="password"
v-model="input.password"
label="Password"
label="Password"
type="password"
required></v-text-field>
required
></v-text-field>
</v-flex>
<v-flex class="text-xs-center" mt-5>
<v-btn color="primary" v-on:click="login()">Login</v-btn>
@@ -31,7 +27,7 @@
</form>
</v-flex>
</v-layout>
</v-container>
</v-container>
</template>
<script>
@@ -52,25 +48,15 @@ export default {
if (this.input.username != "" && this.input.password != "") {
auth
.authenticate(this.input.username, this.input.password)
.then(response => {
//logger.log("LOGIN.VUE::login() -> SUCCESS", response);
.then(() => {
this.$router.replace({ name: "home" });
})
.catch(function(error) {
logger.log("LOGIN.VUE::login() !CATCH! -> Request failed", error);
alert("login failed: " + error);
//logger.log("LOGIN.VUE::login() !CATCH! -> Request failed", error);
});
// 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");
} else {
alert("A username and password are required");
}
},
showlog() {