From 1941cf93b45f3045dc8480731aac518d2cf882ba Mon Sep 17 00:00:00 2001 From: eldadfux Date: Tue, 1 Oct 2019 19:11:51 +0300 Subject: [PATCH] Fixed cs issues --- app/config/locale/cat.countries.php | 1 + app/config/locale/ua.continents.php | 1 + app/config/locale/ua.countries.php | 1 + app/controllers/auth.php | 17 ++++++++--------- app/init.php | 12 ++++++------ 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/config/locale/cat.countries.php b/app/config/locale/cat.countries.php index 30d61f0cde..3b8f2383be 100644 --- a/app/config/locale/cat.countries.php +++ b/app/config/locale/cat.countries.php @@ -1,4 +1,5 @@ 'Afganistan', 'AO' => 'Angola', diff --git a/app/config/locale/ua.continents.php b/app/config/locale/ua.continents.php index 9f7e254e2a..6813bc31d4 100644 --- a/app/config/locale/ua.continents.php +++ b/app/config/locale/ua.continents.php @@ -1,4 +1,5 @@ 'Африка', 'AN' => 'Антарктика', diff --git a/app/config/locale/ua.countries.php b/app/config/locale/ua.countries.php index 2308b7c0a5..0be63cc7d9 100644 --- a/app/config/locale/ua.countries.php +++ b/app/config/locale/ua.countries.php @@ -1,4 +1,5 @@ 'Афганістан', 'AO' => 'Ангола', diff --git a/app/controllers/auth.php b/app/controllers/auth.php index 28bfbb1770..5d07bef47f 100644 --- a/app/controllers/auth.php +++ b/app/controllers/auth.php @@ -48,9 +48,9 @@ $utopia->post('/v1/auth/register') ->action( function ($email, $password, $confirm, $success, $failure, $name) use ($request, $response, $register, $audit, $projectDB, $project, $webhook) { if ('console' === $project->getUid()) { - $whitlistEmails = $project->getAttribute('authWhitelistEmails'); - $whitlistIPs = $project->getAttribute('authWhitelistIPs'); - $whitlistDomains = $project->getAttribute('authWhitelistDomains'); + $whitlistEmails = $project->getAttribute('authWhitelistEmails'); + $whitlistIPs = $project->getAttribute('authWhitelistIPs'); + $whitlistDomains = $project->getAttribute('authWhitelistDomains'); if (!empty($whitlistEmails) && !in_array($email, $whitlistEmails)) { throw new Exception('Console registration is restricted to specific emails. Contact your administrator for more information.', 401); @@ -60,11 +60,11 @@ $utopia->post('/v1/auth/register') throw new Exception('Console registration is restricted to specific IPs. Contact your administrator for more information.', 401); } - if (!empty($whitlistDomains) && !in_array(substr(strrchr($email, "@"), 1), $whitlistDomains)) { + if (!empty($whitlistDomains) && !in_array(substr(strrchr($email, '@'), 1), $whitlistDomains)) { throw new Exception('Console registration is restricted to specific domains. Contact your administrator for more information.', 401); } } - + $profile = $projectDB->getCollection([ // Get user by email address 'limit' => 1, 'first' => true, @@ -76,7 +76,7 @@ $utopia->post('/v1/auth/register') if (!empty($profile)) { if ($failure) { - $response->redirect($failure . '?message=User already registered'); + $response->redirect($failure.'?message=User already registered'); return; } @@ -777,7 +777,7 @@ $utopia->get('/v1/auth/oauth/:provider/redirect') } $oauthID = $oauth->getUserID($accessToken); - + if (empty($oauthID)) { if (!empty($state['failure'])) { $response->redirect($state['failure'], 301, 0); @@ -787,7 +787,7 @@ $utopia->get('/v1/auth/oauth/:provider/redirect') } $current = Auth::tokenVerify($user->getAttribute('tokens', []), Auth::TOKEN_TYPE_LOGIN, Auth::$secret); - + if ($current) { $projectDB->deleteDocument($current); //throw new Exception('User already logged in', 401); } @@ -801,7 +801,6 @@ $utopia->get('/v1/auth/oauth/:provider/redirect') ], ]) : $user; - if (empty($user)) { // No user logged in or with oauth provider ID, create new one or connect with account with same email $name = $oauth->getUserName($accessToken); $email = $oauth->getUserEmail($accessToken); diff --git a/app/init.php b/app/init.php index 92e3d9d90b..971573f9d9 100644 --- a/app/init.php +++ b/app/init.php @@ -127,12 +127,12 @@ $locale = $request->getParam('locale', $request->getHeader('X-Appwrite-Locale', Locale::$exceptions = false; -Locale::setLanguage('en', include __DIR__ . '/config/locale/en.php'); -Locale::setLanguage('he', include __DIR__ . '/config/locale/he.php'); -Locale::setLanguage('ua', include __DIR__ . '/config/locale/ua.php'); -Locale::setLanguage('pt-br', include __DIR__ . '/config/locale/pt-br.php'); -Locale::setLanguage('es', include __DIR__ . '/config/locale/es.php'); -Locale::setLanguage('ro', include __DIR__ . '/config/locale/ro.php'); +Locale::setLanguage('en', include __DIR__.'/config/locale/en.php'); +Locale::setLanguage('he', include __DIR__.'/config/locale/he.php'); +Locale::setLanguage('ua', include __DIR__.'/config/locale/ua.php'); +Locale::setLanguage('pt-br', include __DIR__.'/config/locale/pt-br.php'); +Locale::setLanguage('es', include __DIR__.'/config/locale/es.php'); +Locale::setLanguage('ro', include __DIR__.'/config/locale/ro.php'); if (in_array($locale, APP_LOCALES)) { Locale::setDefault($locale);