Merge pull request #3296 from matrix-org/t3chguy/remove_legacyLoginParams

Get rid of support for legacy login params
pull/21833/head
Michael Telatynski 2019-08-09 16:54:51 +01:00 committed by GitHub
commit cc0b698c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 10 deletions

View File

@ -2,6 +2,7 @@
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd Copyright 2017 Vector Creations Ltd
Copyright 2018 New Vector Ltd Copyright 2018 New Vector Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -87,32 +88,23 @@ export default class Login {
const isEmail = username.indexOf("@") > 0; const isEmail = username.indexOf("@") > 0;
let identifier; let identifier;
let legacyParams; // parameters added to support old HSes
if (phoneCountry && phoneNumber) { if (phoneCountry && phoneNumber) {
identifier = { identifier = {
type: 'm.id.phone', type: 'm.id.phone',
country: phoneCountry, country: phoneCountry,
number: phoneNumber, number: phoneNumber,
}; };
// No legacy support for phone number login
} else if (isEmail) { } else if (isEmail) {
identifier = { identifier = {
type: 'm.id.thirdparty', type: 'm.id.thirdparty',
medium: 'email', medium: 'email',
address: username, address: username,
}; };
legacyParams = {
medium: 'email',
address: username,
};
} else { } else {
identifier = { identifier = {
type: 'm.id.user', type: 'm.id.user',
user: username, user: username,
}; };
legacyParams = {
user: username,
};
} }
const loginParams = { const loginParams = {
@ -120,7 +112,6 @@ export default class Login {
identifier: identifier, identifier: identifier,
initial_device_display_name: this._defaultDeviceDisplayName, initial_device_display_name: this._defaultDeviceDisplayName,
}; };
Object.assign(loginParams, legacyParams);
const tryFallbackHs = (originalError) => { const tryFallbackHs = (originalError) => {
return sendLoginRequest( return sendLoginRequest(