def oauth_return(request): if not request.user.is_authenticated(): # Create a new user automagically. user = User() user.username = '******' % random.randrange(16**30) # password = '******' % random.randrange(16**30) user.set_unusable_password() user.save() # authenticate(username=user.username) user.backend='django.contrib.auth.backends.ModelBackend' login(request, user) # Now we need to create a user profile and an initial league. # TODO let the user create the league. And have multiple leagues. user_profile = UserProfile() user_profile.user = user user_profile.save() return oauth_utils.process_oauth_redirect(request, client_secrets_filename=client_secrets_filename, redirect_uri=settings.GOOGLE_REDIRECT_URI)
def oauth_redirect(request): return oauth_utils.process_oauth_redirect(request, client_secrets_filename=client_secrets_filename, redirect_uri=settings.GOOGLE_REDIRECT_URI, post_auth_redirect='/install/')