Redirect to the registration page when landing with ?email=

Fixes "Missing access token" error.
This commit is contained in:
Kegan Dougal 2016-01-27 10:47:54 +00:00
parent fcf6afbe06
commit db8fab8019

View file

@ -96,6 +96,10 @@ module.exports = React.createClass({
if (!this.props.config || !this.props.config.default_hs_url) {
console.error("Cannot enable guest access: No supplied config prop for HS/IS URLs");
}
else if (this.props.startingQueryParams.email) {
console.log("Not registering as guest; email invite.");
this._autoRegisterAsGuest = false;
}
else {
this._autoRegisterAsGuest = true;
}
@ -634,6 +638,14 @@ module.exports = React.createClass({
action: 'start_post_registration',
});
} else if (screen.indexOf('room/') == 0) {
if (!this.state.logged_in && this.props.startingQueryParams.email) {
console.log("Redirecting to email registration");
this.showScreen("register");
this.notifyNewScreen('register'); // this doesn't call showScreen, just updates the hash
return;
}
var roomString = screen.split('/')[1];
if (roomString[0] == '#') {
if (this.state.logged_in) {
@ -655,7 +667,7 @@ module.exports = React.createClass({
}
}
else {
if (screen) console.error("Unknown screen : %s", screen);
console.error("Unknown screen : %s", screen);
}
},
@ -802,7 +814,6 @@ module.exports = React.createClass({
var RoomDirectory = sdk.getComponent('structures.RoomDirectory');
var MatrixToolbar = sdk.getComponent('globals.MatrixToolbar');
var ForgotPassword = sdk.getComponent('structures.login.ForgotPassword');
// needs to be before normal PageTypes as you are logged in technically
if (this.state.screen == 'post_registration') {
return (