I have to show an error message whenever a user enters a string that doesn’t match any item in the user array

When I use else if to show an error message, it says “wrong username” even when the username is correct but the password is incorrect. Except for the last username in the “user” array.

But when I remove the else if it does nothing when a user enters the wrong username.

I think the for loop is creating that problem.
Am I using the wrong loop for the wrong purpose? what should I do?

Codesandbox link
https://codesandbox.io/s/nervous-moser-ybvwb3?file=/src/App.js:1066-1203