login.ejs 3.7 KB

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