def authenticate_redirect(request, service): if request.user.is_authenticated(): url = SinglyHelper.get_authorize_url( service, request.user.get_profile().access_token) else: url = SinglyHelper.get_authorize_url(service) return HttpResponseRedirect(url)
def authorize_callback(request): code = request.GET.get('code') content = SinglyHelper.get_access_token(code) user_profile = SinglyProfile.objects.get_or_create_user( content['account'], content['access_token']) if not request.user.is_authenticated(): # ideally, we would be using a randomized password. Not sure why this isn't working # password = User.objects.make_random_password() # print "password: "******"http://localhost:" # TODO: check this on a browser I'm not logged into facebook on -- redirecting to zoomtilt.com if destination.startswith(MY_BASE_URL) or destination.startswith(LOCALLY): return HttpResponseRedirect(destination) else: return HttpResponseRedirect('/')
def authorize_callback(request): code = request.GET.get('code') content = SinglyHelper.get_access_token(code) user_profile = UserProfile.objects.get_or_create_user(content['account'], content['access_token']) if not request.user.is_authenticated(): user = authenticate(username=user_profile.user.username, password='******') auth_login(request, user) return HttpResponseRedirect('/')
def authorize_callback(request): code = request.GET.get('code') content = SinglyHelper.get_access_token(code) user_profile = UserProfile.objects.get_or_create_user( content['account'], content['access_token']) if not request.user.is_authenticated(): user = authenticate(username=user_profile.user.username, password='******') auth_login(request, user) return HttpResponseRedirect('/')
def authorize_callback(request): error = request.GET.get('error', "") if error: #TODO : Do something graceful logger.error("%s from Singly", error) return HttpResponseRedirect("/error.html") mode = request.GET.get('mode', '_cand') code = request.GET.get('code') content = SinglyHelper.get_access_token(code) user_profile = UserProfile.objects.get_or_create_user( content['account'], content['access_token']) if not request.user.is_authenticated(): user = authenticate(username=user_profile.user.username, password='******') auth_login(request, user) return HttpResponseRedirect('/?mode='+mode)
def authorize_callback(request): error = request.GET.get('error', "") if error: #TODO : Do something graceful logger.error("%s from Singly", error) return HttpResponseRedirect("/error.html") mode = request.GET.get('mode', '_cand') code = request.GET.get('code') content = SinglyHelper.get_access_token(code) user_profile = UserProfile.objects.get_or_create_user( content['account'], content['access_token']) if not request.user.is_authenticated(): user = authenticate(username=user_profile.user.username, password='******') auth_login(request, user) return HttpResponseRedirect('/?mode=' + mode)
def authorize_callback(request): code = request.GET.get('code') content = SinglyHelper.get_access_token(code) user_profile = SinglyProfile.objects.get_or_create_user(content['account'], content['access_token']) if not request.user.is_authenticated(): # ideally, we would be using a randomized password. Not sure why this isn't working # password = User.objects.make_random_password() # print "password: "******"http://localhost:" # TODO: check this on a browser I'm not logged into facebook on -- redirecting to zoomtilt.com if destination.startswith(MY_BASE_URL) or destination.startswith(LOCALLY): return HttpResponseRedirect(destination) else: return HttpResponseRedirect('/')
def authenticate_redirect(request, service): if request.user.is_authenticated(): url = SinglyHelper.get_authorize_url(service, request.user.get_profile().access_token) else: url = SinglyHelper.get_authorize_url(service) return HttpResponseRedirect(url)
def authenticate_redirect(request, service): url = SinglyHelper.get_authorize_url(service) return HttpResponseRedirect(url)