Esempio n. 1
0
File: views.py Progetto: 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('/')
Esempio n. 2
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('/')
Esempio 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('/')
Esempio n. 4
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)
Esempio 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)
Esempio n. 6
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('/')