我想知道是否有一种方法可以在使用 devise 登录期间检查当前 URL。
假设我有一个带有字段 :url 的用户模型,并且连同 :email 和 :password 一起,您还检查当前 url 是否与用户的 :url 字段匹配。
我在想我应该在设计的 self.find_for_database_authentication 方法中这样做,我目前有这个:
def self.find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
if login = conditions.delete(:login).downcase
where(conditions).where('$or' => [{:username => /^#{Regexp.escape(login)}$/i}, {:email => /^#{Regexp.escape(login)}$/i}]).first
else
where(conditions).first
end
end
但是我应该添加什么以便它检查当前的 URL?
注意:我正在使用 mongoid
提前致谢!