Merge pull request #866 from Killian-Smith/email-case-sensitive

fix: normalize email when inviting memebers and logging in.
This commit is contained in:
BlackMagiq
2023-08-23 18:08:28 +07:00
committed by GitHub
5 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ router.post("/token", validateRequest, authController.getNewToken);
router.post( // TODO endpoint: deprecate (moved to api/v3/auth/login1) router.post( // TODO endpoint: deprecate (moved to api/v3/auth/login1)
"/login1", "/login1",
authLimiter, authLimiter,
body("email").exists().trim().notEmpty(), body("email").exists().trim().notEmpty().toLowerCase(),
body("clientPublicKey").exists().trim().notEmpty(), body("clientPublicKey").exists().trim().notEmpty(),
validateRequest, validateRequest,
authController.login1 authController.login1
@@ -20,7 +20,7 @@ router.post( // TODO endpoint: deprecate (moved to api/v3/auth/login1)
router.post( // TODO endpoint: deprecate (moved to api/v3/auth/login2) router.post( // TODO endpoint: deprecate (moved to api/v3/auth/login2)
"/login2", "/login2",
authLimiter, authLimiter,
body("email").exists().trim().notEmpty(), body("email").exists().trim().notEmpty().toLowerCase(),
body("clientProof").exists().trim().notEmpty(), body("clientProof").exists().trim().notEmpty(),
validateRequest, validateRequest,
authController.login2 authController.login2
+2 -2
View File
@@ -8,7 +8,7 @@ import { authLimiter } from "../../helpers/rateLimiter";
router.post( // TODO: deprecate (moved to api/v3/auth/login1) router.post( // TODO: deprecate (moved to api/v3/auth/login1)
"/login1", "/login1",
authLimiter, authLimiter,
body("email").isString().trim().notEmpty(), body("email").isString().trim().notEmpty().toLowerCase(),
body("clientPublicKey").isString().trim().notEmpty(), body("clientPublicKey").isString().trim().notEmpty(),
validateRequest, validateRequest,
authController.login1 authController.login1
@@ -17,7 +17,7 @@ router.post( // TODO: deprecate (moved to api/v3/auth/login1)
router.post( // TODO: deprecate (moved to api/v3/auth/login1) router.post( // TODO: deprecate (moved to api/v3/auth/login1)
"/login2", "/login2",
authLimiter, authLimiter,
body("email").isString().trim().notEmpty(), body("email").isString().trim().notEmpty().toLowerCase(),
body("clientProof").isString().trim().notEmpty(), body("clientProof").isString().trim().notEmpty(),
validateRequest, validateRequest,
authController.login2 authController.login2
+2 -2
View File
@@ -9,7 +9,7 @@ const router = express.Router();
router.post( router.post(
"/login1", "/login1",
authLimiter, authLimiter,
body("email").isString().trim(), body("email").isString().trim().toLowerCase(),
body("providerAuthToken").isString().trim().optional({nullable: true}), body("providerAuthToken").isString().trim().optional({nullable: true}),
body("clientPublicKey").isString().trim().notEmpty(), body("clientPublicKey").isString().trim().notEmpty(),
validateRequest, validateRequest,
@@ -19,7 +19,7 @@ router.post(
router.post( router.post(
"/login2", "/login2",
authLimiter, authLimiter,
body("email").isString().trim(), body("email").isString().trim().toLowerCase(),
body("providerAuthToken").isString().trim().optional({nullable: true}), body("providerAuthToken").isString().trim().optional({nullable: true}),
body("clientProof").isString().trim().notEmpty(), body("clientProof").isString().trim().notEmpty(),
validateRequest, validateRequest,
@@ -51,7 +51,7 @@ export const InitialStep = ({
// attemptCliLogin // attemptCliLogin
const isCliLoginSuccessful = await attemptCliLogin({ const isCliLoginSuccessful = await attemptCliLogin({
email, email: email.toLowerCase(),
password, password,
}) })
@@ -78,7 +78,7 @@ export const InitialStep = ({
} }
} else { } else {
const isLoginSuccessful = await attemptLogin({ const isLoginSuccessful = await attemptLogin({
email, email: email.toLowerCase(),
password, password,
}); });
if (isLoginSuccessful && isLoginSuccessful.success) { if (isLoginSuccessful && isLoginSuccessful.success) {
@@ -60,7 +60,7 @@ type Props = {
}; };
const addMemberFormSchema = yup.object({ const addMemberFormSchema = yup.object({
email: yup.string().email().required().label("Email").trim() email: yup.string().email().required().label("Email").trim().lowercase()
}); });
type TAddMemberForm = yup.InferType<typeof addMemberFormSchema>; type TAddMemberForm = yup.InferType<typeof addMemberFormSchema>;