Merge pull request #405 from matrix-org/rav/use_right_hs_for_guest_login
Use the current HS for guest login
This commit is contained in:
commit
6802db05bd
2 changed files with 10 additions and 10 deletions
|
@ -47,18 +47,18 @@ import dis from './dispatcher';
|
||||||
* @param {boolean} opts.enableGuest: set to true to enable guest access tokens
|
* @param {boolean} opts.enableGuest: set to true to enable guest access tokens
|
||||||
* and auto-guest registrations.
|
* and auto-guest registrations.
|
||||||
*
|
*
|
||||||
* @params {string} opts.hsUrl: homeserver URL. Only used if enableGuest is
|
* @params {string} opts.guestHsUrl: homeserver URL. Only used if enableGuest is
|
||||||
* true; defines the HS to register against.
|
* true; defines the HS to register against.
|
||||||
*
|
*
|
||||||
* @params {string} opts.isUrl: homeserver URL. Only used if enableGuest is
|
* @params {string} opts.guestIsUrl: homeserver URL. Only used if enableGuest is
|
||||||
* true; defines the IS to use.
|
* true; defines the IS to use.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function loadSession(opts) {
|
export function loadSession(opts) {
|
||||||
const queryParams = opts.queryParams || {};
|
const queryParams = opts.queryParams || {};
|
||||||
let enableGuest = opts.enableGuest || false;
|
let enableGuest = opts.enableGuest || false;
|
||||||
const hsUrl = opts.hsUrl;
|
const guestHsUrl = opts.guestHsUrl;
|
||||||
const isUrl = opts.isUrl;
|
const guestIsUrl = opts.guestIsUrl;
|
||||||
|
|
||||||
if (queryParams.client_secret && queryParams.sid) {
|
if (queryParams.client_secret && queryParams.sid) {
|
||||||
// this happens during email validation: the email contains a link to the
|
// this happens during email validation: the email contains a link to the
|
||||||
|
@ -68,7 +68,7 @@ export function loadSession(opts) {
|
||||||
return q();
|
return q();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hsUrl) {
|
if (!guestHsUrl) {
|
||||||
console.warn("Cannot enable guest access: can't determine HS URL to use");
|
console.warn("Cannot enable guest access: can't determine HS URL to use");
|
||||||
enableGuest = false;
|
enableGuest = false;
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ export function loadSession(opts) {
|
||||||
setLoggedIn({
|
setLoggedIn({
|
||||||
userId: queryParams.guest_user_id,
|
userId: queryParams.guest_user_id,
|
||||||
accessToken: queryParams.guest_access_token,
|
accessToken: queryParams.guest_access_token,
|
||||||
homeserverUrl: hsUrl,
|
homeserverUrl: guestHsUrl,
|
||||||
identityServerUrl: isUrl,
|
identityServerUrl: guestIsUrl,
|
||||||
guest: true,
|
guest: true,
|
||||||
});
|
});
|
||||||
return q();
|
return q();
|
||||||
|
@ -93,7 +93,7 @@ export function loadSession(opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableGuest) {
|
if (enableGuest) {
|
||||||
return _registerAsGuest(hsUrl, isUrl);
|
return _registerAsGuest(guestHsUrl, guestIsUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fall back to login screen
|
// fall back to login screen
|
||||||
|
|
|
@ -173,8 +173,8 @@ module.exports = React.createClass({
|
||||||
Lifecycle.loadSession({
|
Lifecycle.loadSession({
|
||||||
queryParams: this.props.startingQueryParams,
|
queryParams: this.props.startingQueryParams,
|
||||||
enableGuest: this.props.enableGuest,
|
enableGuest: this.props.enableGuest,
|
||||||
hsUrl: this.getDefaultHsUrl(),
|
guestHsUrl: this.getCurrentHsUrl(),
|
||||||
isUrl: this.getDefaultIsUrl(),
|
guestIsUrl: this.getCurrentIsUrl(),
|
||||||
}).done(()=>{
|
}).done(()=>{
|
||||||
// stuff this through the dispatcher so that it happens
|
// stuff this through the dispatcher so that it happens
|
||||||
// after the on_logged_in action.
|
// after the on_logged_in action.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue