qba
qba

Reputation: 201

J2EE spring security one time link for password reset

I'm using spring (3.0) security for login in my J2EE spring webapp. I need to generate a link that will be sent by email (to a user that request password reset) and can be used one time only to reset a password and set a new one by a page with form. How can I generate this kind of link?

Upvotes: 1

Views: 2242

Answers (1)

danny.lesnik
danny.lesnik

Reputation: 18639

It depends on how do you store user credentials:

If you implement UserDetails and CredentialsContainer for your User Entity, then you can add some kind of reset password boolean field with some kind of unique id which will be send as part of URL, if user navigate to correct URL according to link and he has reset password boolean flag enabled, then show him form which updates password and disables reset password flag on submit.

Upvotes: 3

Related Questions