From 7b2b8df8292b7b2a44bae06812a4b1132632e9b7 Mon Sep 17 00:00:00 2001 From: N-Pex Date: Tue, 19 Jan 2021 16:07:55 +0100 Subject: [PATCH] Allow logins on different servers Work on issue #32. --- src/components/Login.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/Login.vue b/src/components/Login.vue index 8825173..e6b2631 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -111,8 +111,17 @@ export default { methods: { handleLogin() { if (this.user.username && this.user.password) { + + // 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]; + } + this.loading = true; - this.$store.dispatch("auth/login", this.user).then( + this.$store.dispatch("auth/login", user).then( () => { this.$navigation.push({name: "Chat", params: { roomId: this.$matrix.currentRoomId }}, -1); },