mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-15 22:29:42 -06:00
Adjusted password form field namings
This commit is contained in:
@@ -24,13 +24,14 @@ const PasswordPanel = () => {
|
||||
|
||||
//for testing, will tweak when I implement redux slice
|
||||
const idToName = {
|
||||
"edit-current-password": "currentPassword",
|
||||
"edit-new-password": "password",
|
||||
"edit-current-password": "password",
|
||||
//TBD - form field naming
|
||||
"edit-new-password": "newpassword",
|
||||
"edit-confirm-password": "confirm",
|
||||
};
|
||||
const [localData, setLocalData] = useState({
|
||||
currentPassword: "",
|
||||
password: "",
|
||||
newpassword: "",
|
||||
confirm: "",
|
||||
});
|
||||
const [errors, setErrors] = useState({});
|
||||
@@ -45,7 +46,7 @@ const PasswordPanel = () => {
|
||||
|
||||
const validation = editPasswordValidation.validate(
|
||||
{ [name]: value },
|
||||
{ abortEarly: false, context: { password: localData.password } }
|
||||
{ abortEarly: false, context: { newpassword: localData.newpassword } }
|
||||
);
|
||||
|
||||
setErrors((prev) => {
|
||||
@@ -66,7 +67,7 @@ const PasswordPanel = () => {
|
||||
|
||||
const { error } = editPasswordValidation.validate(localData, {
|
||||
abortEarly: false,
|
||||
context: { password: localData.password },
|
||||
context: { newpassword: localData.newpassword },
|
||||
});
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -84,12 +84,12 @@ const editProfileValidation = joi.object({
|
||||
|
||||
const editPasswordValidation = joi.object({
|
||||
// TBD - validation for current password ?
|
||||
currentPassword : joi
|
||||
password : joi
|
||||
.string().trim()
|
||||
.messages({
|
||||
"string.empty": "*Current password is required.",
|
||||
}),
|
||||
password: joi
|
||||
newpassword: joi
|
||||
.string()
|
||||
.trim()
|
||||
.min(8)
|
||||
|
||||
Reference in New Issue
Block a user