This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 808
Fix the team server integration #738
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,7 @@ module.exports = React.createClass({ | |
|
|
||
| componentWillMount: function() { | ||
| this._unmounted = false; | ||
| this._authLogic = null; | ||
|
|
||
| this._replaceClient(); | ||
|
|
||
|
|
@@ -168,26 +169,19 @@ module.exports = React.createClass({ | |
| busy: true, | ||
| doingUIAuth: false, | ||
| }); | ||
| this.props.onLoggedIn({ | ||
| userId: response.user_id, | ||
| deviceId: response.device_id, | ||
| homeserverUrl: this.state.hsUrl, | ||
| identityServerUrl: this.state.isUrl, | ||
| accessToken: response.access_token, | ||
| }); | ||
|
|
||
| // Done regardless of `teamSelected`. People registering with non-team emails | ||
| // will just nop. The point of this being we might not have the email address | ||
| // that the user registered with at this stage (depending on whether this | ||
| // is the client they initiated registration). | ||
| let trackPromise = q(null); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the same thing as was done after the trackPromise: we should just do it then. |
||
| if (this._rtsClient) { | ||
| if (this._rtsClient && this._authLogic.getEmailSid()) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The referral tracking only makes sense if we registered with an email |
||
| // Track referral if this.props.referrer set, get team_token in order to | ||
| // retrieve team config and see welcome page etc. | ||
| trackPromise = this._rtsClient.trackReferral( | ||
| this.props.referrer || '', // Default to empty string = not referred | ||
| this.registerLogic.params.idSid, | ||
| this.registerLogic.params.clientSecret | ||
| this._authLogic.getEmailSid(), | ||
| this._authLogic.getClientSecret(), | ||
| ).then((data) => { | ||
| const teamToken = data.team_token; | ||
| // Store for use /w welcome pages | ||
|
|
@@ -223,13 +217,13 @@ module.exports = React.createClass({ | |
| this.props.onLoggedIn({ | ||
| userId: response.user_id, | ||
| deviceId: response.device_id, | ||
| homeserverUrl: this.registerLogic.getHomeserverUrl(), | ||
| identityServerUrl: this.registerLogic.getIdentityServerUrl(), | ||
| homeserverUrl: this._matrixClient.getHomeserverUrl(), | ||
| identityServerUrl: this._matrixClient.getIdentityServerUrl(), | ||
| accessToken: response.access_token | ||
| }, teamToken); | ||
| }).then(() => { | ||
| return this._setupPushers(); | ||
| }).done(); | ||
| }); | ||
| }, | ||
|
|
||
| _setupPushers: function() { | ||
|
|
@@ -316,14 +310,18 @@ module.exports = React.createClass({ | |
| ); | ||
| }, | ||
|
|
||
| _getUIAuthInputs() { | ||
| _getUIAuthInputs: function() { | ||
| return { | ||
| emailAddress: this.state.formVals.email, | ||
| phoneCountry: this.state.formVals.phoneCountry, | ||
| phoneNumber: this.state.formVals.phoneNumber, | ||
| } | ||
| }, | ||
|
|
||
| _onAuthObject: function(authLogic) { | ||
| this._authLogic = authLogic; | ||
| }, | ||
|
|
||
| render: function() { | ||
| const LoginHeader = sdk.getComponent('login.LoginHeader'); | ||
| const LoginFooter = sdk.getComponent('login.LoginFooter'); | ||
|
|
@@ -343,6 +341,7 @@ module.exports = React.createClass({ | |
| sessionId={this.props.sessionId} | ||
| clientSecret={this.props.clientSecret} | ||
| emailSid={this.props.idSid} | ||
| onAuthObject={this._onAuthObject} | ||
| poll={true} | ||
| /> | ||
| ); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is surely horrible. why not pass an
optsobject into theonAuthFinishedcallback with theemailSidandclientSecret?