Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to stop django from skipping the login page for a user?
- # Login Page
- def login(request):
- username = request.POST.get('username', '')
- password = request.POST.get('password', '')
- user = authenticate(username=username, password=password)
- if user is not None and user.is_active:
- # Correct password, and the user is marked "active"
- auth.login(request, user)
- # Redirect to a success page.
- return HttpResponseRedirect("/pk/loggedin/")
- else:
- # Show an error page
- return HttpResponseRedirect("/pk/invalid/")
- from django.contrib.auth.decorators import login_required
- @login_required
- def my_view(request):
- ...
Add Comment
Please, Sign In to add comment