Browse Source

When user is already logged in redirect to the startpage

master
Florian Streibelt 10 years ago committed by tkroenert
parent
commit
e7043e2f08
  1. 2
      k4ever/main/urls.py
  2. 10
      k4ever/main/views.py

2
k4ever/main/urls.py

@ -13,7 +13,7 @@ from django.conf import settings @@ -13,7 +13,7 @@ from django.conf import settings
urlpatterns = patterns('',
(r'^$', 'django.views.generic.simple.redirect_to', {'url': 'login/'}),
(r'^register/$', 'main.views.register'),
(r'^login/$', 'django.contrib.auth.views.login'),
(r'^login/$', 'main.views.login'),
(r'^logout/$', 'django.contrib.auth.views.logout',
{'template_name': 'registration/logout.html',
'next_page': '/user/login/'}),

10
k4ever/main/views.py

@ -12,6 +12,8 @@ from django.db.models import Count, Max @@ -12,6 +12,8 @@ from django.db.models import Count, Max
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
import django.contrib.auth.views
from buyable.models import Purchase, Buyable, BuyableType
from main.helper import getUserFromAuthblob
@ -179,3 +181,11 @@ def pluginAuthblob(request, pluginId): @@ -179,3 +181,11 @@ def pluginAuthblob(request, pluginId):
d['pluginmsg'] = "Authblob erfolgreich geändert"
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…
Cancel
Save