fix privacy lookup stage filtering
This commit is contained in:
parent
85ec4ab962
commit
85b7d570e6
1 changed files with 2 additions and 2 deletions
|
@ -81,8 +81,8 @@ export class HomeServer {
|
||||||
const options = {method: "POST", body: "{}", headers};
|
const options = {method: "POST", body: "{}", headers};
|
||||||
const {status, body} = await this._request(`${this.baseURL}/_matrix/client/r0/register`, options).response();
|
const {status, body} = await this._request(`${this.baseURL}/_matrix/client/r0/register`, options).response();
|
||||||
if (status === 401 && body) { // Unauthorized
|
if (status === 401 && body) { // Unauthorized
|
||||||
const stages = body.flows?.stages;
|
const hasTermsStage = body.flows.some(flow => flow.stages.includes("m.login.terms"));
|
||||||
if (Array.isArray(stages) && stages.includes("m.login.terms")) {
|
if (hasTermsStage) {
|
||||||
const privacyPolicy = body.params?.["m.login.terms"]?.policies?.privacy_policy;
|
const privacyPolicy = body.params?.["m.login.terms"]?.policies?.privacy_policy;
|
||||||
if (privacyPolicy) {
|
if (privacyPolicy) {
|
||||||
const firstLang = Object.keys(privacyPolicy).find(k => k !== "version");
|
const firstLang = Object.keys(privacyPolicy).find(k => k !== "version");
|
||||||
|
|
Loading…
Reference in a new issue