Poprawienie logowania

This commit is contained in:
pawlaczyk 2019-01-10 05:41:28 +01:00
parent 01323df92f
commit e63a859209
4 changed files with 46 additions and 20 deletions

View File

@ -110,6 +110,8 @@ export default {
this.snackbarLogout = true
this.isLogged = false
console.log("wylogowano")
window.location.replace("http://localhost:8080");
}
else{
this.snackbarLogout = false

View File

@ -1,9 +1,6 @@
<template>
<div class="dashboard">
<h1 class="subheading grey--text">Wszystkie karty z bazy danych </h1>
<v-container fluid class="my-5">
<v-layout row class="mb-3">
<v-tooltip top>
<v-btn small flat color="grey" @click="sortBy('question')" slot="activator">
@ -29,7 +26,7 @@
<v-layout row wrap :class="`pa-3 cardType ${card.type}`">
<v-flex xs12 md6>
<div class="caption grey--text">Project title</div>
<div class="caption grey--text">Treść</div>
<div>{{card.text}}</div>
</v-flex>

View File

@ -1,5 +1,14 @@
<template>
<div id="login">
<!-- okno jesti cos ma sie wyswietlic-->
<v-snackbar v-model="snackbar" :timeout="4000" top color="red">
<span>Nie można zalogować</span>
<v-btn flat color="white" @click="snackbar = false">
<v-icon>clear</v-icon>
</v-btn>
</v-snackbar>
<!-- Okno rejestracji -->
<v-container class="my-5">
<v-layout column align-center>
<v-flex id ="flex" xs12 sm6 md4 lg3 class="primary">
@ -42,6 +51,7 @@ import axios from 'axios'
export default {
data(){
return{
snackbar: false,
userLogin : '',
userPassword: '',
loginRules: [
@ -62,19 +72,20 @@ export default {
window.location.replace("http://localhost:8080/game");
}
else{
//Zły login albo hasło
this.loginRules= [false || 'Nieprawidłowe dane']
console.log("Zły lolgin")
this.snackbar = true
this.userLogin = ''
this.userPassword = ''
}
this.userLogin = ""
this.userPassword = ""
})
.catch(error=>{
console.log("ERROR: ", error.response.data)
});
}//dlugi if
this.userLogin = ''
this.userPassword = ''
}
}
}

View File

@ -1,5 +1,13 @@
<template>
<div id="login">
<div id="register">
<!-- okno jesti cos ma sie wyswietlic-->
<v-snackbar v-model="snackbar" :timeout="4000" top :color="`${snackbarColour}`">
<span>{{snackbarText}}</span>
<v-btn flat color="white" @click="snackbar = false">
<v-icon>clear</v-icon>
</v-btn>
</v-snackbar>
<!-- Rejestracja -->
<v-container class="my-5">
<v-layout column align-center>
<v-flex id="flex" xs12 sm6 md4 lg3 class="primary">
@ -44,6 +52,9 @@ import axios from 'axios'
export default {
data(){
return{
snackbar: false,
snackbarColour: 'red',
snackbarText: '',
userLogin : '',
userPassword: '',
userPassword2: '',
@ -79,17 +90,22 @@ export default {
.then(response=>{
console.log(response.data);
if (response.data === "[addNewUserView] Dodano uzytkownika do bazy"){
window.location.replace("http://localhost:8080/");
this.snackbar = true
this.snackbarColour = 'green darken-4 white--text mt-4'
this.snackbarText= "Utworzono konto :)"
// window.location.replace("http://localhost:8080/");
}
if (response.data === "Login zajęty"){
this.loginRules= [false || 'Login zajęty']
this.snackbar = true
this.snackbarColour = "red"
this.snackbarText= "Login zajety :<"
}
else{
//Zły login albo hasło
this.loginRules= [false || 'Nieprawidłowe dane']
}
this.userLogin = ""
this.userPassword = ""
// else{
// //Zły login albo hasło
// this.loginRules= [false || 'Nieprawidłowe dane']
// }
})
.catch(error=>{
@ -99,7 +115,7 @@ export default {
this.login = ''
this.userLogin = ''
this.userPassword = ''
this.userPassword2 = ''
return