Improved logout/login and change password support

This commit is contained in:
N-Pex 2021-03-29 21:55:43 +02:00
parent 31535f0f3c
commit 1f4970368a
7 changed files with 109 additions and 99 deletions

View file

@ -9,17 +9,17 @@
<script>
export default {
name: "App",
methods: {
loggedIn() {
return this.$store.state.auth.status.loggedIn;
},
logOut() {
this.openDrawer = false;
this.$store.dispatch("auth/logout");
this.$nextTick(() => {
this.$navigation.push({path: "/login"}, -1);
})
},
mounted() {
if (this.currentUser) {
this.$matrix
.login(this.currentUser)
.then(() => {
console.log("Matrix client ready");
})
.catch((error) => {
console.log("Error creating client", error);
});
}
},
computed: {
currentUser() {
@ -35,33 +35,21 @@ export default {
}
if (this.$route.meta.includeRoom) {
if (this.$matrix.currentRoom) {
title += " - " + (this.$matrix.currentRoom.summary.info.title || this.$matrix.currentRoom.roomId);
title +=
" - " +
(this.$matrix.currentRoom.summary.info.title ||
this.$matrix.currentRoom.roomId);
} else if (this.$matrix.currentRoomId) {
title += " - " + (this.$matrix.currentRoomId);
title += " - " + this.$matrix.currentRoomId;
}
}
return title;
}
},
},
watch: {
title(title) {
document.title = title;
},
currentUser: {
immediate: true,
handler(ignorednewVal, ignoredoldVal) {
if (this.currentUser) {
this.$matrix
.login(this.currentUser)
.then(() => {
console.log("Matrix client ready");
})
.catch((error) => {
console.log("Error creating client", error);
});
}
},
},
},
};
</script>