Skip to content

Conversation

@shreyanshdwivedi
Copy link
Member

Fixes #6069

Short description of what this resolves:

Raising an error on password reset if the user is not registered is like gifting hackers a list of users present in the database.

Changes proposed in this pull request:

  • Updates the message is user is not registered on reset password

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the fix label Jun 20, 2019
@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

Merging #6079 into development will increase coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@              Coverage Diff               @@
##           development   #6079      +/-   ##
==============================================
+ Coverage        66.19%   66.2%   +<.01%     
==============================================
  Files              285     285              
  Lines            14195   14197       +2     
==============================================
+ Hits              9397    9399       +2     
  Misses            4798    4798
Impacted Files Coverage Δ
app/api/auth.py 24.22% <50%> (+0.67%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af2ee84...2f04bc2. Read the comment docs.

@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal the server responds with message If your email was registered with us, you'll get an email with reset link shortly and status 200 always. Do you want to update FE message too? Currently it shows - Please go to the link sent to your email to reset your password

@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal I've updated the PR. Please review

@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal I'm logging email for both the cases so that user cannot differentiate from response that whether email is registered or not. Please review

@iamareebjamal
Copy link
Member

Logs are for us and not the user. I want to differentiate between valid and non valid emails

@shreyanshdwivedi shreyanshdwivedi force-pushed the errorOnReset branch 2 times, most recently from eb44044 to 22cabff Compare June 21, 2019 11:21
@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal I have logged email in case of NoResultFound exception. Please have a look

app/api/auth.py Outdated
user = User.query.filter_by(email=email).one()
except NoResultFound:
return NotFoundError({'source': ''}, 'User not found').respond()
logging.info(email)
Copy link
Member

@iamareebjamal iamareebjamal Jun 25, 2019

Choose a reason for hiding this comment

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

Create a logger. Never use root logging module.

Also, logging just the email makes no sense. What will I know from that. Properly log Tried to reset password not existing email

@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal created a logger and logged the proper info. Please review

Copy link
Member

@mrsaicharan1 mrsaicharan1 left a comment

Choose a reason for hiding this comment

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

Previously logging info wasn't there but now it's fine. LGTM

@iamareebjamal iamareebjamal merged commit 88d1b13 into fossasia:development Jun 26, 2019
iamareebjamal pushed a commit to iamareebjamal/open-event-server that referenced this pull request Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error raised on reset password if user is not registered

5 participants