简体   繁体   English

自定义设计:会话控制器故障

[英]Custom Devise: Sessions Controller Failure

My custom Devise Sessions controller isn't letting me sign in. I've had several difficulties trying to customize the Devise controllers, but I can't figure out what's going on here. 我的自定义Devise Sessions控制器不允许我登录。尝试自定义Devise控制器时遇到了许多困难,但我不知道这是怎么回事。

When I try to sign in, the page (sessions#new) simply re-renders. 当我尝试登录时,页面(sessions#new)只是重新呈现。 How can I get my custom controller back to full functionality? 如何使自定义控制器恢复全部功能?

# controllers/sessions_controller

class SessionsController < Devise::SessionsController
  skip_before_filter :store_last_attempted_location
  skip_after_filter  :store_last_successful_location

  def new
    super
  end

  def create
    super
  end

  def destroy
    super
  end
end

My routes 我的路线

#config/routes.rb

devise_for :users, :controllers => { :sessions => "sessions", :registrations => "registrations"  }

Thanks in advance. 提前致谢。

If the sign in page is re-rendered after entering the user credentials then it means that the credentials are invalid which is resulting in the re-rendering. 如果在输入用户凭据后重新渲染了登录页面,则意味着凭据无效,这将导致重新渲染。 But that should have resulted in a flash message on the re-rendered page as Devise uses flash messages to let the application users know if sign in was successful or failure. 但是,这应该在重新渲染的页面上导致显示Flash消息,因为Devise使用Flash消息让应用程序用户知道登录成功还是失败。

Make sure that you are displaying flash messages in application.html.erb as: 确保在application.html.erb以以下方式显示Flash消息:

<% flash.each do |name, msg| %>
  <%= content_tag :div, msg %>
<% end %>

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

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