|
|
@@ -1,99 +1,68 @@ |
|
|
|
<style> |
|
|
|
.card-block { |
|
|
|
position: relative; |
|
|
|
} |
|
|
|
|
|
|
|
.alert { |
|
|
|
position: absolute; |
|
|
|
z-index: 20; |
|
|
|
width: 100%; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
} |
|
|
|
</style> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div class="card-header card-header-dark"> |
|
|
|
<div class="row"> |
|
|
|
<div class="login-header"> |
|
|
|
<div class="col-xs-1"> |
|
|
|
<span class="link" v-on:click="go('index')"> |
|
|
|
<i class="fa fa-chevron-circle-left white" aria-hidden="true"></i> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
<div class="col-xs-10 text-xs-center"> |
|
|
|
Connect to LessPass Database |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<form v-on:submit.prevent="login"> |
|
|
|
<div class="form-group row" v-if="showError"> |
|
|
|
<div class="col-xs-12 text-muted text-danger"> |
|
|
|
{{ errorMessage }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="card-block"> |
|
|
|
<form v-on:submit.prevent="login"> |
|
|
|
<div class="form-group row" v-if="showError"> |
|
|
|
<div class="col-xs-12 text-muted text-danger"> |
|
|
|
{{ errorMessage }} |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<div class="inner-addon left-addon"> |
|
|
|
<i class="fa fa-user"></i> |
|
|
|
<input id="login" |
|
|
|
class="form-control" |
|
|
|
name="login" |
|
|
|
type="email" |
|
|
|
placeholder="Email" |
|
|
|
v-model="user.email"> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<div class="inner-addon left-addon"> |
|
|
|
<i class="fa fa-user"></i> |
|
|
|
<input id="login" |
|
|
|
class="form-control" |
|
|
|
name="login" |
|
|
|
type="email" |
|
|
|
placeholder="Email" |
|
|
|
v-model="user.email"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<div class="inner-addon left-addon"> |
|
|
|
<i class="fa fa-lock"></i> |
|
|
|
<input id="password" |
|
|
|
name="password" |
|
|
|
type="password" |
|
|
|
class="form-control" |
|
|
|
placeholder="Password" |
|
|
|
v-model="user.password"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<div class="inner-addon left-addon"> |
|
|
|
<i class="fa fa-globe"></i> |
|
|
|
<input class="form-control" type="text" id="baseURL" v-model="$store.state.baseURL"> |
|
|
|
<small id="siteHelp" class="form-text text-muted">You can use your self hosted LessPass |
|
|
|
Database |
|
|
|
</small> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<button id="loginButton" class="btn btn-primary" type="submit"> |
|
|
|
Sign In |
|
|
|
</button> |
|
|
|
<button id="registerButton" class="btn btn-secondary" type="button" v-on:click="go('register')"> |
|
|
|
Register |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<div class="inner-addon left-addon"> |
|
|
|
<i class="fa fa-lock"></i> |
|
|
|
<input id="password" |
|
|
|
name="password" |
|
|
|
type="password" |
|
|
|
class="form-control" |
|
|
|
placeholder="Password" |
|
|
|
v-model="user.password"> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<button class="btn btn-link" type="button" v-on:click="go('forgotPassword')"> |
|
|
|
Forgot you password ? |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<div class="inner-addon left-addon"> |
|
|
|
<i class="fa fa-globe"></i> |
|
|
|
<input class="form-control" type="text" id="baseURL" v-model="$store.state.baseURL"> |
|
|
|
<small id="siteHelp" class="form-text text-muted">You can use your self hosted LessPass |
|
|
|
Database |
|
|
|
</small> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<div class="col-xs-12"> |
|
|
|
<button id="loginButton" class="btn btn-primary" type="submit"> |
|
|
|
Sign In |
|
|
|
</button> |
|
|
|
<button id="registerButton" class="btn btn-secondary" type="button" v-on:click="go('register')"> |
|
|
|
Register |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group row"> |
|
|
|
<button class="btn btn-link" type="button" v-on:click="go('forgotPassword')"> |
|
|
|
Forgot you password ? |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
</template> |
|
|
|
<script type="text/ecmascript-6"> |
|
|
|
import Auth from '../api/auth'; |
|
|
|
import Storage from '../api/storage'; |
|
|
|
import {mapGetters, mapActions} from 'vuex'; |
|
|
|
import {mapGetters} from 'vuex'; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
@@ -111,7 +80,7 @@ |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
methods: Object.assign(mapActions(['go']), { |
|
|
|
methods: { |
|
|
|
showErrorMessage(errorMessage){ |
|
|
|
this.errorMessage = errorMessage; |
|
|
|
this.showError = true; |
|
|
@@ -128,15 +97,15 @@ |
|
|
|
var baseURL = this.baseURL; |
|
|
|
var email = this.user.email; |
|
|
|
if (!email || !this.user.password || !baseURL) { |
|
|
|
this.showErrorMessage('email, password and url '); |
|
|
|
this.showErrorMessage('email, password and url are mandatory'); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.auth.login(this.user, baseURL) |
|
|
|
.then(()=> { |
|
|
|
this.storage.save({baseURL: baseURL, email: email}); |
|
|
|
this.$store.dispatch('userAuthenticated', {email: email}); |
|
|
|
this.$store.dispatch('go', 'index'); |
|
|
|
this.$store.dispatch('loadPasswords'); |
|
|
|
this.$router.push({ name: 'home'}); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
if (err.response === undefined) { |
|
|
@@ -152,7 +121,7 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}), |
|
|
|
}, |
|
|
|
computed: mapGetters([ |
|
|
|
'baseURL' |
|
|
|
]) |
|
|
|