mirror of https://github.com/vector-im/riot-web
Use localStorage team token with fall-back on query parameter
parent
b9bc8eefd0
commit
efae5f6bf1
|
@ -42,6 +42,8 @@ export default React.createClass({
|
||||||
onRoomCreated: React.PropTypes.func,
|
onRoomCreated: React.PropTypes.func,
|
||||||
onUserSettingsClose: React.PropTypes.func,
|
onUserSettingsClose: React.PropTypes.func,
|
||||||
|
|
||||||
|
teamToken: React.PropTypes.string,
|
||||||
|
|
||||||
// and lots and lots of other stuff.
|
// and lots and lots of other stuff.
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -197,7 +199,7 @@ export default React.createClass({
|
||||||
page_element = <HomePage
|
page_element = <HomePage
|
||||||
collapsedRhs={this.props.collapse_rhs}
|
collapsedRhs={this.props.collapse_rhs}
|
||||||
teamServerUrl={this.props.config.teamServerConfig.teamServerURL}
|
teamServerUrl={this.props.config.teamServerConfig.teamServerURL}
|
||||||
teamToken={window.localStorage.getItem("mx_team_token")}
|
teamToken={this.props.teamToken}
|
||||||
/>
|
/>
|
||||||
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>
|
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -190,6 +190,11 @@ module.exports = React.createClass({
|
||||||
if (this.props.config.sync_timeline_limit) {
|
if (this.props.config.sync_timeline_limit) {
|
||||||
MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit;
|
MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the locally-stored team token first, then as a fall-back, check to see if
|
||||||
|
// a referral link was used, which will contain a query parameter `team_token`.
|
||||||
|
this._teamToken = window.localStorage.getItem('mx_team_token') ||
|
||||||
|
startingFragmentQueryParams.team_token;
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
@ -694,7 +699,7 @@ module.exports = React.createClass({
|
||||||
)[0].roomId;
|
)[0].roomId;
|
||||||
self.setState({ready: true, currentRoomId: firstRoom, page_type: PageTypes.RoomView});
|
self.setState({ready: true, currentRoomId: firstRoom, page_type: PageTypes.RoomView});
|
||||||
} else {
|
} else {
|
||||||
if (window.localStorage.getItem('mx_team_token')) {
|
if (this._teamToken) {
|
||||||
self.setState({ready: true, page_type: PageTypes.HomePage});
|
self.setState({ready: true, page_type: PageTypes.HomePage});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1051,6 +1056,7 @@ module.exports = React.createClass({
|
||||||
onRoomIdResolved={this.onRoomIdResolved}
|
onRoomIdResolved={this.onRoomIdResolved}
|
||||||
onRoomCreated={this.onRoomCreated}
|
onRoomCreated={this.onRoomCreated}
|
||||||
onUserSettingsClose={this.onUserSettingsClose}
|
onUserSettingsClose={this.onUserSettingsClose}
|
||||||
|
teamToken={this._teamToken}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
{...this.state}
|
{...this.state}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue