revert(brokers): add uid to can_link_account in FxSyncChannel (#5492) r=@shane-tomlinson

This reverts commit 7f2abc6837.
This commit is contained in:
Edouard Oger 2017-09-18 06:01:00 -07:00 коммит произвёл Shane Tomlinson
Родитель b8f299bb48
Коммит 453a3f6be0
3 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -109,9 +109,7 @@ define(function (require, exports, module) {
beforeSignIn (account) { beforeSignIn (account) {
const email = account.get('email'); const email = account.get('email');
const uid = account.get('uid'); if (this._verifiedCanLinkEmail === email) {
if (this._verifiedCanLinkEmail === email &&
this._verifiedCanLinkUid === uid) {
// This user has already been asked and responded that // This user has already been asked and responded that
// they want to link the account. Do not ask again or // they want to link the account. Do not ask again or
// else the user sees the "can link account" browser // else the user sees the "can link account" browser
@ -123,14 +121,13 @@ define(function (require, exports, module) {
// we should cancel the login to sync or not based on Desktop // we should cancel the login to sync or not based on Desktop
// specific checks and dialogs. It throws an error with // specific checks and dialogs. It throws an error with
// message='USER_CANCELED_LOGIN' and errno=1001 if that's the case. // message='USER_CANCELED_LOGIN' and errno=1001 if that's the case.
return this.request(this.getCommand('CAN_LINK_ACCOUNT'), { email, uid }) return this.request(this.getCommand('CAN_LINK_ACCOUNT'), { email })
.then((response) => { .then((response) => {
if (response && ! response.ok) { if (response && ! response.ok) {
throw AuthErrors.toError('USER_CANCELED_LOGIN'); throw AuthErrors.toError('USER_CANCELED_LOGIN');
} }
this._verifiedCanLinkEmail = email; this._verifiedCanLinkEmail = email;
this._verifiedCanLinkUid = uid;
return proto.beforeSignIn.call(this, account); return proto.beforeSignIn.call(this, account);
}, (err) => { }, (err) => {
this._logger.error('beforeSignIn failed with', err); this._logger.error('beforeSignIn failed with', err);
@ -279,9 +276,7 @@ define(function (require, exports, module) {
_getLoginData (account) { _getLoginData (account) {
const loginData = account.pick(ALLOWED_LOGIN_FIELDS); const loginData = account.pick(ALLOWED_LOGIN_FIELDS);
loginData.verified = !! loginData.verified; loginData.verified = !! loginData.verified;
loginData.verifiedCanLinkAccount = !! this._verifiedCanLinkEmail && loginData.verifiedCanLinkAccount = !! this._verifiedCanLinkEmail;
!! this._verifiedCanLinkUid;
return _.omit(loginData, _.isUndefined); return _.omit(loginData, _.isUndefined);
} }
}, { }, {

Просмотреть файл

@ -112,7 +112,7 @@ define(function (require, exports, module) {
}); });
}); });
return channel.request('can_link_account', { email: 'testuser@testuser.com', uid: 'uid' }) return channel.request('can_link_account', { email: 'testuser@testuser.com' })
.then(function (response) { .then(function (response) {
assert.isTrue(response.ok); assert.isTrue(response.ok);
}); });

Просмотреть файл

@ -206,7 +206,6 @@ define(function (require, exports, module) {
.then(() => { .then(() => {
assert.equal(channelMock.send.args[0][0], 'can_link_account'); assert.equal(channelMock.send.args[0][0], 'can_link_account');
const data = channelMock.send.args[1][1]; const data = channelMock.send.args[1][1];
assert.equal(data.uid, 'uid');
assert.equal(data.email, 'testuser@testuser.com'); assert.equal(data.email, 'testuser@testuser.com');
assert.isFalse(data.verified); assert.isFalse(data.verified);
assert.isTrue(data.verifiedCanLinkAccount); assert.isTrue(data.verifiedCanLinkAccount);