Allow logins on different servers

Work on issue #32.
This commit is contained in:
N-Pex 2021-01-19 16:07:55 +01:00
parent 6f112add4b
commit 7b2b8df829

View file

@ -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);
},