Responds with error on unknown login.

This commit is contained in:
Luka Vandervelden 2020-02-26 14:36:54 +01:00
parent 3ce1d78a50
commit 0fb17f3be6

View File

@ -50,7 +50,11 @@ class AuthD::Service
def handle_request(request : AuthD::Request?, connection : IPC::Connection) def handle_request(request : AuthD::Request?, connection : IPC::Connection)
case request case request
when Request::GetToken when Request::GetToken
user = @users_per_login.get request.login begin
user = @users_per_login.get request.login
rescue e : DODB::MissingEntry
return Response::Error.new "invalid credentials"
end
if user.password_hash != hash_password request.password if user.password_hash != hash_password request.password
return Response::Error.new "invalid credentials" return Response::Error.new "invalid credentials"