has_secure_password :recovery_password
This commit is contained in:
parent
49998ee5b7
commit
639eb2ba04
5 changed files with 14 additions and 7 deletions
|
@ -24,10 +24,10 @@ class UsersController < ApplicationController
|
|||
|
||||
def recover_password
|
||||
user = User.find(params[:user_id])
|
||||
if user.password_recovery_code == params[:recovery_code]
|
||||
if user.authenticate_recovery_password(params[:recovery_code])
|
||||
user.password = params[:password]
|
||||
user.password_confirmation = params[:repeated_password]
|
||||
user.password_recovery_code = nil
|
||||
user.recovery_password_digest = nil
|
||||
if user.save
|
||||
redirect_to '/welcome'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue