hta*_*irt 2 message ruby-on-rails devise
我使用Devise为我的应用程序执行身份验证,一切正常,除了检测到unauthentication失败的Devise注销消息:
en.devise.failure.unauthenticated:
" You need to sign in or sign up before continuing "
我的意思是我在退出时收到此消息,而不是"已成功签名"消息.
也许我错误地将我的Devise系统个性化了.以下是我所做的人格化:
1 /我使用自己的会话控制器来覆盖默认的Devise会话控制器.我唯一的目标是选择一个特殊的访问(登录/注册)布局:
class SessionsController < Devise::SessionsController
layout 'access'
end
Run Code Online (Sandbox Code Playgroud)
没有更多的代码.我只想使用位于的特殊登录/注册设计进行渲染views/layouts/access.html.haml
.
当然,我把它添加到我的routes.rb
文件中:
devise_for :users, :controller => { :sessions => 'sessions' }
Run Code Online (Sandbox Code Playgroud)
2 /我为Devise(法语)选择了另一种语言,所以我将devise.fr.yml
其下载并粘贴到config/locales/
文件夹中,然后设置config.i18n.default_locale = :fr
为config/application.rb
文件
所有其他Devise操作消息都是正确的.只有"退出"有麻烦.任何的想法?
提前致谢.
看起来有一种方法来处理设计的自定义布局而不继承会话控制器.看一下这个文档:
https://github.com/plataformatec/devise/wiki/How-To:-Create-custom-layouts
编辑
要在用户注销后将用户重定向到登录页面,请将其添加到应用程序控制器:
def after_sign_out_path_for(resource_or_scope)
sign_ins_path
end
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2049 次 |
最近记录: |