[DSAAS-18] fix(Auenticação): Ajuste para informar se o usuário foi localizado ou não
This commit is contained in:
parent
9696c6ff6b
commit
bb5e4cf5a3
1 changed files with 8 additions and 2 deletions
|
|
@ -14,14 +14,20 @@ class AuthenticateService:
|
|||
get_by_authenticate_action = GetByAuthenticateAction()
|
||||
|
||||
# Execução e retorno da action
|
||||
|
||||
get_by_authenticate_result = get_by_authenticate_action.execute(g_usuario_authenticate_schema)
|
||||
|
||||
# Se não encontrou o usuário, lança exceção ou retorna erro
|
||||
if get_by_authenticate_result is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail='Usuário ou senha inválidos'
|
||||
)
|
||||
|
||||
# Verifica se a senha do usuário esta correta
|
||||
if not Security.is_hash(get_by_authenticate_result.senha_api):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail='A senha armazenada é inválida'
|
||||
detail='A senha informada é inválida'
|
||||
)
|
||||
|
||||
# Verifica se a senha do usuário esta correta
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue