Merge pull request #220 from matrix-org/matthew/cancellable-upgrade

allow registration and login from guest to be cancellable
This commit is contained in:
Matthew Hodgson 2016-03-16 14:38:00 +00:00
commit 74aad34dfb
3 changed files with 60 additions and 5 deletions

View file

@ -44,7 +44,8 @@ module.exports = React.createClass({
username: React.PropTypes.string,
guestAccessToken: React.PropTypes.string,
// registration shouldn't know or care how login is done.
onLoginClick: React.PropTypes.func.isRequired
onLoginClick: React.PropTypes.func.isRequired,
onCancelClick: React.PropTypes.func
},
getInitialState: function() {
@ -238,6 +239,15 @@ module.exports = React.createClass({
<Spinner />
);
}
var returnToAppJsx;
if (this.props.onCancelClick) {
returnToAppJsx =
<a className="mx_Login_create" onClick={this.props.onCancelClick} href="#">
Return to app
</a>
}
return (
<div>
<h2>Create an account</h2>
@ -258,6 +268,7 @@ module.exports = React.createClass({
<a className="mx_Login_create" onClick={this.props.onLoginClick} href="#">
I already have an account
</a>
{ returnToAppJsx }
</div>
);
},