Ruby on rails 设计:iOS上的一些用户在离开浏览器时会不断注销
我用TurboLink运行了一个非常简单的rails 5.1应用程序,我使用Desive 4.4进行身份验证。我已经为Desive设置了Ruby on rails 设计:iOS上的一些用户在离开浏览器时会不断注销,ruby-on-rails,devise,Ruby On Rails,Devise,我用TurboLink运行了一个非常简单的rails 5.1应用程序,我使用Desive 4.4进行身份验证。我已经为Desive设置了memberable,它对我的大多数用户都很有效。但对于一些使用iOS的用户(仅到目前为止,并非所有用户),记住我的功能不起作用。在他们登录并正确选中“记住我”复选框后,他们在离开浏览器(例如切换到safari以外的其他应用程序)几分钟后就会注销 关键文件如下所示: user.rb: class User < ApplicationRecord # I
memberable
,它对我的大多数用户都很有效。但对于一些使用iOS的用户(仅到目前为止,并非所有用户),记住我的功能不起作用。在他们登录并正确选中“记住我”复选框后,他们在离开浏览器(例如切换到safari以外的其他应用程序)几分钟后就会注销
关键文件如下所示:
user.rb:
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
sessions/new.slim:
h2
| Log in
= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
.field
= f.input :email, autofocus: true, type: "email"
.field
= f.input :password, autocomplete: "off", type: 'passsword'
- if devise_mapping.rememberable?
.field
= f.input :remember_me, as: :boolean
.actions
= f.submit "Log in", class: 'btn btn-primary'
br
= render "devise/shared/links"
我不知道为什么会发生这种情况,是什么原因导致它,以及如何调试它?好的,我想我已经发现了哪里出了问题。我的一些iOS用户在主屏幕上为我的应用程序添加了书签。更具体地说,他们在登录屏幕上添加了书签。因此,每当他们通过书签打开应用程序时,它都会尝试对他们进行授权,并最终将他们注销。唯一让我印象深刻的是
config.sign\u out\u via=:get
。应通过:删除。我想知道你的iOS用户是否在点击会话#销毁
而不是创建
。不确定为什么只有部分用户会遇到这种情况,但无论如何,销毁会话应该通过:delete
请求来完成。
h2
| Log in
= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
.field
= f.input :email, autofocus: true, type: "email"
.field
= f.input :password, autocomplete: "off", type: 'passsword'
- if devise_mapping.rememberable?
.field
= f.input :remember_me, as: :boolean
.actions
= f.submit "Log in", class: 'btn btn-primary'
br
= render "devise/shared/links"