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.snackbarLogout = true
this.isLogged = false this.isLogged = false
console.log("wylogowano") console.log("wylogowano")
window.location.replace("http://localhost:8080");
} }
else{ else{
this.snackbarLogout = false this.snackbarLogout = false

View File

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

View File

@ -1,5 +1,14 @@
<template> <template>
<div id="login"> <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-container class="my-5">
<v-layout column align-center> <v-layout column align-center>
<v-flex id ="flex" xs12 sm6 md4 lg3 class="primary"> <v-flex id ="flex" xs12 sm6 md4 lg3 class="primary">
@ -42,6 +51,7 @@ import axios from 'axios'
export default { export default {
data(){ data(){
return{ return{
snackbar: false,
userLogin : '', userLogin : '',
userPassword: '', userPassword: '',
loginRules: [ loginRules: [
@ -62,19 +72,20 @@ export default {
window.location.replace("http://localhost:8080/game"); window.location.replace("http://localhost:8080/game");
} }
else{ else{
//Zły login albo hasło console.log("Zły lolgin")
this.loginRules= [false || 'Nieprawidłowe dane'] this.snackbar = true
this.userLogin = ''
this.userPassword = ''
} }
this.userLogin = ""
this.userPassword = ""
}) })
.catch(error=>{ .catch(error=>{
console.log("ERROR: ", error.response.data) console.log("ERROR: ", error.response.data)
}); });
}//dlugi if }//dlugi if
this.userLogin = ''
this.userPassword = ''
} }
} }
} }

View File

@ -1,5 +1,13 @@
<template> <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-container class="my-5">
<v-layout column align-center> <v-layout column align-center>
<v-flex id="flex" xs12 sm6 md4 lg3 class="primary"> <v-flex id="flex" xs12 sm6 md4 lg3 class="primary">
@ -44,6 +52,9 @@ import axios from 'axios'
export default { export default {
data(){ data(){
return{ return{
snackbar: false,
snackbarColour: 'red',
snackbarText: '',
userLogin : '', userLogin : '',
userPassword: '', userPassword: '',
userPassword2: '', userPassword2: '',
@ -79,17 +90,22 @@ export default {
.then(response=>{ .then(response=>{
console.log(response.data); console.log(response.data);
if (response.data === "[addNewUserView] Dodano uzytkownika do bazy"){ 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"){ if (response.data === "Login zajęty"){
this.loginRules= [false || 'Login zajęty'] this.snackbar = true
this.snackbarColour = "red"
this.snackbarText= "Login zajety :<"
} }
else{ // else{
//Zły login albo hasło // //Zły login albo hasło
this.loginRules= [false || 'Nieprawidłowe dane'] // this.loginRules= [false || 'Nieprawidłowe dane']
} // }
this.userLogin = ""
this.userPassword = ""
}) })
.catch(error=>{ .catch(error=>{
@ -99,7 +115,7 @@ export default {
this.login = '' this.userLogin = ''
this.userPassword = '' this.userPassword = ''
this.userPassword2 = '' this.userPassword2 = ''
return return