Merge pull request #688 from matrix-org/luke/rts-use-sid-client-secret
Instead of sending userId, userEmail, send sid, client_secret
This commit is contained in:
commit
a21e71f59d
2 changed files with 12 additions and 9 deletions
|
@ -50,18 +50,18 @@ export default class RtsClient {
|
||||||
* Track a referral with the Riot Team Server. This should be called once a referred
|
* Track a referral with the Riot Team Server. This should be called once a referred
|
||||||
* user has been successfully registered.
|
* user has been successfully registered.
|
||||||
* @param {string} referrer the user ID of one who referred the user to Riot.
|
* @param {string} referrer the user ID of one who referred the user to Riot.
|
||||||
* @param {string} userId the user ID of the user being referred.
|
* @param {string} sid the sign-up identity server session ID .
|
||||||
* @param {string} userEmail the email address linked to `userId`.
|
* @param {string} clientSecret the sign-up client secret.
|
||||||
* @returns {Promise} a promise that resolves to { team_token: 'sometoken' } upon
|
* @returns {Promise} a promise that resolves to { team_token: 'sometoken' } upon
|
||||||
* success.
|
* success.
|
||||||
*/
|
*/
|
||||||
trackReferral(referrer, userId, userEmail) {
|
trackReferral(referrer, sid, clientSecret) {
|
||||||
return request(this._url + '/register',
|
return request(this._url + '/register',
|
||||||
{
|
{
|
||||||
body: {
|
body: {
|
||||||
referrer: referrer,
|
referrer: referrer,
|
||||||
user_id: userId,
|
session_id: sid,
|
||||||
user_email: userEmail,
|
client_secret: clientSecret,
|
||||||
},
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,16 +213,19 @@ module.exports = React.createClass({
|
||||||
accessToken: response.access_token
|
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).
|
||||||
if (
|
if (
|
||||||
self._rtsClient &&
|
self._rtsClient &&
|
||||||
self.props.referrer &&
|
self.props.referrer
|
||||||
self.state.teamSelected
|
|
||||||
) {
|
) {
|
||||||
// Track referral, get team_token in order to retrieve team config
|
// Track referral, get team_token in order to retrieve team config
|
||||||
self._rtsClient.trackReferral(
|
self._rtsClient.trackReferral(
|
||||||
self.props.referrer,
|
self.props.referrer,
|
||||||
response.user_id,
|
self.registerLogic.params.idSid,
|
||||||
self.state.formVals.email
|
self.registerLogic.params.clientSecret
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
const teamToken = data.team_token;
|
const teamToken = data.team_token;
|
||||||
// Store for use /w welcome pages
|
// Store for use /w welcome pages
|
||||||
|
|
Loading…
Reference in a new issue