Improve registration so the container page can pick what URL it's going to route through to registration.
This commit is contained in:
parent
23d9cee299
commit
77114e0081
5 changed files with 66 additions and 35 deletions
|
@ -30,7 +30,7 @@ module.exports = {
|
|||
return {
|
||||
onHsUrlChanged: function() {},
|
||||
onIsUrlChanged: function() {},
|
||||
default_hs_url: 'https://matrix.org/',
|
||||
default_hs_url: 'http://localhost:8008',
|
||||
default_is_url: 'https://matrix.org/'
|
||||
};
|
||||
},
|
||||
|
|
|
@ -81,9 +81,23 @@ module.exports = {
|
|||
break;
|
||||
case 'start_registration':
|
||||
if (this.state.logged_in) return;
|
||||
this.replaceState({
|
||||
screen: 'register'
|
||||
});
|
||||
var newState = payload.params || {};
|
||||
newState.screen = 'register';
|
||||
if (
|
||||
payload.params &&
|
||||
payload.params.client_secret &&
|
||||
payload.params.session_id &&
|
||||
payload.params.hs_url &&
|
||||
payload.params.is_url &&
|
||||
payload.params.sid
|
||||
) {
|
||||
newState.register_client_secret = payload.params.client_secret;
|
||||
newState.register_session_id = payload.params.session_id;
|
||||
newState.register_hs_url = payload.params.hs_url;
|
||||
newState.register_is_url = payload.params.is_url;
|
||||
newState.register_id_sid = payload.params.sid;
|
||||
}
|
||||
this.replaceState(newState);
|
||||
this.notifyNewScreen('register');
|
||||
break;
|
||||
case 'start_login':
|
||||
|
@ -165,22 +179,18 @@ module.exports = {
|
|||
dis.dispatch({action: 'focus_composer'});
|
||||
},
|
||||
|
||||
resumeRegistration(params) {
|
||||
if (!params.hs_url) return false;
|
||||
if (!params.is_url) return false;
|
||||
if (!params.client_secret) return false;
|
||||
if (!params.session_id) return false;
|
||||
if (!params.sid) return false;
|
||||
if (this.state.logged_in) return false;
|
||||
|
||||
this.setState({
|
||||
screen: 'register',
|
||||
register_client_secret: params.client_secret,
|
||||
register_session_id: params.session_id,
|
||||
register_hs_url: params.hs_url,
|
||||
register_is_url: params.is_url,
|
||||
register_id_sid: params.sid
|
||||
});
|
||||
showScreen(screen, params) {
|
||||
if (screen == 'register') {
|
||||
dis.dispatch({
|
||||
action: 'start_registration',
|
||||
params: params
|
||||
});
|
||||
} else if (screen == 'login') {
|
||||
dis.dispatch({
|
||||
action: 'start_login',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
notifyNewScreen: function(screen) {
|
||||
|
|
|
@ -189,10 +189,8 @@ module.exports = {
|
|||
this.savedParams.client_secret = cli.generateClientSecret();
|
||||
this.savedParams.send_attempt = 1;
|
||||
|
||||
var nextLink = window.location.protocol + '//' +
|
||||
window.location.host +
|
||||
window.location.pathname +
|
||||
'#/register?client_secret=' +
|
||||
var nextLink = this.props.registrationUrl +
|
||||
'?client_secret=' +
|
||||
encodeURIComponent(this.savedParams.client_secret) +
|
||||
"&hs_url=" +
|
||||
encodeURIComponent(this.state.hs_url) +
|
||||
|
@ -254,9 +252,9 @@ module.exports = {
|
|||
return (
|
||||
<div>
|
||||
<form onSubmit={this.onInitialStageSubmit}>
|
||||
Email: <input ref="email" /><br />
|
||||
Username: <input ref="username" /><br />
|
||||
Password: <input ref="password" /><br />
|
||||
Email: <input type="text" ref="email" /><br />
|
||||
Username: <input type="text" ref="username" /><br />
|
||||
Password: <input type="password" ref="password" /><br />
|
||||
<ServerConfig ref="serverConfig" />
|
||||
<input type="submit" value="Continue" />
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue