revert(brokers): add uid to can_link_account in FxSyncChannel (#5492) r=@shane-tomlinson
This reverts commit 7f2abc6837
.
This commit is contained in:
Родитель
b8f299bb48
Коммит
453a3f6be0
|
@ -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);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче