Ejemplo n.º 1
0
Archivo: views.py Proyecto: natea/ourmy
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)
Ejemplo n.º 2
0
Archivo: views.py Proyecto: natea/ourmy
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('/')
Ejemplo n.º 3
0
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('/')
Ejemplo n.º 4
0
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('/')
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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('/')
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
def authenticate_redirect(request, service):
    url = SinglyHelper.get_authorize_url(service)
    return HttpResponseRedirect(url)
Ejemplo n.º 10
0
def authenticate_redirect(request, service):
    url = SinglyHelper.get_authorize_url(service)
    return HttpResponseRedirect(url)