fix: simplify login options
This commit is contained in:
parent
3243382cbb
commit
e8536bd951
@ -7,30 +7,27 @@ const authProvider = {
|
|||||||
base_url = process.env.REACT_APP_SERVER || base_url;
|
base_url = process.env.REACT_APP_SERVER || base_url;
|
||||||
|
|
||||||
console.log("login ");
|
console.log("login ");
|
||||||
let options;
|
const options = {
|
||||||
if (username && password) {
|
method: "POST",
|
||||||
options = {
|
body: JSON.stringify(
|
||||||
method: "POST",
|
Object.assign(
|
||||||
body: JSON.stringify({
|
{
|
||||||
type: "m.login.password",
|
device_id: localStorage.getItem("device_id"),
|
||||||
user: username,
|
initial_device_display_name: "Synapse Admin",
|
||||||
password: password,
|
},
|
||||||
initial_device_display_name: "Synapse Admin",
|
loginToken
|
||||||
}),
|
? {
|
||||||
};
|
type: "m.login.token",
|
||||||
} else if (loginToken) {
|
token: loginToken,
|
||||||
options = {
|
}
|
||||||
method: "POST",
|
: {
|
||||||
body: JSON.stringify({
|
type: "m.login.password",
|
||||||
type: "m.login.token",
|
user: username,
|
||||||
token: loginToken,
|
password: password,
|
||||||
initial_device_display_name: "Synapse Admin",
|
}
|
||||||
}),
|
)
|
||||||
};
|
),
|
||||||
} else {
|
};
|
||||||
// Invalid request
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
|
|
||||||
// use the base_url from login instead of the well_known entry from the
|
// use the base_url from login instead of the well_known entry from the
|
||||||
// server, since the admin might want to access the admin API via some
|
// server, since the admin might want to access the admin API via some
|
||||||
|
Loading…
Reference in New Issue
Block a user