From 7c681db77c78f476fb2b03238629477bf5e5e7ad Mon Sep 17 00:00:00 2001 From: Johan Janssens Date: Tue, 26 May 2015 23:46:00 +0200 Subject: [PATCH] re #58 : Remove the gmail authentication plugin --- .../en-GB/en-GB.plg_authentication_gmail.ini | 22 -- .../en-GB.plg_authentication_gmail.sys.ini | 7 - administrator/language/en-GB/install.xml | 2 - installation/sql/mysql/joomla.sql | 1 - plugins/authentication/gmail/gmail.php | 211 ------------------ plugins/authentication/gmail/gmail.xml | 67 ------ plugins/authentication/gmail/index.html | 1 - tests/unit/stubs/database/jos_extensions.csv | 1 - 8 files changed, 312 deletions(-) delete mode 100644 administrator/language/en-GB/en-GB.plg_authentication_gmail.ini delete mode 100644 administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini delete mode 100644 plugins/authentication/gmail/gmail.php delete mode 100644 plugins/authentication/gmail/gmail.xml delete mode 100644 plugins/authentication/gmail/index.html diff --git a/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini b/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini deleted file mode 100644 index e6db3925b9..0000000000 --- a/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini +++ /dev/null @@ -1,22 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_AUTHENTICATION_GMAIL="Authentication - GMail" -PLG_GMAIL_ERROR_ACCOUNT_DISABLED_OR_NOT_ACTIVATED="Your local account is disabled or not activated" -PLG_GMAIL_ERROR_LOCAL_USERNAME_CONFLICT="A local username conflicts with your GMail user" -PLG_GMAIL_FIELD_APPLYSUFFIX_DESC="Options for applying the suffix: Don't apply the suffix, only apply the suffix if missing (any user supplied suffix will be used) or always apply the suffix replacing any user supplied suffix" -PLG_GMAIL_FIELD_APPLYSUFFIX_LABEL="Apply Username Suffix" -PLG_GMAIL_FIELD_BACKEND_LOGIN_DESC="Allow backend login via GMail account?" -PLG_GMAIL_FIELD_BACKEND_LOGIN_LABEL="Backend login" -PLG_GMAIL_FIELD_SUFFIX_DESC="A suffix to use for the username, typically gmail.com (or googlemail.com) is the suffix but you may wish to use a Google Apps for Your Domain suffix. This doesn't include the @ symbol, if left blank username suffix will be ignored." -PLG_GMAIL_FIELD_SUFFIX_LABEL="Username Suffix" -PLG_GMAIL_FIELD_USER_BLACKLIST_DESC="A list of usernames not permitted to log in via the GMail plugin. The usernames should be separated by a comma." -PLG_GMAIL_FIELD_USER_BLACKLIST_LABEL="User Blacklist" -PLG_GMAIL_FIELD_VALUE_APPLYSUFFIXALWAYS="Always use suffix" -PLG_GMAIL_FIELD_VALUE_APPLYSUFFIXMISSING="Apply suffix if missing" -PLG_GMAIL_FIELD_VALUE_NOAPPLYSUFFIX="Don't Apply Suffix" -PLG_GMAIL_FIELD_VERIFYPEER_DESC="Verify the peer connection using a CA certificate. In some situations authentication will fail due to certificate issues, disabling this should resolve the situation in that case." -PLG_GMAIL_FIELD_VERIFYPEER_LABEL="Verify Peer" -PLG_GMAIL_XML_DESCRIPTION="Handles User Authentication with a GMail or Googlemail account (Requires cURL)
Warning! You must have at least one authentication plugin enabled or you will lose all access to your site." diff --git a/administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini b/administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini deleted file mode 100644 index bc9daed950..0000000000 --- a/administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini +++ /dev/null @@ -1,7 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_AUTHENTICATION_GMAIL="Authentication - GMail" -PLG_GMAIL_XML_DESCRIPTION="Handles User Authentication with a GMail or Googlemail account (Requires cURL)
Warning! You must have at least one authentication plugin enabled or you will lose all access to your site." \ No newline at end of file diff --git a/administrator/language/en-GB/install.xml b/administrator/language/en-GB/install.xml index a7c3e97732..78c17bf4e3 100644 --- a/administrator/language/en-GB/install.xml +++ b/administrator/language/en-GB/install.xml @@ -82,8 +82,6 @@ en-GB.mod_version.sys.ini en-GB.plg_authentication_cookie.ini en-GB.plg_authentication_cookie.sys.ini - en-GB.plg_authentication_gmail.ini - en-GB.plg_authentication_gmail.sys.ini en-GB.plg_authentication_joomla.ini en-GB.plg_authentication_joomla.sys.ini en-GB.plg_authentication_ldap.ini diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 801ead189b..512559274b 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -343,7 +343,6 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (314, 'mod_version', 'module', 'mod_version', '', 1, 1, 1, 0, '', '{"format":"short","product":"1","cache":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (316, 'mod_tags_popular', 'module', 'mod_tags_popular', '', 0, 1, 1, 0, '', '{"maximum":"5","timeframe":"alltime","owncache":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (317, 'mod_tags_similar', 'module', 'mod_tags_similar', '', 0, 1, 1, 0, '', '{"maximum":"5","matchtype":"any","owncache":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(400, 'plg_authentication_gmail', 'plugin', 'gmail', 'authentication', 0, 0, 1, 0, '', '{"applysuffix":"0","suffix":"","verifypeer":"1","user_blacklist":""}', '', '', 0, '0000-00-00 00:00:00', 1, 0), (401, 'plg_authentication_joomla', 'plugin', 'joomla', 'authentication', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (404, 'plg_content_emailcloak', 'plugin', 'emailcloak', 'content', 0, 1, 1, 0, '', '{"mode":"1"}', '', '', 0, '0000-00-00 00:00:00', 1, 0), (406, 'plg_content_loadmodule', 'plugin', 'loadmodule', 'content', 0, 1, 1, 0, '', '{"style":"xhtml"}', '', '', 0, '2011-09-18 15:22:50', 0, 0), diff --git a/plugins/authentication/gmail/gmail.php b/plugins/authentication/gmail/gmail.php deleted file mode 100644 index c9d37af721..0000000000 --- a/plugins/authentication/gmail/gmail.php +++ /dev/null @@ -1,211 +0,0 @@ -loadLanguage(); - - // No backend authentication - if (JFactory::getApplication()->isAdmin() && !$this->params->get('backendLogin', 0)) - { - return; - } - - $success = 0; - - // Check if we have curl or not - if (function_exists('curl_init')) - { - // Check if we have a username and password - if (strlen($credentials['username']) && strlen($credentials['password'])) - { - $blacklist = explode(',', $this->params->get('user_blacklist', '')); - - // Check if the username isn't blacklisted - if (!in_array($credentials['username'], $blacklist)) - { - $suffix = $this->params->get('suffix', ''); - $applysuffix = $this->params->get('applysuffix', 0); - $offset = strpos($credentials['username'], '@'); - - // Check if we want to do suffix stuff, typically for Google Apps for Your Domain - if ($suffix && $applysuffix) - { - if ($applysuffix == 1 && $offset === false) - { - // Apply suffix if missing - $credentials['username'] .= '@' . $suffix; - } - elseif ($applysuffix == 2) - { - // Always use suffix - if ($offset) - { - // If we already have an @, get rid of it and replace it - $credentials['username'] = substr($credentials['username'], 0, $offset); - } - - $credentials['username'] .= '@' . $suffix; - } - } - - $curl = curl_init('https://mail.google.com/mail/feed/atom'); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->params->get('verifypeer', 1)); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($curl, CURLOPT_USERPWD, $credentials['username'] . ':' . $credentials['password']); - curl_exec($curl); - $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); - - switch ($code) - { - case 200: - $message = JText::_('JGLOBAL_AUTH_ACCESS_GRANTED'); - $success = 1; - break; - - case 401: - $message = JText::_('JGLOBAL_AUTH_ACCESS_DENIED'); - break; - - default: - $message = JText::_('JGLOBAL_AUTH_UNKNOWN_ACCESS_DENIED'); - break; - } - } - else - { - // The username is black listed - $message = JText::_('JGLOBAL_AUTH_USER_BLACKLISTED'); - } - } - else - { - $message = JText::_('JGLOBAL_AUTH_USER_BLACKLISTED'); - } - } - else - { - $message = JText::_('JGLOBAL_AUTH_CURL_NOT_INSTALLED'); - } - - $response->type = 'GMail'; - - if ($success) - { - if (strpos($credentials['username'], '@') === false) - { - if ($suffix) - { - // If there is a suffix then we want to apply it - $email = $credentials['username'] . '@' . $suffix; - } - else - { - // If there isn't a suffix just use the default gmail one - $email = $credentials['username'] . '@gmail.com'; - } - } - else - { - // The username looks like an email address (probably is) so use that - $email = $credentials['username']; - } - - // Extra security checks with existing local accounts - $db = JFactory::getDbo(); - - $localUsernameChecks = array(strstr($email, '@', true), $email); - - $query = $db->getQuery(true) - ->select('id, activation, username, email, block') - ->from('#__users') - ->where('username IN(' . implode(',', array_map(array($db, 'quote'), $localUsernameChecks)) . ')' - . ' OR email = ' . $db->quote($email) - ); - - $db->setQuery($query); - - if ($localUsers = $db->loadObjectList()) - { - foreach ($localUsers as $localUser) - { - // Local user exists with same username but different email address - if ($email != $localUser->email) - { - $response->status = JAuthentication::STATUS_FAILURE; - $response->error_message = JText::sprintf('JGLOBAL_AUTH_FAILED', JText::_('PLG_GMAIL_ERROR_LOCAL_USERNAME_CONFLICT')); - - return; - } - else - { - // Existing user disabled locally - if ($localUser->block || !empty($localUser->activation)) - { - $response->status = JAuthentication::STATUS_FAILURE; - $response->error_message = JText::_('JGLOBAL_AUTH_ACCESS_DENIED'); - - return; - } - - // We will always keep the local username for existing accounts - $credentials['username'] = $localUser->username; - - break; - } - } - } - elseif (JFactory::getApplication()->isAdmin()) - // We wont' allow backend access without local account - { - $response->status = JAuthentication::STATUS_FAILURE; - $response->error_message = JText::_('JERROR_LOGIN_DENIED'); - - return; - } - - $response->status = JAuthentication::STATUS_SUCCESS; - $response->error_message = ''; - $response->email = $email; - - // Reset the username to what we ended up using - $response->username = $credentials['username']; - $response->fullname = $credentials['username']; - } - else - { - $response->status = JAuthentication::STATUS_FAILURE; - $response->error_message = JText::sprintf('JGLOBAL_AUTH_FAILED', $message); - } - } -} diff --git a/plugins/authentication/gmail/gmail.xml b/plugins/authentication/gmail/gmail.xml deleted file mode 100644 index c0a3943c55..0000000000 --- a/plugins/authentication/gmail/gmail.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - plg_authentication_gmail - Joomla! Project - February 2006 - Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. - GNU General Public License version 2 or later; see LICENSE.txt - admin@joomla.org - www.joomla.org - 3.0.0 - PLG_GMAIL_XML_DESCRIPTION - - gmail.php - index.html - - - en-GB.plg_authentication_gmail.ini - en-GB.plg_authentication_gmail.sys.ini - - - - -
- - - - - - - - - - - - - - - - - - -
-
-
-
diff --git a/plugins/authentication/gmail/index.html b/plugins/authentication/gmail/index.html deleted file mode 100644 index 2efb97f319..0000000000 --- a/plugins/authentication/gmail/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/unit/stubs/database/jos_extensions.csv b/tests/unit/stubs/database/jos_extensions.csv index 8fcfa0a0c2..23037ae518 100644 --- a/tests/unit/stubs/database/jos_extensions.csv +++ b/tests/unit/stubs/database/jos_extensions.csv @@ -55,7 +55,6 @@ '314','mod_version','module','mod_version',,'1','1','1','0','{"name":"mod_version","type":"module","creationDate":"January 2012","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"MOD_VERSION_XML_DESCRIPTION","group":""}','{"format":"short","product":"1","cache":"0"}',,,'0','0000-00-00 00:00:00','0','0' '316','mod_tags_popular','module','mod_tags_popular',,'0','1','1','0','{"name":"mod_tags_popular","type":"module","creationDate":"January 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.1.0","description":"MOD_TAGS_POPULAR_XML_DESCRIPTION","group":""}','{"maximum":"5","timeframe":"alltime","owncache":"1"}',,,'0','0000-00-00 00:00:00','0','0' '317','mod_tags_similar','module','mod_tags_similar',,'0','1','1','0','{"name":"mod_tags_similar","type":"module","creationDate":"January 2013","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.1.0","description":"MOD_TAGS_SIMILAR_XML_DESCRIPTION","group":""}','{"maximum":"5","matchtype":"any","owncache":"1"}',,,'0','0000-00-00 00:00:00','0','0' -'400','plg_authentication_gmail','plugin','gmail','authentication','0','0','1','0','{"name":"plg_authentication_gmail","type":"plugin","creationDate":"February 2006","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"PLG_GMAIL_XML_DESCRIPTION","group":""}','{"applysuffix":"0","suffix":"","verifypeer":"1","user_blacklist":""}',,,'0','0000-00-00 00:00:00','1','0' '401','plg_authentication_joomla','plugin','joomla','authentication','0','1','1','1','{"name":"plg_authentication_joomla","type":"plugin","creationDate":"November 2005","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"PLG_AUTH_JOOMLA_XML_DESCRIPTION","group":""}','{}',,,'0','0000-00-00 00:00:00','0','0' '404','plg_content_emailcloak','plugin','emailcloak','content','0','1','1','0','{"name":"plg_content_emailcloak","type":"plugin","creationDate":"November 2005","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"PLG_CONTENT_EMAILCLOAK_XML_DESCRIPTION","group":""}','{"mode":"1"}',,,'0','0000-00-00 00:00:00','1','0' '406','plg_content_loadmodule','plugin','loadmodule','content','0','1','1','0','{"name":"plg_content_loadmodule","type":"plugin","creationDate":"November 2005","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"PLG_LOADMODULE_XML_DESCRIPTION","group":""}','{"style":"xhtml"}',,,'0','2011-09-18 15:22:50','0','0'