Use the current HS for guest login
Make sure that we use the homeserver from localstorage for guest regsistration, in preference to the default. Also rename the parameters for loadSessionpull/21833/head
							parent
							
								
									5b9d395234
								
							
						
					
					
						commit
						1fbddcf6af
					
				|  | @ -47,18 +47,18 @@ import dis from './dispatcher'; | |||
|  * @param {boolean} opts.enableGuest: set to true to enable guest access tokens | ||||
|  *     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. | ||||
|  * | ||||
|  * @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. | ||||
|  * | ||||
|  */ | ||||
| export function loadSession(opts) { | ||||
|     const queryParams = opts.queryParams || {}; | ||||
|     let enableGuest = opts.enableGuest || false; | ||||
|     const hsUrl = opts.hsUrl; | ||||
|     const isUrl = opts.isUrl; | ||||
|     const guestHsUrl = opts.guestHsUrl; | ||||
|     const guestIsUrl = opts.guestIsUrl; | ||||
| 
 | ||||
|     if (queryParams.client_secret && queryParams.sid) { | ||||
|         // this happens during email validation: the email contains a link to the
 | ||||
|  | @ -68,7 +68,7 @@ export function loadSession(opts) { | |||
|         return q(); | ||||
|     } | ||||
| 
 | ||||
|     if (!hsUrl) { | ||||
|     if (!guestHsUrl) { | ||||
|         console.warn("Cannot enable guest access: can't determine HS URL to use"); | ||||
|         enableGuest = false; | ||||
|     } | ||||
|  | @ -81,8 +81,8 @@ export function loadSession(opts) { | |||
|         setLoggedIn({ | ||||
|             userId: queryParams.guest_user_id, | ||||
|             accessToken: queryParams.guest_access_token, | ||||
|             homeserverUrl: hsUrl, | ||||
|             identityServerUrl: isUrl, | ||||
|             homeserverUrl: guestHsUrl, | ||||
|             identityServerUrl: guestIsUrl, | ||||
|             guest: true, | ||||
|         }); | ||||
|         return q(); | ||||
|  | @ -93,7 +93,7 @@ export function loadSession(opts) { | |||
|     } | ||||
| 
 | ||||
|     if (enableGuest) { | ||||
|         return _registerAsGuest(hsUrl, isUrl); | ||||
|         return _registerAsGuest(guestHsUrl, guestIsUrl); | ||||
|     } | ||||
| 
 | ||||
|     // fall back to login screen
 | ||||
|  |  | |||
|  | @ -173,8 +173,8 @@ module.exports = React.createClass({ | |||
|         Lifecycle.loadSession({ | ||||
|             queryParams: this.props.startingQueryParams, | ||||
|             enableGuest: this.props.enableGuest, | ||||
|             hsUrl: this.getDefaultHsUrl(), | ||||
|             isUrl: this.getDefaultIsUrl(), | ||||
|             guestHsUrl: this.getCurrentHsUrl(), | ||||
|             guestIsUrl: this.getCurrentIsUrl(), | ||||
|         }).done(()=>{ | ||||
|             // stuff this through the dispatcher so that it happens
 | ||||
|             // after the on_logged_in action.
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Richard van der Hoff
						Richard van der Hoff