Advertisement
Guest User

Untitled

a guest
May 25th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. ADMIN
  2.  
  3. 'login':function (req,res) {
  4. return res.view('login');
  5. },
  6. 'signIn':function (req,res) {
  7. var params = req.params.all();
  8. if (params.Username === "TEST" && params.Password === "TEST") {
  9. req.session.authenticated = true;
  10. return res.redirect('/admin/newSong');
  11. }else {
  12. return res.redirect('/admin/login');
  13. }
  14. },
  15.  
  16. ROUTES
  17. '/admin/login': 'AdminController.login',
  18. 'POST /admin/sign-in': 'AdminController.signIn'
  19.  
  20. POLICIES
  21. AdminController: {
  22. '*': 'sessionAuth',
  23. 'login': true,
  24. 'signIn': true
  25. }
  26.  
  27. LOGIN FILE
  28.  
  29. <div class = "container">
  30. <div class="wrapper login">
  31. <form action="/admin/sign-in" method="post" name="Login_Form" class="form-signin">
  32. <h3 class="form-signin-heading">Welcome Back! Please Sign In</h3>
  33.  
  34. <input type="text" class="form-control" name="Username" placeholder="Username" required="" autofocus="" />
  35. <input type="password" class="form-control" name="Password" placeholder="Password" required=""/>
  36. <input type='hidden' name='_csrf' value='<%= _csrf %>'>
  37. <button class="btn btn-lg btn-primary btn-block" name="Submit" value="Login" type="Submit">Login</button>
  38. </form>
  39. </div>
  40. </div>
  41.  
  42. STYLES
  43.  
  44.  
  45.  
  46. .wrapper {
  47. margin-top: 80px;
  48. margin-bottom: 20px;
  49. }
  50.  
  51. .form-signin {
  52. max-width: 420px;
  53. padding: 30px 38px 66px;
  54. margin: 0 auto;
  55. background-color: #eee;
  56. border: 3px dotted rgba(0,0,0,0.1);
  57. }
  58.  
  59. .form-signin-heading {
  60. text-align:center;
  61. margin-bottom: 30px;
  62. }
  63.  
  64. .login .form-control {
  65. position: relative;
  66. font-size: 16px;
  67. height: auto;
  68. padding: 10px;
  69. }
  70.  
  71. .login input[type="text"] {
  72. margin-bottom: 0px;
  73. border-bottom-left-radius: 0;
  74. border-bottom-right-radius: 0;
  75. }
  76.  
  77. .login input[type="password"] {
  78. margin-bottom: 20px;
  79. border-top-left-radius: 0;
  80. border-top-right-radius: 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement