Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
ISTE-19: Updated password for profile ( #770 )
Browse files Browse the repository at this point in the history
ISTE-19: Updated password for profile
  • Loading branch information
anilsingha-eGov authored Apr 18, 2024
2 parents 07c3c3d + 6d9d97f commit 8eab20e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
const setUserNewPassword = (value) => {
setNewPassword(value);

if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) {
if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,10})$/i).test(value)) {
setErrors({ ...errors, newPassword: { type: "pattern", message: "CORE_COMMON_PROFILE_PASSWORD_INVALID" } });
} else {
setErrors({ ...errors, newPassword: null });
Expand All @@ -165,7 +165,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
const setUserConfirmPassword = (value) => {
setConfirmPassword(value);

if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) {
if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,10})$/i).test(value)) {
setErrors({ ...errors, confirmPassword: { type: "pattern", message: "CORE_COMMON_PROFILE_PASSWORD_INVALID" } });
} else {
setErrors({ ...errors, confirmPassword: null });
Expand Down Expand Up @@ -216,7 +216,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") });
}

if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(newPassword) && !new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(confirmPassword)) {
if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,10})$/i).test(newPassword) && !new RegExp(/^([a-zA-Z0-9@#$%]{8,10})$/i).test(confirmPassword)) {
throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") });
}
}
Expand Down Expand Up @@ -606,6 +606,8 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
pattern="^([a-zA-Z0-9@#$%])+$"
onChange={(e) => setUserCurrentPassword(e.target.value)}
disable={editScreen}
maxlength={10}

/>
{errors?.currentPassword && <CardLabelError>{t(errors?.currentPassword?.message)}</CardLabelError>}
</div>
Expand All @@ -625,6 +627,8 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
pattern="^([a-zA-Z0-9@#$%])+$"
onChange={(e) => setUserNewPassword(e.target.value)}
disable={editScreen}
maxlength={10}

/>
{errors?.newPassword && <CardLabelError>{t(errors?.newPassword?.message)}</CardLabelError>}
</div>
Expand All @@ -644,6 +648,8 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
pattern="^([a-zA-Z0-9@#$%])+$"
onChange={(e) => setUserConfirmPassword(e.target.value)}
disable={editScreen}
maxlength={10}

/>
{errors?.confirmPassword && <CardLabelError>{t(errors?.confirmPassword?.message)}</CardLabelError>}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ const ChangePasswordComponent = ({ config: propsConfig, t }) => {
const config = [
{
body: [
// {
// label: t(username.label),
// type: username.type,
// populators: {
// name: username.name,
// },
// isMandatory: true,
// },
{
label: t(password.label),
type: password.type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ export const config = [
submitButtonLabel: "CORE_COMMON_CHANGE_PASSWORD",
},
inputs: [
{
label: "CORE_LOGIN_USERNAME",
type: "text",
name: "userName",
error: "ERR_HRMS_INVALID_USERNAME",
},
{
label: "CORE_LOGIN_NEW_PASSWORD",
type: "password",
Expand Down

0 comments on commit 8eab20e

Please sign in to comment.