Module: Guestlist::ClassMethods
- Defined in:
- lib/guestlist.rb
Instance Method Summary collapse
Instance Method Details
#authenticate(login, token) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/guestlist.rb', line 5 def authenticate(login, token) attributes = {:login => login, :encrypted_token => encrypt(token)} if user = find_by_login(login) return user if user.encrypted_token == attributes[:encrypted_token] end if Github.fetch(login, token) user.update_attributes(attributes) if user user || User.create!(attributes) end end |