fix(dashboard-v2): bulletproof emptying one's email address
This commit is contained in:
parent
07112383d3
commit
5231413074
|
@ -16,7 +16,7 @@ const emailUpdateSchema = Yup.object().shape({
|
||||||
is: isPopulated,
|
is: isPopulated,
|
||||||
then: (schema) => schema.required("Please confirm new email address"),
|
then: (schema) => schema.required("Please confirm new email address"),
|
||||||
}),
|
}),
|
||||||
password: Yup.string().min(6, "Password has to be at least 6 characters long"),
|
password: Yup.string().min(1, "Password can't be blank"),
|
||||||
confirmPassword: Yup.string()
|
confirmPassword: Yup.string()
|
||||||
.oneOf([Yup.ref("password"), null], "Passwords must match")
|
.oneOf([Yup.ref("password"), null], "Passwords must match")
|
||||||
.when("password", {
|
.when("password", {
|
||||||
|
@ -38,7 +38,10 @@ export const AccountSettingsForm = ({ user, onSuccess, onFailure }) => {
|
||||||
onSubmit={async ({ email, password }, { resetForm }) => {
|
onSubmit={async ({ email, password }, { resetForm }) => {
|
||||||
try {
|
try {
|
||||||
await accountsService.put("user", {
|
await accountsService.put("user", {
|
||||||
json: { email, password },
|
json: {
|
||||||
|
email: email || undefined,
|
||||||
|
password: password || undefined,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|
Reference in New Issue