When user is already logged in redirect to the startpage
This commit is contained in:
parent
f43a06d7d9
commit
e7043e2f08
|
@ -13,7 +13,7 @@ from django.conf import settings
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^$', 'django.views.generic.simple.redirect_to', {'url': 'login/'}),
|
(r'^$', 'django.views.generic.simple.redirect_to', {'url': 'login/'}),
|
||||||
(r'^register/$', 'main.views.register'),
|
(r'^register/$', 'main.views.register'),
|
||||||
(r'^login/$', 'django.contrib.auth.views.login'),
|
(r'^login/$', 'main.views.login'),
|
||||||
(r'^logout/$', 'django.contrib.auth.views.logout',
|
(r'^logout/$', 'django.contrib.auth.views.logout',
|
||||||
{'template_name': 'registration/logout.html',
|
{'template_name': 'registration/logout.html',
|
||||||
'next_page': '/user/login/'}),
|
'next_page': '/user/login/'}),
|
||||||
|
|
|
@ -12,6 +12,8 @@ from django.db.models import Count, Max
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
|
import django.contrib.auth.views
|
||||||
|
|
||||||
from buyable.models import Purchase, Buyable, BuyableType
|
from buyable.models import Purchase, Buyable, BuyableType
|
||||||
from main.helper import getUserFromAuthblob
|
from main.helper import getUserFromAuthblob
|
||||||
|
@ -179,3 +181,11 @@ def pluginAuthblob(request, pluginId):
|
||||||
d['pluginmsg'] = "Authblob erfolgreich geändert"
|
d['pluginmsg'] = "Authblob erfolgreich geändert"
|
||||||
return render_to_response("settings/settings.html", d, RequestContext(request))
|
return render_to_response("settings/settings.html", d, RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
|
def login(request):
|
||||||
|
''' Login - redirect wenn schon angemeldet.
|
||||||
|
'''
|
||||||
|
if request.user.is_authenticated():
|
||||||
|
return HttpResponseRedirect(reverse('main.views.startpage'))
|
||||||
|
return django.contrib.auth.views.login(request)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue