Skip to content

Instantly share code, notes, and snippets.

@bcardarella
Created January 16, 2015 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcardarella/48bd4764fa23227cd48c to your computer and use it in GitHub Desktop.
Save bcardarella/48bd4764fa23227cd48c to your computer and use it in GitHub Desktop.
def self.authenticate(controller)
if can_authenticate?(controller)
token = controller.params[:token]
account_attributes = controller.params[:account_attributes)
identity = self.find_or_initialize_by(uid: retrieve_uid(account_attributes))
identity.token = token
if controller .current_account
with_account(identity, controller, account_attributes)
else
without_account(identity, controller, account_attributes)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment