Created
October 19, 2010 10:08
-
-
Save thesp0nge/633958 to your computer and use it in GitHub Desktop.
authentication#create method for pernataleiovorrei.com (buggy version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
omniauth = request.env["omniauth.auth"] | |
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid']) | |
if authentication | |
sign_in_and_redirect(:user, authentication.user) | |
else | |
current_user.authentications.create(:provider=>omniauth['provider'], :uid=>omniauth['uid']) | |
flash[:notice] = "You rock man" | |
redirect_to authentications_url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment