Sha256: 67261f921d776e5198e6b300a9821366b7b61b43d618a9d6fb528ae48cf3f5b4

Contents?: true

Size: 504 Bytes

Versions: 280

Compression:

Stored size: 504 Bytes

Contents

class Caboose::Authenticator

  def authenticate(username, password)
    resp = Caboose::StdClass.new(
      'error' => nil,
      'user' => nil 
    )
    pass = Digest::SHA1.hexdigest(Caboose::salt + password)
    resp.user = Caboose::User.where(:username => username, :password => pass).first
    if (resp.user.nil?)
      resp.user = Caboose::User.where(:email => username, :password => pass).first
    end
    resp.error = "Invalid credentials" if resp.user.nil?      
    return resp
  end
  
end

Version data entries

280 entries across 280 versions & 1 rubygems

Version Path
caboose-cms-0.4.151 app/models/caboose/authenticator.rb
caboose-cms-0.4.150 app/models/caboose/authenticator.rb
caboose-cms-0.4.149 app/models/caboose/authenticator.rb
caboose-cms-0.4.148 app/models/caboose/authenticator.rb
caboose-cms-0.4.147 app/models/caboose/authenticator.rb
caboose-cms-0.4.146 app/models/caboose/authenticator.rb
caboose-cms-0.4.145 app/models/caboose/authenticator.rb
caboose-cms-0.4.144 app/models/caboose/authenticator.rb
caboose-cms-0.4.143 app/models/caboose/authenticator.rb
caboose-cms-0.4.142 app/models/caboose/authenticator.rb
caboose-cms-0.4.141 app/models/caboose/authenticator.rb
caboose-cms-0.4.140 app/models/caboose/authenticator.rb
caboose-cms-0.4.139 app/models/caboose/authenticator.rb
caboose-cms-0.4.138 app/models/caboose/authenticator.rb
caboose-cms-0.4.137 app/models/caboose/authenticator.rb
caboose-cms-0.4.136 app/models/caboose/authenticator.rb
caboose-cms-0.4.135 app/models/caboose/authenticator.rb
caboose-cms-0.4.134 app/models/caboose/authenticator.rb
caboose-cms-0.4.133 app/models/caboose/authenticator.rb
caboose-cms-0.4.132 app/models/caboose/authenticator.rb