Skip to content

Commit

Permalink
Fix authentication.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeneOskin committed Nov 9, 2015
1 parent f7a2517 commit 5de19f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/api/animal/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def authenticate!

http_basic do |username, password|
# verify user's password here
user = User.first email: username
user = User.find_by email: username
user.valid_password? password
end

Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ class User < ActiveRecord::Base
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

def self.authorize!(env)
self.find_by email: env['REMOTE_USER']
end
end

0 comments on commit 5de19f8

Please sign in to comment.