ruby on rails - NoMethodError - undefined method `reset_password_token' for User:Class: -
In my rail
application, I have a form of admin to create a normal user. In create
verb {/ code>}, I am generating a reset password token, and sending a welcome mail to a user with a link to reset their password. This is my code.
< P> This works fine, but I have an app with the same code, but it uses it for @user = User New Param [[user] @ user.reset_password_token = user.reset_password_token @ user.reset_password_sent_at = Smaykanuktk if @ user.save user mailer .welcome_email (@user) .deliver ..
3.2.2
I get this error.
NoMethodError - undefined method 'reset_password_token' User Class:
I know that the method has been removed. How can I generate a reset password token and send it to a user?
Note: I default reset passwords do not send e-mail
devise
after digging into the source code, I got to work with it
crude, encoding = Devise.token_generator.generate (user ,: reset_password_token) @ user.reset_password_token = enc @ user.reset_password_sent_at = Smaykanuktak if @ user.save UserMailer.welcome_email (@user, raw) .deliver ..
Use raw
as reset_password_token
Comments
Post a Comment