我在rails应用程序中为用户使用设备
当我点击忘记密码时,它会向用户发送重置密码指令的邮件。
但当我点击邮件中的密码重置链接时,它会重定向到我为用户编辑配置文件创建的自定义用户控制器。。。
如何调用设计密码编辑方法
下面是我的控制器/用户。
class UsersController < ApplicationController
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if @user.update_attributes(user_params)
flash[:notice] = "Profile successfully updated"
redirect_to authenticated_root_path
else
render 'edit'
end
end
def change_password
@user = User.find(current_user.id)
end
private
def user_params
params.require(:user).permit(:email, :first_name, :last_name,
:dob, :address, :zip_code, :about_me, :country_id, :state_id,
:city_id, :phone_no, :status, :profile_pic, :gender,
:password, :password_confirmation)
end
end
使用此路径重置设备的密码:
edit_user_registration_path