Add support for CAS login
This commit is contained in:
parent
05d19121d8
commit
3f67d8541f
1 changed files with 30 additions and 0 deletions
|
@ -126,6 +126,31 @@ module.exports = {
|
||||||
screen: 'login'
|
screen: 'login'
|
||||||
});
|
});
|
||||||
this.notifyNewScreen('login');
|
this.notifyNewScreen('login');
|
||||||
|
break;
|
||||||
|
case 'cas_login':
|
||||||
|
if (this.state.logged_in) return;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
var client = MatrixClientPeg.get();
|
||||||
|
var splitLocation = window.location.href.split('/');
|
||||||
|
var serviceUrl = splitLocation[0] + "//" + splitLocation[2];
|
||||||
|
|
||||||
|
client.loginWithCas(payload.params.ticket, serviceUrl).done(function(data) {
|
||||||
|
MatrixClientPeg.replaceUsingAccessToken(
|
||||||
|
client.getHsUrl(), client.getIsUrl(),
|
||||||
|
data.user_id, data.access_token
|
||||||
|
);
|
||||||
|
self.setState({
|
||||||
|
screen: undefined,
|
||||||
|
logged_in: true
|
||||||
|
});
|
||||||
|
self.startMatrixClient();
|
||||||
|
self.notifyNewScreen('');
|
||||||
|
}, function(error) {
|
||||||
|
self.notifyNewScreen('login');
|
||||||
|
self.setState({errorText: 'Login failed.'});
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'view_room':
|
case 'view_room':
|
||||||
this.focusComposer = true;
|
this.focusComposer = true;
|
||||||
|
@ -314,6 +339,11 @@ module.exports = {
|
||||||
action: 'start_login',
|
action: 'start_login',
|
||||||
params: params
|
params: params
|
||||||
});
|
});
|
||||||
|
} else if (screen == 'cas_login') {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'cas_login',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
} else if (screen.indexOf('room/') == 0) {
|
} else if (screen.indexOf('room/') == 0) {
|
||||||
var roomString = screen.split('/')[1];
|
var roomString = screen.split('/')[1];
|
||||||
if (roomString[0] == '#') {
|
if (roomString[0] == '#') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue