【问题标题】:merb_auth_password_slice does not maintain the sessionmerb_auth_password_slice 不维护会话
【发布时间】:2008-10-05 01:00:08
【问题描述】:

根据 README 集成 merb_auth_password_slice,我可以成功登录,因为 redirect_after_login 正在被触发,尽管 session.authenticated? 返回 false。

现在只是尝试基本的身份验证策略(密码形式),似乎无法使其正常工作,有什么想法吗?

我的初始化文件:

require 'dm-validations'

dependencies "merb-more", "merb_helpers", "merb-slices", "merb_auth_password_slice"


Merb::BootLoader.before_app_loads do
  DataMapper.setup(:default, "sqlite3://config/dev.db")
end

Merb::BootLoader.after_app_loads do
    # have already done this
    # raise "You must specify a valid openid in Merb.root/config/open_id to use this example app" unless File.exists?(Merb.root / "config" / "open_id")
    # # DataMapper.auto_migrate!
    # User.create(:login => "admin", 
    #             :password => "password", :password_confirmation => "password", 
    #             :email => "admin@example.com", 
    #             :identity_url => File.read(Merb.root / "config" / "open_id"))
end

Merb::Config.use do |c|
  c[:session_secret_key]  = 'my key'
  c[:session_store] = 'cookie'
end

设置.rb

class Authentication

  def store_user(user)
    return nil unless user
    user.id
  end

  def fetch_user(session_info)
    User.get(session_info)
  end

end # Authentication

【问题讨论】:

    标签: ruby merb merb-auth


    【解决方案1】:
      # before(nil, :only => [:update, :destroy]) { session.abandon! }
    

    这是切片的会话控制器中的罪魁祸首

    【讨论】:

      猜你喜欢
      • 2018-06-09
      • 1970-01-01
      • 2011-08-04
      • 1970-01-01
      • 2019-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-06
      相关资源
      最近更新 更多