@@ -35,7 +35,6 @@ function getDefaultPasswordProfile(version, passwordProfile = {}) { | |||||
const versionLoadedByDefault = storage.json().version || 1; | const versionLoadedByDefault = storage.json().version || 1; | ||||
const state = { | const state = { | ||||
authenticated: auth.isAuthenticated(), | authenticated: auth.isAuthenticated(), | ||||
email: '', | |||||
passwordStatus: 'CLEAN', | passwordStatus: 'CLEAN', | ||||
passwords: [], | passwords: [], | ||||
baseURL: 'https://lesspass.com', | baseURL: 'https://lesspass.com', | ||||
@@ -47,9 +46,8 @@ export const mutations = { | |||||
LOGOUT(state){ | LOGOUT(state){ | ||||
state.authenticated = false; | state.authenticated = false; | ||||
}, | }, | ||||
USER_AUTHENTICATED(state, user){ | |||||
LOGIN(state){ | |||||
state.authenticated = true; | state.authenticated = true; | ||||
state.email = user.email; | |||||
}, | }, | ||||
SET_PASSWORDS(state, passwords){ | SET_PASSWORDS(state, passwords){ | ||||
state.passwords = passwords; | state.passwords = passwords; | ||||
@@ -148,7 +146,6 @@ const getters = { | |||||
isAuthenticated: state => state.authenticated, | isAuthenticated: state => state.authenticated, | ||||
isGuest: state => !state.authenticated, | isGuest: state => !state.authenticated, | ||||
passwordStatus: state => state.passwordStatus, | passwordStatus: state => state.passwordStatus, | ||||
email: state => state.email, | |||||
version: state => state.version, | version: state => state.version, | ||||
}; | }; | ||||
@@ -171,8 +171,8 @@ | |||||
this.auth.login({email, password}, baseURL) | this.auth.login({email, password}, baseURL) | ||||
.then(()=> { | .then(()=> { | ||||
this.loadingSignIn = false; | this.loadingSignIn = false; | ||||
this.storage.save({baseURL, email}); | |||||
this.$store.dispatch('USER_AUTHENTICATED', {email}); | |||||
this.storage.save({baseURL}); | |||||
this.$store.commit('LOGIN'); | |||||
this.$router.push({name: 'home'}); | this.$router.push({name: 'home'}); | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
@@ -259,7 +259,7 @@ | |||||
return; | return; | ||||
} | } | ||||
var passwordProfiles = { | |||||
const passwordProfiles = { | |||||
1: { | 1: { | ||||
lowercase: true, | lowercase: true, | ||||
uppercase: true, | uppercase: true, | ||||
@@ -282,7 +282,7 @@ | |||||
for (let i = 0; i < passwords.length; i++) { | for (let i = 0; i < passwords.length; i++) { | ||||
const password = passwords[i]; | const password = passwords[i]; | ||||
if (password.site === site && password.login === login) { | if (password.site === site && password.login === login) { | ||||
this.$store.dispatch('PASSWORD_CHANGE', {password: {...password}}); | |||||
this.$store.commit('SET_PASSWORD', {password}); | |||||
this.$refs.masterPassword.focus(); | this.$refs.masterPassword.focus(); | ||||
break; | break; | ||||
} | } | ||||
@@ -372,7 +372,7 @@ | |||||
this.generatingPassword = false; | this.generatingPassword = false; | ||||
this.generatedPassword = generatedPassword; | this.generatedPassword = generatedPassword; | ||||
window.document.getElementById('copyPasswordButton').setAttribute('data-clipboard-text', generatedPassword); | window.document.getElementById('copyPasswordButton').setAttribute('data-clipboard-text', generatedPassword); | ||||
this.$store.dispatch('PASSWORD_GENERATED'); | |||||
this.$store.commit('CHANGE_PASSWORD_STATUS', 'DIRTY'); | |||||
}); | }); | ||||
}, | }, | ||||
setDefaultVersion(version){ | setDefaultVersion(version){ | ||||