How to generate reset password token
devise, ruby-on-rails
Solution
You can use `user.send_reset_password_instructions` for that.
Problem
I am using devise gem for authentication. In my application admin will create the users, so I want the user's reset password link when admin creates users. This is my action:- ``` def create @user = User.new(user_params) @user.password = '123123123' @user.password_confirmation = '123123123' if @user.save @user.update_attributes(:confirmation_token => nil,:confirmed_at => Time.now,:reset_password_token => (0...16).map{(65+rand(26)).chr}.join,:reset_password_sent_at => Time.now) UserMailer.user_link(@user).deliver redirect_to users_path else render :action => "new" end end ``` This is my link to reset a user's password But I am getting reset password token is invalid when I open the link and update the password.