-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Forget Password #8
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JainPriya1234 Without email verification, how can you directly updating the password. Can you please explain.
@abhijeetnishal I am thinking about updating the password after OTP verification. |
@abhijeetnishal please review my approch.So that I can work on it. |
@JainPriya1234 ok I got your approach. |
@abhijeetnishal @varun-singhh please update |
@abhijeetnishal please review my PR |
Hey @JainPriya1234 atleast 2 approves are required. All contributer need to approve, wait for @varun-singhh once he approves then proceed. There are lot of projects to contribute. |
const { email, password } = req.body; | ||
if (!email || !password) throw Error("All fields are mandatory"); | ||
const { rows } = await pool.query( | ||
"SELECT * FROM admin WHERE email = $1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a condition to check password as well, this way you are not authenticating the user
); | ||
if (rows.length === 0) throw Error("Email not registered"); | ||
await pool.query( | ||
"UPDATE admin SET password = $1 WHERE email = $2 ",[password,email] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant set a password like this directly, will need encryption, check the register-user logic
Are you planning to implement OTP API as well? without that it is incomplete and cant be merged. LMK if you want help with the approach. Can consider this article for it |
@abhijeetnishal @kaustubhai @varun-singhh I think the flow should be this |
forgot password > Otp send ( if the email is valid) -> Submit OTP and Password -> save password. I'm satisfied with this approach. But... where are you planning to store the OTP to validate it? |
@kaustubhai yes i will store OTP in database but temporarily for 5-10 min |
Not sure how are you planning to do this but please go ahead. I would again suggest you to go through the article I shared before as storing data temporary will need in-memory db implementation like redis |
okay, @kaustubhai I will follow the article you suggested earlier |
Still working on this @JainPriya1234 ? |
@varun-singhh @abhijeetnishal Please review my PR for issue #5