Merge pull request #713 from bluewave-labs/fix/email-case
Fix/email case, resolves #566
This commit is contained in:
6 files changed
+41
-12
No files matched your search
@@ -48,6 +48,7 @@ const Field = forwardRef(
|
|||||||
placeholder,
|
placeholder,
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
|
onInput,
|
||||||
error,
|
error,
|
||||||
disabled,
|
disabled,
|
||||||
},
|
},
|
||||||
@@ -87,6 +88,7 @@ const Field = forwardRef(
|
|||||||
multiline={type === "description"}
|
multiline={type === "description"}
|
||||||
rows={type === "description" ? 4 : 1}
|
rows={type === "description" ? 4 : 1}
|
||||||
value={value}
|
value={value}
|
||||||
|
onInput={onInput}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
inputRef={ref}
|
inputRef={ref}
|
||||||
@@ -176,6 +178,8 @@ const Field = forwardRef(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Field.displayName = "Field";
|
||||||
|
|
||||||
Field.propTypes = {
|
Field.propTypes = {
|
||||||
type: PropTypes.oneOf(["text", "password", "url", "email", "description"]),
|
type: PropTypes.oneOf(["text", "password", "url", "email", "description"]),
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
@@ -189,6 +193,7 @@ Field.propTypes = {
|
|||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
value: PropTypes.string.isRequired,
|
value: PropTypes.string.isRequired,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
|
onInput: PropTypes.func,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
placeholder="jordan.ellis@domain.com"
|
placeholder="jordan.ellis@domain.com"
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
value={form.email}
|
value={form.email}
|
||||||
|
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
error={errors.email}
|
error={errors.email}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
placeholder="jordan.ellis@domain.com"
|
placeholder="jordan.ellis@domain.com"
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
value={form.email}
|
value={form.email}
|
||||||
|
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
error={errors.email}
|
error={errors.email}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ const credentials = joi.object({
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.email({ tlds: { allow: false } })
|
.email({ tlds: { allow: false } })
|
||||||
|
.custom((value, helpers) => {
|
||||||
|
const lowercasedValue = value.toLowerCase();
|
||||||
|
if (value !== lowercasedValue) {
|
||||||
|
return helpers.message("Email must be in lowercase");
|
||||||
|
}
|
||||||
|
return lowercasedValue;
|
||||||
|
})
|
||||||
.messages({
|
.messages({
|
||||||
"string.empty": "Email is required",
|
"string.empty": "Email is required",
|
||||||
"string.email": "Must be a valid email address",
|
"string.email": "Must be a valid email address",
|
||||||
@@ -72,14 +79,10 @@ const credentials = joi.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const monitorValidation = joi.object({
|
const monitorValidation = joi.object({
|
||||||
url: joi
|
url: joi.string().uri({ allowRelative: true }).trim().messages({
|
||||||
.string()
|
"string.empty": "This field is required.",
|
||||||
.uri({ allowRelative: true })
|
"string.uri": "The URL you provided is not valid.",
|
||||||
.trim()
|
}),
|
||||||
.messages({
|
|
||||||
"string.empty": "This field is required.",
|
|
||||||
"string.uri": "The URL you provided is not valid.",
|
|
||||||
}),
|
|
||||||
name: joi.string().trim().max(50).allow("").messages({
|
name: joi.string().trim().max(50).allow("").messages({
|
||||||
"string.max": "This field should not exceed the 50 characters limit.",
|
"string.max": "This field should not exceed the 50 characters limit.",
|
||||||
}),
|
}),
|
||||||
|
|||||||
+1
-2
@@ -2,6 +2,5 @@
|
|||||||
!build_images.sh
|
!build_images.sh
|
||||||
mongo/data/*
|
mongo/data/*
|
||||||
redis/data/*
|
redis/data/*
|
||||||
nginx/*
|
|
||||||
certbot/*
|
|
||||||
*.env
|
*.env
|
||||||
|
certbot/*
|
||||||
@@ -16,7 +16,17 @@ const roleValidatior = (role) => (value, helpers) => {
|
|||||||
//****************************************
|
//****************************************
|
||||||
|
|
||||||
const loginValidation = joi.object({
|
const loginValidation = joi.object({
|
||||||
email: joi.string().email().required(),
|
email: joi
|
||||||
|
.string()
|
||||||
|
.email()
|
||||||
|
.required()
|
||||||
|
.custom((value, helpers) => {
|
||||||
|
const lowercasedValue = value.toLowerCase();
|
||||||
|
if (value !== lowercasedValue) {
|
||||||
|
return helpers.message("Email must be in lowercase");
|
||||||
|
}
|
||||||
|
return lowercasedValue;
|
||||||
|
}),
|
||||||
password: joi
|
password: joi
|
||||||
.string()
|
.string()
|
||||||
.min(8)
|
.min(8)
|
||||||
@@ -35,7 +45,17 @@ const registerValidation = joi.object({
|
|||||||
.string()
|
.string()
|
||||||
.required()
|
.required()
|
||||||
.pattern(/^[A-Za-z]+$/),
|
.pattern(/^[A-Za-z]+$/),
|
||||||
email: joi.string().email().required(),
|
email: joi
|
||||||
|
.string()
|
||||||
|
.email()
|
||||||
|
.required()
|
||||||
|
.custom((value, helpers) => {
|
||||||
|
const lowercasedValue = value.toLowerCase();
|
||||||
|
if (value !== lowercasedValue) {
|
||||||
|
return helpers.message("Email must be in lowercase");
|
||||||
|
}
|
||||||
|
return lowercasedValue;
|
||||||
|
}),
|
||||||
password: joi
|
password: joi
|
||||||
.string()
|
.string()
|
||||||
.min(8)
|
.min(8)
|
||||||
|
|||||||
Reference in new issue
Block a user