SHARE
TWEET

Untitled

a guest Nov 6th, 2018 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def login(request):
  2.     username = 'not logged in'
  3.    
  4.     if request.method == 'POST':
  5.         MyLoginForm = LoginForm(request.POST)
  6.      
  7.         if MyLoginForm.is_valid():
  8.             username = MyLoginForm.cleaned_data['username']
  9.             password = MyLoginForm.cleaned_data['password']
  10.  
  11.             if username == 'admin' and password == 'secret':
  12.                 return render(request, 'loggedin.html', {"username" : username})
  13.  
  14.             elif username == 'user' and password== 'secret':
  15.                 return render(request, 'loggedin.html', {"username" : username})
  16.         else:
  17.             MyLoginForm = LoginForm()
  18.            
  19.     return render(request, 'loggedin.html', {"username" : username})
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