From f3dca378fb096b881df826c428fb0ee9a1793f0e Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Thu, 12 Nov 2020 14:18:05 +0100 Subject: [PATCH] FEAT #15370 TIME 4:50 fix migration + fix case sensitive standard connection --- migration/20.10/2010.sql | 2 +- src/core/controllers/AuthenticationController.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/20.10/2010.sql b/migration/20.10/2010.sql index 72a85f10f90..25a266f54d8 100755 --- a/migration/20.10/2010.sql +++ b/migration/20.10/2010.sql @@ -188,7 +188,7 @@ END$$; DO $$ BEGIN IF (SELECT count(column_name) from information_schema.columns where table_name = 'history' and column_name = 'user_id' and data_type != 'integer') THEN ALTER TABLE history ADD COLUMN user_id_tmp INTEGER; - UPDATE history set user_id_tmp = (select id FROM users where lower(users.user_id) = lower(history.user_id)); + UPDATE history set user_id_tmp = (select id FROM users where lower(users.user_id) = lower(history.user_id) LIMIT 1); ALTER TABLE history DROP COLUMN IF EXISTS user_id; ALTER TABLE history RENAME COLUMN user_id_tmp TO user_id; UPDATE history set record_id = (select id FROM users where users.user_id = history.record_id) WHERE table_name = 'users'; diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php index 5f0c802bda6..cf5fe567621 100755 --- a/src/core/controllers/AuthenticationController.php +++ b/src/core/controllers/AuthenticationController.php @@ -252,7 +252,7 @@ class AuthenticationController } if ($loggingMethod['id'] == 'standard') { - $login = strtolower($body['login']); + $login = $body['login']; if (!AuthenticationController::isUserAuthorized(['login' => $login])) { return $response->withStatus(403)->withJson(['errors' => 'Authentication Failed']); } @@ -286,7 +286,7 @@ class AuthenticationController if (!empty($authenticated['errors'])) { return $response->withStatus(401)->withJson(['errors' => $authenticated['errors']]); } - $login = strtolower($authenticated['login']); + $login = $authenticated['login']; if (!AuthenticationController::isUserAuthorized(['login' => $login])) { return $response->withStatus(403)->withJson(['errors' => 'Authentication unauthorized']); } -- GitLab