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, authenticated: false,
apiUrl: "http://localhost:7575/api/v8.0/", apiUrl: "http://localhost:7575/api/v8.0/",
userId: 0, userId: 0,
roles: 0 roles: 0,
navItems: []
}, },
mutations: { mutations: {
authenticated(state, data) { authenticated(state, data) {

View File

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