Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6a2c2d6

Browse files
authored
Merge pull request #1109 from matrix-org/rav/fix_cas_login
Avoid getting stuck in a loop in CAS login
2 parents 131e3ae + 1f719b3 commit 6a2c2d6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Login.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,18 @@ export default class Login {
178178
}
179179

180180
redirectToCas() {
181-
var client = this._createTemporaryClient();
182-
var parsedUrl = url.parse(window.location.href, true);
181+
const client = this._createTemporaryClient();
182+
const parsedUrl = url.parse(window.location.href, true);
183+
184+
// XXX: at this point, the fragment will always be #/login, which is no
185+
// use to anyone. Ideally, we would get the intended fragment from
186+
// MatrixChat.screenAfterLogin so that you could follow #/room links etc
187+
// through a CAS login.
188+
parsedUrl.hash = "";
189+
183190
parsedUrl.query["homeserver"] = client.getHomeserverUrl();
184191
parsedUrl.query["identityServer"] = client.getIdentityServerUrl();
185-
var casUrl = client.getCasLoginUrl(url.format(parsedUrl));
192+
const casUrl = client.getCasLoginUrl(url.format(parsedUrl));
186193
window.location.href = casUrl;
187194
}
188195
}

0 commit comments

Comments
 (0)