2016-06-01 1 views
-1

비밀 번호의 라우팅 업데이트가 어떻게 작동하는지 잘 모르겠습니다. 여러 가지 해결책을 찾아 보았지만 여전히 운이 없습니다.암호 경로에 대한 수정 경로 edit_user_registration_path는 암호 동작으로 나를 루트로 리디렉션합니다. 어떻게 변경합니까? - Rails 4

내가 뭘하려고입니다 : 사용자가 자신의 암호를 업데이트 할 때 그들이 dashboard_user_path 아닌 root_path로 리디렉션됩니다

  • -하지만 내가 사용자가 무엇을 중요 제가 dashboard_user_path
,369로 리다이렉트 할 방법 root_path
  • 에 다시 지시되는

    전망

    <%= link_to "change password", edit_user_registration_path(current_user) %> 
    

    application_controller.rb 파일

    내 모든 유증 방법 파일 after_resetting_password_path_for(resources)을 제외하고 작동, 나는 또한 after_update_path_for(resources)하지만 여전히 행운을 시도했습니다

    class ApplicationController < ActionController::Base 
        protect_from_forgery with: :exception 
        before_filter :configure_permitted_parameters, if: :devise_controller? 
    
        protected 
        def after_resetting_password_path_for(resources) 
        dashboard_user_path(current_user) 
        end 
    
        def after_sign_up_path_for(resources) 
        dashboard_user_path(current_user) 
        end 
    
        def after_sign_in_path_for(resources) 
        dashboard_user_path(current_user) 
        end 
    
        def after_sign_out_path_for(resources) 
        feedback_path 
        end 
    
        def configure_permitted_parameters 
        devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email) } 
        devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:firstname, :lastname, :email, :password) } 
        end 
    end 
    

    친절하게도 내가 뭘 잘못하고 있는지 조언 해 줄 수 있겠 어. 많은 감사

  • 답변

    -1

    암호를 잊었 기 때문에 로그인 할 수 없다는 가정하에 Devise의 암호 재설정이 작동합니다. 따라서 'current_user'가 존재하지 않으므로 사용자를 특정 '대시 보드'로 리디렉션 할 수 없습니다.

    인증 된 사용자가 자신의 암호를 변경하도록하려면 사용자가 암호를 잊어 버리지 않았으므로 변경하려는 별도의 경로를 작성하는 것이 좋습니다.