SHARE
TWEET

Untitled

a guest Dec 23rd, 2017 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @logout_required()
  2. def login(request):
  3.     if not request.method == 'POST':
  4.         raise Http404
  5.     login = request.POST['login']
  6.     password = request.POST['password']
  7.     remember = request.POST.get('remember', False)
  8.     try:
  9.         user = CUser.objects.get(Q(login=login) | Q(email=login))
  10.     except CUser.DoesNotExist:
  11.         user = None
  12.     if user is not None and user.is_password(password):
  13.         sign_in(request, user, remember)
  14.         return redirect('home')
  15.     else:
  16.         error = 'Niepoprawny login/email lub haslo' #TODO translacja
  17.     pictures = Picture.objects.order_by('-id')
  18.     return render(request, 'czemuja/home.html', {'pictures': pictures, 'error': error})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top