Skip to content

Instantly share code, notes, and snippets.

@dmateos
Created February 11, 2016 16:52
Show Gist options
  • Save dmateos/2446c737e8c64a15170b to your computer and use it in GitHub Desktop.
Save dmateos/2446c737e8c64a15170b to your computer and use it in GitHub Desktop.
module GoTipping
class UserAuthenticator
def initialize(username, organisation)
@user = organisation.users.find_by(username: username)
end
def authenticate(password)
return false unless @user
if BCrypt::Password.new(@user.password_digest) == password
@user
else
false
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment