mirror of https://github.com/vector-im/riot-web
parent
878413f6a4
commit
2c1ac29d30
10
src/Login.js
10
src/Login.js
|
@ -111,23 +111,32 @@ 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 = {
|
||||||
|
@ -135,6 +144,7 @@ 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 client = this._createTemporaryClient();
|
const client = this._createTemporaryClient();
|
||||||
return client.login('m.login.password', loginParams).then(function(data) {
|
return client.login('m.login.password', loginParams).then(function(data) {
|
||||||
|
|
Loading…
Reference in New Issue