Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/apiv2/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def test_disable_enable_user(self):
helper = Helper()
with self.assertRaises(HashtopolisError) as e:
helper._test_authentication(user.name, password)
self.assertEqual(e.exception.status_code, 401)
self.assertEqual(e.exception.title, f"Authentication failed")
self.assertEqual(e.exception.status_code, 403)
self.assertEqual(e.exception.title, f"Cannot log in. Please contact your administrator for further information")

# Enable user
user.isValid = True
Expand Down
3 changes: 2 additions & 1 deletion src/inc/apiv2/auth/HashtopolisAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Hashtopolis\dba\Factory;
use Hashtopolis\dba\models\User;
use Hashtopolis\dba\QueryFilter;
use Hashtopolis\inc\apiv2\error\HttpForbidden;
use Tuupola\Middleware\HttpBasicAuthentication\AuthenticatorInterface;
use Hashtopolis\inc\Util;

Expand All @@ -27,7 +28,7 @@ public function __invoke(array $arguments): bool {
}

if ($user->getIsValid() != 1) {
return false;
throw new HttpForbidden("Cannot log in. Please contact your administrator for further information");
}
else if (!Encryption::passwordVerify($password, $user->getPasswordSalt(), $user->getPasswordHash())) {
Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::WARN, "Failed login attempt due to wrong password!");
Expand Down
Loading