Guest User

Untitled

a guest
Oct 31st, 2017
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. class User(models.Model):
  2. email = models.EmailField()
  3. password = models.CharField(max_length=200)
  4. client_id = models.IntegerField()
  5. role = models.CharField(max_length=200)
  6.  
  7. url(r'^admin/', admin.site.urls),
  8. url(r'^main/$', MainPage, name="main"),
  9. url(r'^login/$', UserLogin, name="login"),
  10.  
  11.  
  12. url(r'^$', HomeView, name="home"),
  13. url(r'^logout/$', Logout, name="logout"),
  14.  
  15. def UserLogin(request):
  16. email = request.POST.get('email',False)
  17. password = request.POST.get('password',False)
  18. user = authenticate(email=email,password=password)
  19. if user is not None:
  20. return HttpResponseRedirect('Main.html')
  21. else:
  22. return HttpResponseRedirect('Index.html')
  23.  
  24. def Logout(request):
  25. auth.logout(request)
  26. return render_to_response('Login.html')
  27.  
  28. <form class="m-t" role="form" action="/login" method="post">
  29.  
  30.  
  31. <div class="form-group">
  32. <input type="email" class="form-control" placeholder="Username" required="">
  33. </div>
  34. <div class="form-group">
  35. <input type="password" class="form-control" placeholder="Password" required="">
  36. </div>
  37. <button type="submit" class="btn btn-primary block full-width m-b">Login</button>
  38.  
  39. <a href="password.html">
  40. <small>Forgot password?</small>
  41. </a>
  42. <a class="btn btn-sm btn-white btn-block" href="reg.html">Create an account</a>
  43. </form>
Add Comment
Please, Sign In to add comment