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.9.229 app/models/caboose/login_log.rb
caboose-cms-1.0.2 app/models/caboose/login_log.rb
caboose-cms-1.0.1 app/models/caboose/login_log.rb
caboose-cms-0.9.228 app/models/caboose/login_log.rb
caboose-cms-0.9.227 app/models/caboose/login_log.rb
caboose-cms-0.9.226 app/models/caboose/login_log.rb
caboose-cms-0.9.225 app/models/caboose/login_log.rb
caboose-cms-0.9.224 app/models/caboose/login_log.rb
caboose-cms-0.9.223 app/models/caboose/login_log.rb
caboose-cms-0.9.222 app/models/caboose/login_log.rb
caboose-cms-0.9.221 app/models/caboose/login_log.rb
caboose-cms-0.9.220 app/models/caboose/login_log.rb
caboose-cms-0.9.219 app/models/caboose/login_log.rb
caboose-cms-0.9.218 app/models/caboose/login_log.rb
caboose-cms-0.9.217 app/models/caboose/login_log.rb
caboose-cms-0.9.216 app/models/caboose/login_log.rb
caboose-cms-0.9.215 app/models/caboose/login_log.rb
caboose-cms-0.9.214 app/models/caboose/login_log.rb
caboose-cms-0.9.213 app/models/caboose/login_log.rb
caboose-cms-0.9.212 app/models/caboose/login_log.rb