keanu-weblite/src/components/profileInfoMixin.js
N-Pex 18f1945c19 "Knowing who you are"
Work on issue #128.
2021-06-17 20:56:25 +02:00

44 lines
No EOL
1.1 KiB
JavaScript

export default {
computed: {
user() {
if (!this.$matrix.matrixClient) {
return null;
}
return this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);
},
displayName() {
if (!this.user) {
return null;
}
return (this.user.displayName || this.user.userId);
},
userAvatar() {
if (!this.user || !this.user.avatarUrl) {
return null;
}
return this.$matrix.matrixClient.mxcUrlToHttp(this.user.avatarUrl, 80, 80, 'scale', true);
},
userAvatarLetter() {
if (!this.user) {
return null;
}
return (this.user.displayName || this.user.userId.substring(1)).substring(0, 1).toUpperCase();
},
passwordsMatch() {
return this.newPassword1 && this.newPassword2 && this.newPassword1 == this.newPassword2;
}
},
methods: {
logout() {
//TODO - For guest accounts, show warning about not being able to rejoin.
this.$store.dispatch("logout");
this.$nextTick(() => {
this.$navigation.push({path: "/login"}, -1);
})
},
}
}