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.5.63 app/models/caboose/authenticator.rb
caboose-cms-0.5.62 app/models/caboose/authenticator.rb
caboose-cms-0.5.61 app/models/caboose/authenticator.rb
caboose-cms-0.5.60 app/models/caboose/authenticator.rb
caboose-cms-0.5.59 app/models/caboose/authenticator.rb
caboose-cms-0.5.58 app/models/caboose/authenticator.rb
caboose-cms-0.5.57 app/models/caboose/authenticator.rb
caboose-cms-0.5.56 app/models/caboose/authenticator.rb
caboose-cms-0.5.55 app/models/caboose/authenticator.rb
caboose-cms-0.5.54 app/models/caboose/authenticator.rb
caboose-cms-0.5.53 app/models/caboose/authenticator.rb
caboose-cms-0.5.52 app/models/caboose/authenticator.rb
caboose-cms-0.5.51 app/models/caboose/authenticator.rb
caboose-cms-0.5.50 app/models/caboose/authenticator.rb
caboose-cms-0.5.49 app/models/caboose/authenticator.rb
caboose-cms-0.5.48 app/models/caboose/authenticator.rb
caboose-cms-0.5.47 app/models/caboose/authenticator.rb
caboose-cms-0.5.46 app/models/caboose/authenticator.rb
caboose-cms-0.5.45 app/models/caboose/authenticator.rb
caboose-cms-0.5.44 app/models/caboose/authenticator.rb