From ec4d4d56a131f399590ddef750765eb324bfcb2c Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 3 Jun 2021 18:28:40 +0530 Subject: [PATCH] fix: ignore email case when creating account --- app/controllers/api/account.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index c3088c5b5d..446dfcf8f3 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -58,15 +58,18 @@ App::post('/v1/account') /** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Event\Event $audits */ + $email = \strtolower($email); if ('console' === $project->getId()) { - $whitlistEmails = $project->getAttribute('authWhitelistEmails'); - $whitlistIPs = $project->getAttribute('authWhitelistIPs'); + $whitelistEmails = $project->getAttribute('authWhitelistEmails'); + $whitelistIPs = $project->getAttribute('authWhitelistIPs'); - if (!empty($whitlistEmails) && !\in_array($email, $whitlistEmails)) { + var_dump($whitelistEmails); + + if (!empty($whitelistEmails) && !\in_array($email, $whitelistEmails)) { throw new Exception('Console registration is restricted to specific emails. Contact your administrator for more information.', 401); } - if (!empty($whitlistIPs) && !\in_array($request->getIP(), $whitlistIPs)) { + if (!empty($whitelistIPs) && !\in_array($request->getIP(), $whitelistIPs)) { throw new Exception('Console registration is restricted to specific IPs. Contact your administrator for more information.', 401); } }