设计密码重置错误

时间:2015-07-24 06:44:09

标签: ruby-on-rails ruby-on-rails-4 devise

我已经在我的应用程序中设置了设置,当我尝试重置密码时,会生成这两个网址,其中只有第一个工作正常。

http://<domain>/password/edit?reset_password_token=SawsfhnpFRPHsxj_HjRhJ <--- works
http://<domain>/users/password/edit?reset_password_token=o1x1wFjQZxWnAug7K1zo

当用户想要重置密码时,是否有任何方法可以确保它生成正确的URL?

路线

# Devise Authentication
  devise_for :users, :controllers => { :registrations => "registrations", :sessions => "sessions" },
                                        :path => "",
                                        :path_names => { :sign_in => 'login',
                                                         :sign_out => 'logout',
                                                         :sign_up => 'signup',
                                                         :edit => 'profile/edit' }

  devise_scope :user do
    match '/update_password' => 'registrations#update_password', via: :post
  end

应用/视图/用户/邮寄者/ reset_password_instructions.html.erb

<p><%= link_to 'Click here', edit_password_url(@resource, reset_password_token: @token) %> to reset your password</p>

当我rake routes我找不到上述路线时。

找到这些路线

user_password POST   /password(.:format)                                             devise/passwords#create
                                   new_user_password GET    /password/new(.:format)                                         devise/passwords#new
                                  edit_user_password GET    /password/edit(.:format)                                        devise/passwords#edit
                                                     PATCH  /password(.:format)                                             devise/passwords#update
                                                     PUT    /password(.:format)                                             devise/passwords#update

1 个答案:

答案 0 :(得分:1)

将其保留在devise_for范围内

    DialogBox dialog = new DialogBox(autoHide, true);
    dialog.setText("Hello GWT DialogBox");
    dialog.setGlassEnabled(true);
    dialog.center();
    dialog.show();