Skip to content

refactor this code snippet possible bug #204

@fredsonchaves07

Description

@fredsonchaves07
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactCode refact or change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions