Tag: 注销

在RESTFUL身份validation中添加注销按钮

我已经安装了RESTFUL身份validation,一切似乎都运行正常。 我可以注册并登录。 我可以注销的唯一方法是输入URL http:// localhost:3000 / logout 如何在页面上添加注销按钮? 我尝试在members.rhtml中添加一个 “sessions”, :action=> “destroy” %> 它引用了session_controller.rb但是我得到一个错误“没有动作响应显示。动作:创建,销毁和新” 有什么想法吗? 感谢名单

重定向适用于登录但不适用于注销

说明 我正在使用带有Ruby on Rails webapp的devise gem,并按照本教程介绍如何在用户登录和注销后将用户重定向回上一页。 问题是,代码似乎适用于登录部分,但注销总是将用户重定向到root_path。 题 当我完全按照教程,并且重定向适用于一个,我是否错过了一个错字或者其他地方的代码是否覆盖了这段代码? 使用的版本 Ruby:ruby 2.2.1p85(2015-02-26修订版49769)[x86_64-darwin14] Rails:Rails 4.2.0 设计:3.4.1 码 应用控制器: ## app/controllers/application_controller.rb class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception after_filter :store_location before_action :configure_permitted_parameters, if: :devise_controller? def store_location # store last […]

如何从Rails控制台注销设计用户?

我的设计用户是“database_authenticatable”和“token_authenticatable”。 我尝试从控制台删除该用户的数据库中的“authentication_token”字段,但他们似乎仍然可以使用他们现有的身份validation令牌。 删除用户完全有效,但我不想走那么远。 编辑:为清楚起见。 我想使用rails 控制台注销用户。 即运行rails console然后运行一些命令。

rails设计,没有路由匹配注销

虽然有很多类似的问题,但我已经搜索了几个小时,但仍无法修复它。 Env rails 3.0.9 ruby​​ 1.9.2 devise 1.4.2 我使用以下命令更改了默认登录URL: 5 resources :users 6 devise_for :users, :path => “”, :path_names => { :sign_in => ‘login’, :sign_out => ‘logout’, :password => ‘secret’, :confirmation => ‘verification’, :unlock => ‘unblock’, :registration => ‘register’, :sign_up => ‘cmon_let_me_in’ } http:// localhost:3000 / login对我来说很好但是我包含了 = link_to ‘sign_out’, destroy_user_session_path, :method => :delete 在我的application.haml中,点击它之后,它说没有路由匹配“/ […]