login.ejs 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>The Subline</title>
  6. <link rel="icon" type="img/png" href="/shared/images/logo.png">
  7. <link rel="stylesheet" href="/otherPages/style.css">
  8. <link rel="stylesheet" href="/shared/shared.css">
  9. <link href="https://fonts.googleapis.com/css?family=Saira&display=swap" rel="stylesheet">
  10. </head>
  11. <body id="login">
  12. <div class="header">
  13. <a class="headerStart" href="/" >
  14. <img src="/shared/images/logo.png" alt="Subline">
  15. <div class='headerLogo'>THE SUBLINE</div>
  16. </a>
  17. </div>
  18. <% include ../shared/banner.ejs %>
  19. <form action="/login" method="post">
  20. <h1> Welcome Back </h1>
  21. <label>Email
  22. <input type="email" name="email" required>
  23. </label>
  24. <label>Password
  25. <input type="password" name="password" required>
  26. </label>
  27. <input id="signIn" type="submit" value="Sign In">
  28. <a href="/reset/email" class="link">Forgot your password?</a>
  29. <a class="link" href="/register">Need to register?</a>
  30. </form>
  31. <% include ../shared/footer %>
  32. <script>
  33. let locals = <%- JSON.stringify(locals) %>
  34. if(locals.banner !== undefined){
  35. let bannerElem = document.getElementById("banner");
  36. bannerElem.children[0].style.background = locals.banner.color;
  37. bannerElem.children[1].innerText = locals.banner.message;
  38. bannerElem.style.display = "flex";
  39. switch(banner.type){
  40. case "error":
  41. bannerElem.children[0].innerHTML = `
  42. <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  43. <circle cx="12" cy="12" r="10"></circle>
  44. <line x1="15" y1="9" x2="9" y2="15"></line>
  45. <line x1="9" y1="9" x2="15" y2="15"></line>
  46. </svg>
  47. `;
  48. break;
  49. case "success":
  50. bannerElem.children[0].innerHTML = `
  51. <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  52. <circle cx="12" cy="12" r="10"></circle>
  53. <line x1="12" y1="8" x2="12" y2="12"></line>
  54. <line x1="12" y1="16" x2="12.01" y2="16"></line>
  55. </svg>
  56. `;
  57. break;
  58. default:
  59. bannerElem.children[0].innerHTML = `
  60. <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  61. <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
  62. <polyline points="22 4 12 14.01 9 11.01"></polyline>
  63. </svg>
  64. `;
  65. }
  66. let timer = setTimeout(()=>{
  67. bannerElem.style.display = "none"
  68. }, 7000);
  69. bannerElem.children[2].onclick = ()=>{
  70. bannerElem.style.display = "none";
  71. clearTimeout(timer);
  72. }
  73. }
  74. </script>
  75. </body>
  76. </html>