Skip to content

Commit

Permalink
SHM-3864: should not be able to change password to existing password
Browse files Browse the repository at this point in the history
  • Loading branch information
jpratham01 authored and chrypnotoad committed Feb 13, 2024
1 parent 7dbfa30 commit 1387cd6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hooks/usePasswordChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export const usePassword = (): ChangePasswordResult => {

async function changePassword(currentPassword: string, newPassword: string): Promise<void> {
setIsLoading(true)
if(currentPassword === newPassword){
showTemporaryErrorMessage("The new password must differ from the existing password.")
setIsLoading(false)
return;
}
try {
const currentPwSha256digest = await hashSha256(currentPassword)
const newPwSha256digest = await hashSha256(newPassword)
Expand Down

0 comments on commit 1387cd6

Please sign in to comment.