Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Fixes issue #311 Use email buffer for DEL ‘/email/:email’ route #315

Merged
merged 2 commits into from
Mar 10, 2018

Conversation

deeptibaghel
Copy link
Contributor

Made changes to fix issue #311 Use email buffer for DEL ‘/email/:email’ route.
Also fixed Buffer function call to take care of deprecated format.

Copy link
Contributor

@vladikoff vladikoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ , looks good to me!

@vladikoff vladikoff requested a review from vbudhram March 9, 2018 17:35
@vladikoff
Copy link
Contributor

vladikoff commented Mar 9, 2018

@vbudhram could you please do a quick glance at this (and maybe merge?)

@deeptibaghel

  1. I filed Convert remaining '= Buffer(stuff)' to 'Buffer.from(stuff,...)' #316 there are a few remaining Buffer() calls in the old format that can be fixed. I think just a few left!
  2. I filed an auth server issue here: Migrate to Buffer.from fxa-auth-server#2333
  3. I noticed that you had a question about this PR in the issue itself (Use email buffer for DEL /email/:email route #311), to make it easier just ask questions in the pull request. If you don't have a pull request sent yet, just create a pull request and mention that it is a work in progress with your doubt / question

@deeptibaghel
Copy link
Contributor Author

I noticed that you had a question about this PR in the issue itself (#311), to make it easier just ask questions in the pull request. If you don't have a pull request sent yet, just create a pull request and mention that it is a work in progress with your doubt / question

Will take care :)

Copy link
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I think the only blocking change here is to not pass a buffered email to the set primary email route. We should be able to fix mozilla/fxa-auth-server#2334 in follow up PR.

})
)
api.get('/email/:email/account',
op(function (req) {
return db.accountRecord(Buffer(req.params.email, 'hex'))
return db.accountRecord(req.params.email)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed somehow, done now.

@@ -192,7 +192,7 @@ module.exports = function(cfg, makeServer) {
assert.equal(!! result[2].isPrimary, false, 'isPrimary is false on thirdEmailRecord email')
assert.equal(!! result[2].isVerified, false, 'matches secondEmail thirdEmailRecord')

return client.delThen('/account/' + user.accountId + '/emails/' + secondEmailRecord.email)
return client.delThen('/account/' + user.accountId + '/emails/' + emailToHex(secondEmailRecord.email))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! But we will also need to update the auth-server to pass an encoded email, similar to https://github.com/mozilla/fxa-auth-server/blob/45ae7b2048e9115590611a55454627d3840119a8/lib/db.js#L1069.

Ref: mozilla/fxa-auth-server#2334

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure i will complete it :)

Copy link
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deeptibaghel Tested this against mozilla/fxa-auth-server#2336 and all ✅, r+!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants