Then redirecting to login, keep service param
This commit is contained in:
parent
b08d6a3f97
commit
0a3e95ba2b
1 changed files with 9 additions and 1 deletions
|
@ -7,8 +7,10 @@ from django.conf import settings
|
|||
from django.contrib import messages
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
import requests
|
||||
import urllib
|
||||
from datetime import datetime, timedelta
|
||||
from lxml import etree
|
||||
|
||||
|
@ -24,6 +26,12 @@ def _logout(request):
|
|||
try: del request.session["warn"]
|
||||
except KeyError: pass
|
||||
|
||||
|
||||
def redirect_params(url_name, params={}):
|
||||
url = reverse(url_name, args = args)
|
||||
params = urllib.urlencode(params)
|
||||
return HttpResponseRedirect(url + "?%s" % params)
|
||||
|
||||
def login(request):
|
||||
user = None
|
||||
form = None
|
||||
|
@ -63,7 +71,7 @@ def login(request):
|
|||
user = models.User.objects.get(username=request.session["username"])
|
||||
except models.User.DoesNotExist:
|
||||
_logout(request)
|
||||
return redirect("login")
|
||||
return redirect_params("login", params=dict(request.GET))
|
||||
|
||||
# if login agains a service is requestest
|
||||
if service:
|
||||
|
|
Loading…
Reference in a new issue