Sha256: 80c46399837eb894bdea3582838a339b22fddd6ff0288e895aae9f5974f6b538

Contents?: true

Size: 686 Bytes

Versions: 415

Compression:

Stored size: 686 Bytes

Contents

class Caboose::LoginLog < ActiveRecord::Base
  self.table_name = "login_logs"
    
  belongs_to :site, :class_name => 'Caboose::Site'
  belongs_to :user, :class_name => 'Caboose::User'
  
  attr_accessible :id,  
    :site_id        ,
    :username       ,
    :user_id        ,
    :date_attempted ,
    :ip             ,        
    :success
    
  def self.fail_count(user)
    last_successful_login = Caboose::LoginLog.where(:user_id => user.id, :success => true).reorder("date_attempted desc").first
    id = last_successful_login ? last_successful_login.id : 1
    return Caboose::LoginLog.where("user_id = ? and success = ? and id > ?", user.id, false, id).count    
  end

end

Version data entries

415 entries across 415 versions & 1 rubygems

Version Path
caboose-cms-0.6.31 app/models/caboose/login_log.rb
caboose-cms-0.6.30 app/models/caboose/login_log.rb
caboose-cms-0.6.29 app/models/caboose/login_log.rb
caboose-cms-0.6.28 app/models/caboose/login_log.rb
caboose-cms-0.6.27 app/models/caboose/login_log.rb
caboose-cms-0.6.26 app/models/caboose/login_log.rb
caboose-cms-0.6.25 app/models/caboose/login_log.rb
caboose-cms-0.6.24 app/models/caboose/login_log.rb
caboose-cms-0.6.23 app/models/caboose/login_log.rb
caboose-cms-0.6.22 app/models/caboose/login_log.rb
caboose-cms-0.6.21 app/models/caboose/login_log.rb
caboose-cms-0.6.20 app/models/caboose/login_log.rb
caboose-cms-0.6.19 app/models/caboose/login_log.rb
caboose-cms-0.6.18 app/models/caboose/login_log.rb
caboose-cms-0.6.17 app/models/caboose/login_log.rb