[英]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.