Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def login_user(request):
- if request.method == 'POST':
- form = LoginForm(request.POST)
- username = request.POST['username']
- password = request.POST['password']
- user = authenticate(username=username, password=password)
- if user is not None:
- if user.is_active:
- login(request, user)
- return redirect('home')
- else:
- form = LoginForm()
- if request.user.is_authenticated:
- return redirect('profile')
- return render(request, 'registration/login.html', {'form': form})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement