Wipe guest accounts on password errors
This commit is contained in:
parent
e49f6e81c3
commit
dc61bb2ba7
3 changed files with 19 additions and 2 deletions
|
|
@ -409,12 +409,21 @@ export default {
|
|||
// we need to hang on to the generated password and use that to login to a new
|
||||
// session, so only wipe the token in s that case.
|
||||
// Clear the access token
|
||||
var user = JSON.parse(this.$store.state.auth.user);
|
||||
var user = this.$store.state.auth.user;
|
||||
if (user.is_guest) {
|
||||
delete user.access_token;
|
||||
this.$store.commit("setUser", user);
|
||||
|
||||
// Login again
|
||||
this.login(user);
|
||||
this.login(user).catch(error => {
|
||||
if (error.data.errcode ==='M_FORBIDDEN' && this.currentUser.is_guest) {
|
||||
// Guest account and password don't work. We are in a strange state, probably because
|
||||
// of server cleanup of accounts or similar. Wipe account and restart...
|
||||
this.$store.commit("setUser", null);
|
||||
}
|
||||
this.$store.commit("setCurrentRoomId", null);
|
||||
this.$navigation.push({ path: "/login" }, -1);
|
||||
})
|
||||
} else {
|
||||
this.$store.commit("setUser", null);
|
||||
this.$store.commit("setCurrentRoomId", null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue