Fix accessing the wrong array index when attempting to login a user.