Fix login

This commit is contained in:
N-Pex 2020-11-09 15:55:17 +01:00
parent d6381f60c7
commit 1b3659b50e
6 changed files with 37 additions and 22 deletions

View file

@ -1,4 +1,6 @@
$chat-background: #008860; @import "@/assets/css/main.scss";
$chat-background: $background;
$chat-standard-padding: 32px; $chat-standard-padding: 32px;
$chat-standard-padding-s: 16px; $chat-standard-padding-s: 16px;
$chat-standard-padding-xs: 8px; $chat-standard-padding-xs: 8px;

14
src/assets/css/login.scss Normal file
View file

@ -0,0 +1,14 @@
@import "@/assets/css/main.scss";
.login-root {
position: absolute;
left: 0px;
top: 0px;
right: 0px;
bottom: 0px;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
background-color: $background;
}

1
src/assets/css/main.scss Normal file
View file

@ -0,0 +1 @@
$background: #008860;

View file

@ -1,30 +1,31 @@
<template> <template>
<div class="d-flex justify-center"> <div class="d-flex justify-center login-root">
<v-card class="ma-8 pa-4" style="min-width: 400px; max-width: 400px" flat> <div color="rgba(255,255,255,0.1)">
<v-card-title primary-title> <h4>Login</h4>
<h4>Login</h4>
</v-card-title>
<v-form v-model="isValid"> <v-form v-model="isValid">
<v-text-field <v-text-field
prepend-icon="mdi-account"
v-model="user.username" v-model="user.username"
label="Username" label="Username"
color="black"
background-color="white"
outlined
:rules="[(v) => !!v || 'Username is required']" :rules="[(v) => !!v || 'Username is required']"
:error="userErrorMessage != null" :error="userErrorMessage != null"
:error-messages="userErrorMessage" :error-messages="userErrorMessage"
required required
></v-text-field> ></v-text-field>
<v-text-field <v-text-field
prepend-icon="mdi-lock"
v-model="user.password" v-model="user.password"
label="Password" label="Password"
color="black"
background-color="white"
outlined
type="password" type="password"
:rules="[(v) => !!v || 'Password is required']" :rules="[(v) => !!v || 'Password is required']"
:error="passErrorMessage != null" :error="passErrorMessage != null"
:error-messages="passErrorMessage" :error-messages="passErrorMessage"
required required
></v-text-field> ></v-text-field>
<v-card-actions>
<v-btn <v-btn
:disabled="!isValid || loading" :disabled="!isValid || loading"
primary primary
@ -34,9 +35,8 @@
:loading="loading" :loading="loading"
>Login</v-btn >Login</v-btn
> >
</v-card-actions>
</v-form> </v-form>
</v-card> </div>
</div> </div>
</template> </template>
@ -119,4 +119,8 @@ export default {
}, },
}, },
}; };
</script> </script>
<style lang="scss">
@import "@/assets/css/login.scss";
</style>

View file

@ -7,12 +7,8 @@
<v-icon v-text="room.icon"></v-icon> <v-icon v-text="room.icon"></v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-content> <v-list-item-content>
<v-list-item-title <v-list-item-title>{{ room.summary.info.title }}</v-list-item-title>
v-text="room.summary.info.title" <v-list-item-subtitle>{{ room.topic }}</v-list-item-subtitle>
></v-list-item-title>
<v-list-item-content
>Topic: {{ room.topic }}</v-list-item-content
>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
</v-list-item-group> </v-list-item-group>

View file

@ -1,5 +1,3 @@
import MatrixService from '../services/matrix.service';
const user = JSON.parse(localStorage.getItem('user')); const user = JSON.parse(localStorage.getItem('user'));
const initialState = user const initialState = user
? { status: { loggedIn: true }, user } ? { status: { loggedIn: true }, user }
@ -10,7 +8,7 @@ export const auth = {
state: initialState, state: initialState,
actions: { actions: {
login({ commit }, user) { login({ commit }, user) {
return MatrixService.login(user).then( return this._vm.$matrix.login(user).then(
user => { user => {
commit('loginSuccess', user); commit('loginSuccess', user);
return Promise.resolve(user); return Promise.resolve(user);
@ -22,7 +20,7 @@ export const auth = {
); );
}, },
logout({ commit }) { logout({ commit }) {
MatrixService.logout(); this._vm.$matrix.logout();
commit('logout'); commit('logout');
}, },
}, },