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:
luke crouch 2019-07-29 16:15:26 -05:00 коммит произвёл GitHub
Родитель 634b25311c 65222398ab
Коммит d4f361585a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 11 добавлений и 3 удалений

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

@ -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;
}
}
}
}