Merge pull request #1149 from mozilla/fix-unable-to-sign-in-1084-1146
fix #1084 fix #1146 - only put ids and emails into user object
This commit is contained in:
Коммит
d4f361585a
5
db/DB.js
5
db/DB.js
|
@ -52,9 +52,12 @@ const DB = {
|
|||
|
||||
async joinEmailAddressesToSubscriber(subscriber) {
|
||||
if (subscriber) {
|
||||
subscriber.email_addresses = await knex("email_addresses").where({
|
||||
const emailAddressRecords = await knex("email_addresses").where({
|
||||
"subscriber_id": subscriber.id,
|
||||
});
|
||||
subscriber.email_addresses = emailAddressRecords.map(
|
||||
emailAddress=>({id: emailAddress.id, email: emailAddress.email})
|
||||
);
|
||||
}
|
||||
return subscriber;
|
||||
},
|
||||
|
|
|
@ -35,8 +35,13 @@ const scanResult = async(req, selfScan=false) => {
|
|||
scannedEmailId = req.body.scannedEmailId;
|
||||
}
|
||||
|
||||
if (!selfScan && signedInUser && sha1(signedInUser.email) === req.body.emailHash) {
|
||||
selfScan = true;
|
||||
if (signedInUser) {
|
||||
for (const emailAddress of signedInUser.email_addresses) {
|
||||
if (!selfScan && sha1(emailAddress.email) === req.body.emailHash) {
|
||||
selfScan = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче