Romi
Romi

Reputation: 4931

Reset password and lock user

I have a user registration form , in this form i am taking entry for name, email and password from user. I have buttons save and reset password. save button save data in database. now in reset password button I have to reset the password and lock the user. How can I do it. previously with this email and password user can entry in the system now after resetting password I have to lock this user. How, please suggest.

Upvotes: 0

Views: 144

Answers (1)

BalusC
BalusC

Reputation: 1109865

Add a column active to the DB which you set with a boolean or bit value, e.g. 0 or 1. If the user has registered and activated the account, set it to 1. If you want to lock the user, set it to 0.

On every incoming request with a logged-in user, you just check the active column associated with the ID of the logged-in user. If it's 0, then invalidate the session and redirect to the activation form.

Note: you normally use a servlet or, in this case better, a filter for this, not JSP/JSTL.

Upvotes: 1

Related Questions