代码之家  ›  专栏  ›  技术社区  ›  Niels Kristian

设计:iOS上的一些用户在离开浏览器时会不断地被注销

  •  0
  • Niels Kristian  · 技术社区  · 6 年前

    rememberable 因为设计,它对我的大多数用户都很有效。但是对于一些使用(目前为止只有iOS,而不是所有iOS)的用户来说,memberme功能不起作用。在他们登录并正确选中“记住我”复选框后,他们在离开浏览器(例如切换到safari以外的其他应用程序)几分钟后就会被注销。

    密钥文件如下所示:

    用户.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
    

    设计rb:

    Devise.setup do |config|
      config.mailer_sender = 'webmaster@example.com'
      require 'devise/orm/active_record'
      config.case_insensitive_keys = [:email]
      config.strip_whitespace_keys = [:email]
      config.skip_session_storage = [:http_auth]
      config.stretches = Rails.env.test? ? 1 : 11
      config.reconfirmable = true
      config.remember_for = 1.year
      config.expire_all_remember_me_on_sign_out = true
      config.extend_remember_period = true
      config.password_length = 6..128
      config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
      config.timeout_in = 2.weeks
      config.reset_password_within = 6.hours
      config.sign_out_via = :get
    end
    

    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"
    

    我不知道为什么会发生这种情况,什么会导致这种情况以及如何调试它?

    1 回复  |  直到 6 年前
        1
  •  0
  •   Niels Kristian    5 年前

    好吧,我想我已经找到了问题所在。我的一些iOS用户已经在他们的主屏幕上为我的应用添加了书签。更具体地说,他们在登录屏幕上加了书签。因此,每当他们通过书签打开应用程序时,它都会试图授权他们,并最终将他们注销。