Login on reload

To get a new access_token if the old one has expired. Should fix issue #36.
This commit is contained in:
N-Pex 2021-01-27 12:57:23 +01:00
parent 5645e32cf0
commit 933de4a2ec
5 changed files with 64 additions and 18 deletions

View file

@ -157,7 +157,7 @@ export default {
this.waitingForMembership = true;
const self = this;
this.$matrix
.getMatrixClient(this.currentUser)
.login(this.currentUser)
.then(() => {
self.$matrix.setCurrentRoomId(self.roomId); // Go to this room, now or when joined.
@ -246,7 +246,7 @@ export default {
this.loadingMessage = "Logging in...";
var clientPromise;
if (this.currentUser) {
clientPromise = this.$matrix.getMatrixClient(this.currentUser);
clientPromise = this.$matrix.login(this.currentUser);
} else {
clientPromise = this.$store.dispatch("auth/login", this.guestUser);
}

View file

@ -115,11 +115,7 @@ export default {
// Is it a full matrix user id? Modify a copy, so that the UI will still show the full ID.
var user = Object.assign({}, this.user);
if (user.username.startsWith('@') && user.username.includes(':')) {
const parts = user.username.split(":");
user.username = parts[0].substring(1);
user.server = "https://" + parts[1];
}
user.normalize();
this.loading = true;
this.$store.dispatch("auth/login", user).then(