Add support for CAS auth
This commit is contained in:
parent
a05437e81f
commit
a8d51cdf58
4 changed files with 74 additions and 11 deletions
|
@ -23,22 +23,29 @@ sdk.loadModule(require('../modules/VectorConferenceHandler'));
|
|||
|
||||
var lastLocationHashSet = null;
|
||||
|
||||
|
||||
function parseQueryParams(location) {
|
||||
var hashparts = location.hash.split('?');
|
||||
var params = {};
|
||||
if (hashparts.length == 2) {
|
||||
var pairs = hashparts[1].split('&');
|
||||
for (var i = 0; i < pairs.length; ++i) {
|
||||
var parts = pairs[i].split('=');
|
||||
if (parts.length != 2) continue;
|
||||
params[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
// Here, we do some crude URL analysis to allow
|
||||
// deep-linking. We only support registration
|
||||
// deep-links in this example.
|
||||
function routeUrl(location) {
|
||||
if (location.hash.indexOf('#/register') == 0) {
|
||||
var hashparts = location.hash.split('?');
|
||||
var params = {};
|
||||
if (hashparts.length == 2) {
|
||||
var pairs = hashparts[1].split('&');
|
||||
for (var i = 0; i < pairs.length; ++i) {
|
||||
var parts = pairs[i].split('=');
|
||||
if (parts.length != 2) continue;
|
||||
params[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
|
||||
}
|
||||
}
|
||||
window.matrixChat.showScreen('register', params);
|
||||
window.matrixChat.showScreen('register', parseQueryParams(location));
|
||||
} else if (location.hash.indexOf('#/login/cas') == 0) {
|
||||
window.matrixChat.showScreen('cas_login', parseQueryParams(location));
|
||||
} else {
|
||||
window.matrixChat.showScreen(location.hash.substring(2));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue