File size: 748 Bytes
433085e
a6fbb8d
433085e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import joi from "joi";

export const loginValidation = joi
  .object()
  .required()
  .keys({
    email: joi
      .string()
      .required()
      .email({
        minDomainSegments: 2,
        tlds: { allow: ["com", "net", "org", "eg", "io"] },
      })
      .empty()
      .messages({
        "string.email": "please enter a valid email",
        "any.required": "email must be entered",
        "string.empty": "email can not be empty",
      }),
    password: joi.string().empty().min(8).required().messages({
      "string.base": "please enter a valid password",
      "any.required": "password must be entered",
      "string.empty": "password cannot be empty",
      "string.min": "password must be at least 8 characters",
    }),
  });