fredsonchaves07 / movie-catch-api

🍿 create, manage and rate movies and series api
MIT License
2 stars 1 forks source link

refactor this code snippet possible bug #204

Open fredsonchaves07 opened 1 year ago

fredsonchaves07 commented 1 year ago
    private void validateLoginDTO(LoginDTO loginDTO) {
        if (loginDTO == null)
            throw new EmailOrPasswordIncorrectException();
        if (loginDTO.getEmail() == null || loginDTO.getPassword() == null)
            throw new EmailOrPasswordIncorrectException();
        if (!emailAlreadyExist(loginDTO.getEmail()))
            throw new EmailOrPasswordIncorrectException();
        if (!isEmailPasswordMatch(loginDTO.getEmail(), loginDTO.getPassword()))
            throw new EmailOrPasswordIncorrectException();
        if (!userIsConfirmed())
            throw new UnconfirmedUserException();
    }

if the order of isEmailPasswordMatch with userIsConfirmed is changed, a bug may occur