diff --git a/src/app/profile/change-password.tsx b/src/app/profile/change-password.tsx
index c59d46d..301112a 100644
--- a/src/app/profile/change-password.tsx
+++ b/src/app/profile/change-password.tsx
@@ -42,9 +42,6 @@ export default function ChangePasswordScreen() {
if (!newPassword) {
setNewError("New password is required");
hasError = true;
- } else if (currentPassword && newPassword === currentPassword) {
- setNewError("New password cannot be the same as current password");
- hasError = true;
} else if (newPassword.length < 8) {
setNewError("New password must be at least 8 characters");
hasError = true;
@@ -97,6 +94,16 @@ export default function ChangePasswordScreen() {
errMsg.toLowerCase().includes("same")
) {
setNewError(errMsg);
+ } else if (
+ typeof errMsg === "string" &&
+ (errMsg.toLowerCase().includes("current") || errMsg.toLowerCase().includes("old"))
+ ) {
+ setCurrentError(errMsg);
+ } else if (
+ typeof errMsg === "string" &&
+ errMsg.toLowerCase().includes("confirm")
+ ) {
+ setConfirmError(errMsg);
} else {
setCurrentError(errMsg);
}
@@ -124,7 +131,10 @@ export default function ChangePasswordScreen() {
{
+ setCurrentPassword(text);
+ if (currentError) setCurrentError("");
+ }}
placeholder="Enter current password"
error={currentError}
/>
@@ -134,7 +144,10 @@ export default function ChangePasswordScreen() {
{
+ setNewPassword(text);
+ if (newError) setNewError("");
+ }}
placeholder="Min. 8 characters with numbers & symbols"
error={newError}
/>
@@ -144,7 +157,10 @@ export default function ChangePasswordScreen() {
{
+ setConfirmPassword(text);
+ if (confirmError) setConfirmError("");
+ }}
placeholder="Re-enter new password"
error={confirmError}
/>