redirect to login if user do not exists
This commit is contained in:
parent
8e21931cf2
commit
1229903dcc
1 changed files with 2 additions and 1 deletions
|
@ -58,11 +58,12 @@ def login(request):
|
||||||
form = forms.UserCredential(initial={'service':service,'method':method,'warn':request.session.get("warn")})
|
form = forms.UserCredential(initial={'service':service,'method':method,'warn':request.session.get("warn")})
|
||||||
|
|
||||||
# if authenticated and successfully renewed authentication if needed
|
# if authenticated and successfully renewed authentication if needed
|
||||||
if request.session.get("authenticated") and (not renew or renewed):
|
if request.session.get("authenticated") request.session.get("username") and (not renew or renewed):
|
||||||
try:
|
try:
|
||||||
user = models.User.objects.get(username=request.session["username"])
|
user = models.User.objects.get(username=request.session["username"])
|
||||||
except models.User.DoesNotExist:
|
except models.User.DoesNotExist:
|
||||||
_logout(request)
|
_logout(request)
|
||||||
|
return redirect("login")
|
||||||
|
|
||||||
# if login agains a service is requestest
|
# if login agains a service is requestest
|
||||||
if service:
|
if service:
|
||||||
|
|
Loading…
Reference in a new issue