繁体   English   中英

使用devise rails忘记密码

[英]forgot password using devise rails

我在Rails应用程序中为用户使用devise

当我单击“忘记密码”时,它将向用户发送邮件以获取重置密码说明。

但是当我单击邮件中的密码重置链接时,它将重定向到我为用户编辑配置文件创建的自定义用户控制器...

如何调用设计密码编辑方法

以下是我的控制器/用户。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM