-->

Devise Confirmation Resend “Login can't be bla

2019-08-20 06:52发布

问题:

ruby '1.9.3'

"rails", "3.2.13"

"devise", '~> 3.2.2'

I'm using the Devise confirmation controller without modification. I create a user and the email is sent. Then clicking on the link to confirm results in "Confirmation token is invalid". The token in the email is the same as in the database.

Also when the user is in Registrations edit I provided a link to resend the confirmation email. This brings the user to Confirmations New and you fill in the email and click the "Resend Confirmation instructions" button and receive the error "Login can't be blank." The user is logged in, otherwise they would not be able to get to users/edit or users/confirmation/new.

I have configured devise to accept a user_name or email for login.

回答1:

During password reset ensure resent_password_sent_at column against user record must be set to Time.now /time when particular password change token is being sent.

raw, enc = Devise.token_generator.generate(@user.class, :reset_password_token)
@user.update_attributes(reset_password_token: enc, reset_password_sent_at: Time.now)