Skip to content

Conversation

@printharsh
Copy link

@printharsh printharsh commented Dec 14, 2019

Tickets:

List of changes:

Added middleware to check if email is already taken on changing email for accounts.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Manually changed email.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

Copy link
Member

@loreina loreina left a comment

Choose a reason for hiding this comment

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

is this a jank fix 👀

Copy link
Member

@pierreTklein pierreTklein left a comment

Choose a reason for hiding this comment

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

This is the way I would do it:
have a middleware that does a query on hacker schema with given email. If it returns a hacker, and that hacker is not the hacker we are modifying, then do next({status: 409, ...}). We might even have this validation for account creation!

@printharsh printharsh changed the title Email already in use error handler added to findOneAndUpdate for application Create middleware to check if email is already in use for account changes. Dec 17, 2019
@loreina loreina requested a review from pierreTklein December 17, 2019 01:59
@printharsh printharsh requested review from pierreTklein and removed request for pierreTklein December 17, 2019 02:00
@loreina loreina mentioned this pull request Dec 17, 2019
9 tasks
@loreina loreina closed this Dec 17, 2019
@loreina loreina deleted the bugfix/errorMsgOnEmailChange branch July 30, 2020 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants