Przeglądaj źródła

Bug fix: login and register form emails had type "text"
Bug fix: email validation on the backend was not working.
Update style for email inputs and unified/removed some css.

Lee Morgan 5 lat temu
rodzic
commit
d095053bb8

+ 1 - 1
models/merchant.js

@@ -3,7 +3,7 @@ const isSanitary = require("../controllers/helper.js").isSanitary;
 const mongoose = require("mongoose");
 
 let emailValid = (value)=>{
-    /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value);
+    return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value);
 }
 
 const MerchantSchema = new mongoose.Schema({

+ 1 - 1
views/otherPages/login.ejs

@@ -24,7 +24,7 @@
             <h1> Welcome Back </h1>
     
             <label>Email
-                <input type="text" name="email" type="email" required>
+                <input type="email" name="email" required>
             </label>
     
             <label>Password

+ 1 - 1
views/otherPages/register.ejs

@@ -28,7 +28,7 @@
             </label>
     
             <label>Email
-                <input type="text" name="email" required>
+                <input type="email" name="email" required>
             </label>
     
             <label>Password

+ 1 - 21
views/otherPages/style.css

@@ -13,19 +13,7 @@ form{
     height: auto;
 }
 
-    input[type=text], select {
-        width: 100%;
-        padding: 12px 20px;
-        margin: 8px 0;
-        display: inline-block;
-        border: 1px solid #ccc;
-        border-radius: 4px;
-        box-sizing: border-box;
-        padding-bottom: 16px;
-        font-size: 16px;
-    }
-
-    input[type=text], input[type=password], select {
+    input[type=text], input[type=password], input[type=email], select {
         width: 100%;
         padding: 12px 20px;
         margin: 8px 0;
@@ -58,14 +46,6 @@ form{
         outline: none;
     }
 
-    input[type=button] {
-        background-color: rgb(255, 99, 107);
-    }
-
-    input[type=button]:hover {
-        background-color:rgb(0, 27, 45);
-    }
-
 #logInButton, #joinButton{
     color: white;
 }