[CLEANUP] Improve code quality in openid 35/38435/2
authorMarkus Klein <klein.t3@reelworx.at>
Thu, 2 Apr 2015 14:07:49 +0000 (16:07 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 7 Apr 2015 22:21:16 +0000 (00:21 +0200)
Releases: master
Resolves: #66248
Change-Id: I3246e76e10212e09f348371ef494d460c51552ce
Reviewed-on: http://review.typo3.org/38435
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
16 files changed:
typo3/sysext/openid/Classes/OpenidEid.php
typo3/sysext/openid/Classes/OpenidModuleSetup.php
typo3/sysext/openid/Classes/OpenidReturn.php
typo3/sysext/openid/Classes/OpenidService.php
typo3/sysext/openid/Classes/OpenidStore.php
typo3/sysext/openid/Classes/Wizard.php
typo3/sysext/openid/Configuration/TCA/Overrides/be_users.php
typo3/sysext/openid/Configuration/TCA/Overrides/fe_users.php
typo3/sysext/openid/Modules/OpenidReturn/index.php
typo3/sysext/openid/Resources/Private/Language/Wizard.xlf [deleted file]
typo3/sysext/openid/Resources/Private/Language/locallang.xlf [new file with mode: 0644]
typo3/sysext/openid/Resources/Private/Templates/Wizard/Content.html
typo3/sysext/openid/class.tx_openid_eid.php
typo3/sysext/openid/class.tx_openid_return.php
typo3/sysext/openid/ext_localconf.php
typo3/sysext/openid/wizard/index.php

index d283aa8..9eeb036 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Openid;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
+use TYPO3\CMS\Frontend\Utility\EidUtility;
 
 /**
  * This class is the OpenID return script for the TYPO3 Frontend.
@@ -37,22 +38,15 @@ class OpenidEid {
                // the user.
                $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = TRUE;
                // Initialize Frontend user
-               \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
+               EidUtility::initFeUser();
                // Redirect to the original location in any case (authenticated or not)
                @ob_end_clean();
-               if ($this->getSignature(GeneralUtility::_GP('tx_openid_location')) === GeneralUtility::_GP('tx_openid_location_signature')) {
-                       HttpUtility::redirect(GeneralUtility::_GP('tx_openid_location'), HttpUtility::HTTP_STATUS_303);
-               }
-       }
 
-       /**
-        * Signs a GET parameter.
-        *
-        * @param string $parameter
-        * @return string
-        */
-       protected function getSignature($parameter) {
-               return GeneralUtility::hmac($parameter, 'openid');
+               $location = GeneralUtility::_GP('tx_openid_location');
+               $signature = GeneralUtility::hmac($location, 'openid');
+               if ($signature === GeneralUtility::_GP('tx_openid_location_signature')) {
+                       HttpUtility::redirect($location, HttpUtility::HTTP_STATUS_303);
+               }
        }
 
 }
index 623ed14..4ced641 100644 (file)
@@ -15,7 +15,9 @@ namespace TYPO3\CMS\Openid;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * This class is the OpenID return script for the TYPO3 Backend (used in the user-settings module).
@@ -27,30 +29,26 @@ class OpenidModuleSetup {
        /**
         * Checks weather BE user has access to change its OpenID identifier
         *
-        * @param array $config: Configuration of the field
         * @return bool Whether it is allowed to modify the given field
         */
-       public function accessLevelCheck(array $config) {
-               $setupConfig = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields');
-               if (isset($setupConfig['tx_openid_openid.']['disabled']) && $setupConfig['tx_openid_openid.']['disabled']) {
-                       return FALSE;
-               }
-               return TRUE;
+       public function accessLevelCheck() {
+               $setupConfig = $this->getBackendUser()->getTSConfigProp('setup.fields');
+               return empty($setupConfig['tx_openid_openid.']['disabled']);
        }
 
        /**
         * Render OpenID identifier field for user setup
         *
-        * @param array $parameters Configuration of the field
-        * @param \TYPO3\CMS\Setup\Controller\SetupModuleController $parent: The calling parent object
         * @return string HTML input field to change the OpenId
         */
-       public function renderOpenID(array $parameters, \TYPO3\CMS\Setup\Controller\SetupModuleController $parent) {
-               $openid = $GLOBALS['BE_USER']->user['tx_openid_openid'];
+       public function renderOpenID() {
+               $openid = $this->getBackendUser()->user['tx_openid_openid'];
                $add = htmlspecialchars(
-                       $GLOBALS['LANG']->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:addopenid')
+                       $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:addopenid')
                );
 
+               $parameters = ['P[itemName]' => 'data[be_users][tx_openid_openid]'];
+               $popUpUrl = GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_openid', $parameters));
                return '<div class="input-group">' .
                        '<input id="field_tx_openid_openid"' .
                        ' class="form-control"' .
@@ -58,8 +56,7 @@ class OpenidModuleSetup {
                        ' value="' . htmlspecialchars($openid) . '" />' .
                        '<div class="input-group-addon">' .
                                '<a href="#" onclick="' .
-                               'vHWin=window.open(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_openid') . '&P[itemName]=data%5Bbe_users%5D%5Btx_openid_openid%5D') .
-                               ',null,\'width=600,height=400,status=0,menubar=0,scrollbars=0\');' .
+                               'vHWin=window.open(' . $popUpUrl . ',null,\'width=800,height=400,status=0,menubar=0,scrollbars=0\');' .
                                'vHWin.focus();return false;' .
                                '">' .
                                        '<img src="../typo3/sysext/openid/ext_icon_small.png" alt="' . $add . '" title="' . $add . '"/>' .
@@ -68,4 +65,17 @@ class OpenidModuleSetup {
                        '</div>';
        }
 
+       /**
+        * @return BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
+       /**
+        * @return LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
 }
index 2492f3e..b495595 100644 (file)
@@ -13,6 +13,9 @@ namespace TYPO3\CMS\Openid;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\HttpUtility;
 
 /**
  * This class is the OpenID return script for the TYPO3 Backend.
@@ -27,10 +30,12 @@ class OpenidReturn {
         * @return void
         */
        public function main() {
-               if ($GLOBALS['BE_USER']->user['uid']) {
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
-                       $backendURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'backend.php';
-                       \TYPO3\CMS\Core\Utility\HttpUtility::redirect($backendURL);
+               /** @var BackendUserAuthentication $beUser */
+               $beUser = $GLOBALS['BE_USER'];
+               if ($beUser->user['uid']) {
+                       GeneralUtility::cleanOutputBuffers();
+                       $backendURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'backend.php';
+                       HttpUtility::redirect($backendURL);
                }
        }
 
index 878dae1..4fb7e9a 100644 (file)
@@ -15,17 +15,22 @@ namespace TYPO3\CMS\Openid;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Service\AbstractService;
+use TYPO3\CMS\Core\TimeTracker\TimeTracker;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
+use TYPO3\CMS\Core\Utility\HttpUtility;
 
-require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('openid') . 'lib/php-openid/Auth/OpenID/Interface.php';
+require_once ExtensionManagementUtility::extPath('openid') . 'lib/php-openid/Auth/OpenID/Interface.php';
 
 /**
  * Service "OpenID Authentication" for the "openid" extension.
  *
  * @author Dmitry Dulepov <dmitry@typo3.org>
  */
-class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
+class OpenidService extends AbstractService {
 
        /**
         * The extension key
@@ -65,7 +70,7 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
        protected $parentObject;
 
        /**
-        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
+        * @var DatabaseConnection
         */
        protected $databaseConnection;
 
@@ -92,15 +97,15 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
        }
 
        /**
-        * @param \TYPO3\CMS\Core\Database\DatabaseConnection $databaseConnection
+        * @param DatabaseConnection $databaseConnection
         */
-       protected function injectDatabaseConnection(\TYPO3\CMS\Core\Database\DatabaseConnection $databaseConnection = NULL) {
+       protected function injectDatabaseConnection(DatabaseConnection $databaseConnection = NULL) {
                $this->databaseConnection = $databaseConnection ?: $GLOBALS['TYPO3_DB'];
        }
 
        /**
         * Checks if service is available,. In case of this service we check that
-        * prerequesties for "PHP OpenID" libraries are fulfilled:
+        * prerequisites for "PHP OpenID" libraries are fulfilled:
         * - GMP or BCMATH PHP extensions are installed and functional
         * - set_include_path() PHP function is available
         *
@@ -133,11 +138,11 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
         * @return void
         */
        public function initAuth($subType, array $loginData, array $authenticationInformation, AbstractUserAuthentication &$parentObject) {
-               // Store login and authetication data
+               // Store login and authentication data
                $this->loginData = $loginData;
                $this->authenticationInformation = $authenticationInformation;
                // If we are here after authentication by the OpenID server, get its response.
-               if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_openid_mode') === 'finish' && $this->openIDResponse === NULL) {
+               if (GeneralUtility::_GP('tx_openid_mode') === 'finish' && $this->openIDResponse === NULL) {
                        $this->includePHPOpenIDLibrary();
                        $openIDConsumer = $this->getOpenIDConsumer();
                        $this->openIDResponse = $openIDConsumer->complete($this->getReturnURL(GeneralUtility::_GP('tx_openid_claimed')));
@@ -249,37 +254,38 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
         * @return void
         */
        protected function includePHPOpenIDLibrary() {
-               if (!self::$openIDLibrariesIncluded) {
-                       // Prevent further calls
-                       self::$openIDLibrariesIncluded = TRUE;
-                       // PHP OpenID libraries requires adjustments of path settings
-                       $oldIncludePath = get_include_path();
-                       $phpOpenIDLibPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('openid') . 'lib/php-openid';
-                       @set_include_path(($phpOpenIDLibPath . PATH_SEPARATOR . $phpOpenIDLibPath . PATH_SEPARATOR . 'Auth' . PATH_SEPARATOR . $oldIncludePath));
-                       // Make sure that random generator is properly set up. Constant could be
-                       // defined by the previous inclusion of the file
-                       if (!defined('Auth_OpenID_RAND_SOURCE')) {
-                               if (TYPO3_OS === 'WIN') {
-                                       // No random generator on Windows!
+               if (self::$openIDLibrariesIncluded) {
+                       return;
+               }
+               // Prevent further calls
+               self::$openIDLibrariesIncluded = TRUE;
+               // PHP OpenID libraries requires adjustments of path settings
+               $oldIncludePath = get_include_path();
+               $phpOpenIDLibPath = ExtensionManagementUtility::extPath('openid') . 'lib/php-openid';
+               @set_include_path(($phpOpenIDLibPath . PATH_SEPARATOR . $phpOpenIDLibPath . PATH_SEPARATOR . 'Auth' . PATH_SEPARATOR . $oldIncludePath));
+               // Make sure that random generator is properly set up. Constant could be
+               // defined by the previous inclusion of the file
+               if (!defined('Auth_OpenID_RAND_SOURCE')) {
+                       if (TYPO3_OS === 'WIN') {
+                               // No random generator on Windows!
+                               define('Auth_OpenID_RAND_SOURCE', NULL);
+                       } elseif (!is_readable('/dev/urandom')) {
+                               if (is_readable('/dev/random')) {
+                                       define('Auth_OpenID_RAND_SOURCE', '/dev/random');
+                               } else {
                                        define('Auth_OpenID_RAND_SOURCE', NULL);
-                               } elseif (!is_readable('/dev/urandom')) {
-                                       if (is_readable('/dev/random')) {
-                                               define('Auth_OpenID_RAND_SOURCE', '/dev/random');
-                                       } else {
-                                               define('Auth_OpenID_RAND_SOURCE', NULL);
-                                       }
                                }
                        }
-                       // Include files
-                       require_once $phpOpenIDLibPath . '/Auth/OpenID/Consumer.php';
-                       // Restore path
-                       @set_include_path($oldIncludePath);
-                       if (!is_array($_SESSION)) {
-                               // Yadis requires session but session is not initialized when
-                               // processing Backend authentication
-                               @session_start();
-                               $this->writeLog('Session is initialized');
-                       }
+               }
+               // Include files
+               require_once $phpOpenIDLibPath . '/Auth/OpenID/Consumer.php';
+               // Restore path
+               @set_include_path($oldIncludePath);
+               if (!is_array($_SESSION)) {
+                       // Yadis requires session but session is not initialized when
+                       // processing Backend authentication
+                       @session_start();
+                       $this->writeLog('Session is initialized');
                }
        }
 
@@ -325,7 +331,7 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
         */
        protected function getOpenIDConsumer() {
                /* @var $openIDStore OpenidStore */
-               $openIDStore = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidStore::class);
+               $openIDStore = GeneralUtility::makeInstance(OpenidStore::class);
                $openIDStore->cleanup();
                return new \Auth_OpenID_Consumer($openIDStore);
        }
@@ -375,7 +381,7 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
                        // requests without resending the form. This is exactly what we need here.
                        // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4
                        @ob_end_clean();
-                       \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectURL, \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
+                       HttpUtility::redirect($redirectURL, HttpUtility::HTTP_STATUS_303);
                } else {
                        $formHtml = $authenticationRequest->htmlMarkup($trustedRoot, $returnURL, FALSE, array('id' => 'openid_message'));
                        // Display an error if the form markup couldn't be generated;
@@ -487,7 +493,7 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
         * @return string
         */
        protected function getBackPath() {
-               $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('openid');
+               $extPath = ExtensionManagementUtility::siteRelPath('openid');
                $segmentCount = count(explode('/', $extPath));
                $path = str_pad('', $segmentCount * 3, '../') . TYPO3_mainDir;
                return $path;
@@ -563,7 +569,9 @@ class OpenidService extends \TYPO3\CMS\Core\Service\AbstractService {
                if (TYPO3_MODE === 'BE') {
                        GeneralUtility::sysLog($message, $this->extKey, GeneralUtility::SYSLOG_SEVERITY_NOTICE);
                } else {
-                       $GLOBALS['TT']->setTSlogMessage($message);
+                       /** @var TimeTracker $tt */
+                       $tt = $GLOBALS['TT'];
+                       $tt->setTSlogMessage($message);
                }
                if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {
                        GeneralUtility::devLog($message, $this->extKey, GeneralUtility::SYSLOG_SEVERITY_NOTICE);
index 6c06e77..853e4d5 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Openid;
  * The TYPO3 project - inspiring people to share!
  */
 
+
+use TYPO3\CMS\Core\Database\DatabaseConnection;
+
 require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('openid') . 'lib/php-openid/Auth/OpenID/Interface.php';
 
 /**
@@ -31,14 +34,14 @@ class OpenidStore extends \Auth_OpenID_OpenIDStore {
        const NONCE_STORAGE_TIME = 864000;
 
        /**
-        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
+        * @var DatabaseConnection
         */
        protected $databaseConnection;
 
        /**
-        * @param null|\TYPO3\CMS\Core\Database\DatabaseConnection $databaseConnection
+        * @param null|DatabaseConnection $databaseConnection
         */
-       public function __construct($databaseConnection = NULL) {
+       public function __construct(DatabaseConnection $databaseConnection = NULL) {
                $this->databaseConnection = $databaseConnection ?: $GLOBALS['TYPO3_DB'];
        }
 
@@ -52,7 +55,7 @@ class OpenidStore extends \Auth_OpenID_OpenIDStore {
        public function storeAssociation($serverUrl, $association) {
                /* @var $association \Auth_OpenID_Association */
                $this->databaseConnection->sql_query('START TRANSACTION');
-               if ($this->doesAssociationExist($serverUrl, $association->handle)) {
+               if ($this->doesAssociationExist($serverUrl, $association)) {
                        $this->updateExistingAssociation($serverUrl, $association);
                } else {
                        $this->storeNewAssociation($serverUrl, $association);
@@ -166,7 +169,12 @@ class OpenidStore extends \Auth_OpenID_OpenIDStore {
         * @return bool
         */
        protected function doesAssociationExist($serverUrl, $association) {
-               $where = sprintf('server_url=%s AND assoc_handle=%s AND expires>%d', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME), time());
+               $where = sprintf(
+                       'server_url=%s AND assoc_handle=%s AND expires>%d',
+                       $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME),
+                       $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME),
+                       time()
+               );
                $row = $this->databaseConnection->exec_SELECTgetSingleRow('COUNT(*) as assocCount', self::ASSOCIATION_TABLE_NAME, $where);
                return $row['assocCount'] > 0;
        }
@@ -179,7 +187,12 @@ class OpenidStore extends \Auth_OpenID_OpenIDStore {
         * @return void
         */
        protected function updateExistingAssociation($serverUrl, \Auth_OpenID_Association $association) {
-               $where = sprintf('server_url=%s AND assoc_handle=%s AND expires>%d', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME), time());
+               $where = sprintf(
+                       'server_url=%s AND assoc_handle=%s AND expires>%d',
+                       $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME),
+                       $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME),
+                       time()
+               );
                $serializedAssociation = serialize($association);
                $values = array(
                        'content' => base64_encode($serializedAssociation),
index 1ddff3e..ec96c3c 100644 (file)
@@ -80,10 +80,10 @@ class Wizard extends OpenidService {
                        $flashMessage = GeneralUtility::makeInstance(
                                FlashMessage::class,
                                sprintf(
-                                       $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:error.setup'),
+                                       $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:error.setup'),
                                        htmlspecialchars($openIDIdentifier)
                                ),
-                               $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:title.error'),
+                               $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:title.error'),
                                FlashMessage::ERROR
                        );
                        $flashMessageService->getMessageQueueByIdentifier()->enqueue($flashMessage);
@@ -119,8 +119,8 @@ class Wizard extends OpenidService {
                if (!$this->openIDResponse instanceof \Auth_OpenID_ConsumerResponse) {
                        $flashMessage = GeneralUtility::makeInstance(
                                FlashMessage::class,
-                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:error.no-response'),
-                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:title.error'),
+                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:error.no-response'),
+                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:title.error'),
                                FlashMessage::ERROR
                        );
                } elseif ($this->openIDResponse->status == Auth_OpenID_SUCCESS) {
@@ -129,17 +129,17 @@ class Wizard extends OpenidService {
                        $flashMessage = GeneralUtility::makeInstance(
                                FlashMessage::class,
                                sprintf(
-                                       $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:youropenid'),
+                                       $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:youropenid'),
                                        htmlspecialchars($this->claimedId)
                                ),
-                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:title.success'),
+                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:title.success'),
                                FlashMessage::OK
                        );
                } elseif ($this->openIDResponse->status == Auth_OpenID_CANCEL) {
                        $flashMessage = GeneralUtility::makeInstance(
                                FlashMessage::class,
-                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:error.cancelled'),
-                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:title.error'),
+                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:error.cancelled'),
+                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:title.error'),
                                FlashMessage::ERROR
                        );
                } else {
@@ -147,11 +147,11 @@ class Wizard extends OpenidService {
                        $flashMessage = GeneralUtility::makeInstance(
                                FlashMessage::class,
                                sprintf(
-                                       $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:error.general'),
+                                       $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:error.general'),
                                        htmlspecialchars($this->openIDResponse->status),
                                        ''
                                ),
-                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:title.error'),
+                               $lang->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:title.error'),
                                FlashMessage::ERROR
                        );
                }
@@ -167,6 +167,7 @@ class Wizard extends OpenidService {
        protected function renderHtml() {
                // use FLUID standalone view for wizard content
                $view = GeneralUtility::makeInstance(StandaloneView::class);
+               $view->getRequest()->setControllerExtensionName('openid');
                $view->setTemplatePathAndFilename(
                        ExtensionManagementUtility::extPath('openid') .
                        'Resources/Private/Templates/Wizard/Content.html'
index eb663e3..60d0a77 100644 (file)
@@ -19,7 +19,7 @@ $tempColumns = array(
                                                'name' => 'wizard_openid'
                                        ),
                                        'icon' => 'EXT:openid/ext_icon_small.png',
-                                       'JSopenParams' => ',width=600,height=400,status=0,menubar=0,scrollbars=0',
+                                       'JSopenParams' => ',width=800,height=400,status=0,menubar=0,scrollbars=0',
                                )
                        ),
                )
index 83c5df9..58576a6 100644 (file)
@@ -19,7 +19,7 @@ $tempColumns = array(
                                                'name' => 'wizard_openid'
                                        ),
                                        'icon' => 'EXT:openid/ext_icon_small.png',
-                                       'JSopenParams' => ',width=600,height=400,status=0,menubar=0,scrollbars=0',
+                                       'JSopenParams' => ',width=800,height=400,status=0,menubar=0,scrollbars=0',
                                )
                        ),
                )
index 84296c9..95a6d0a 100644 (file)
@@ -17,6 +17,6 @@ if (isset($_GET['login_status'])) {
        $_POST['login_status'] = $_GET['login_status'];
 }
 
-$module = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidReturn::class);
 /** @var \TYPO3\CMS\Openid\OpenidReturn $module */
-$module->main();
\ No newline at end of file
+$module = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidReturn::class);
+$module->main();
diff --git a/typo3/sysext/openid/Resources/Private/Language/Wizard.xlf b/typo3/sysext/openid/Resources/Private/Language/Wizard.xlf
deleted file mode 100644 (file)
index cf715aa..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
-       <file t3:id="1415814905" source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:35Z" product-name="openid">
-               <header/>
-               <body>
-                       <trans-unit id="title.error">
-                               <source>Error during OpenID authentication</source>
-                       </trans-unit>
-                       <trans-unit id="title.success">
-                               <source>OpenID authentication successful</source>
-                       </trans-unit>
-                       <trans-unit id="error.cancelled">
-                               <source>OpenID authentication has been cancelled.</source>
-                       </trans-unit>
-                       <trans-unit id="error.general">
-                               <source><![CDATA[Status: %s<br/>Message: %s]]></source>
-                       </trans-unit>
-                       <trans-unit id="error.no-response">
-                               <source>We got no OpenID response.</source>
-                       </trans-unit>
-                       <trans-unit id="error.setup">
-                               <source>Error setting up OpenID authentication for "%s".</source>
-                       </trans-unit>
-                       <trans-unit id="youropenid">
-                               <source><![CDATA[OpenID is: <tt>%s</tt>]]></source>
-                       </trans-unit>
-
-                       <trans-unit id="addopenid">
-                               <source>Add OpenID</source>
-                       </trans-unit>
-
-                       <trans-unit id="html.title">
-                               <source>OpenID registration</source>
-                       </trans-unit>
-                       <trans-unit id="html.description">
-                               <source>Add an OpenID to your backend user. This OpenID can then be used to log in the TYPO3 backend.</source>
-                       </trans-unit>
-                       <trans-unit id="html.openid_url">
-                               <source>OpenID identifier</source>
-                       </trans-unit>
-                       <trans-unit id="html.search">
-                               <source>Search</source>
-                       </trans-unit>
-                       <trans-unit id="html.submit">
-                               <source>Login</source>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
diff --git a/typo3/sysext/openid/Resources/Private/Language/locallang.xlf b/typo3/sysext/openid/Resources/Private/Language/locallang.xlf
new file mode 100644 (file)
index 0000000..cf715aa
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
+       <file t3:id="1415814905" source-language="en" datatype="plaintext" original="messages" date="2011-10-17T20:22:35Z" product-name="openid">
+               <header/>
+               <body>
+                       <trans-unit id="title.error">
+                               <source>Error during OpenID authentication</source>
+                       </trans-unit>
+                       <trans-unit id="title.success">
+                               <source>OpenID authentication successful</source>
+                       </trans-unit>
+                       <trans-unit id="error.cancelled">
+                               <source>OpenID authentication has been cancelled.</source>
+                       </trans-unit>
+                       <trans-unit id="error.general">
+                               <source><![CDATA[Status: %s<br/>Message: %s]]></source>
+                       </trans-unit>
+                       <trans-unit id="error.no-response">
+                               <source>We got no OpenID response.</source>
+                       </trans-unit>
+                       <trans-unit id="error.setup">
+                               <source>Error setting up OpenID authentication for "%s".</source>
+                       </trans-unit>
+                       <trans-unit id="youropenid">
+                               <source><![CDATA[OpenID is: <tt>%s</tt>]]></source>
+                       </trans-unit>
+
+                       <trans-unit id="addopenid">
+                               <source>Add OpenID</source>
+                       </trans-unit>
+
+                       <trans-unit id="html.title">
+                               <source>OpenID registration</source>
+                       </trans-unit>
+                       <trans-unit id="html.description">
+                               <source>Add an OpenID to your backend user. This OpenID can then be used to log in the TYPO3 backend.</source>
+                       </trans-unit>
+                       <trans-unit id="html.openid_url">
+                               <source>OpenID identifier</source>
+                       </trans-unit>
+                       <trans-unit id="html.search">
+                               <source>Search</source>
+                       </trans-unit>
+                       <trans-unit id="html.submit">
+                               <source>Login</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
index 76fab58..069a53c 100644 (file)
@@ -1,11 +1,11 @@
-<f:be.container pageTitle="{f:translate(key:'LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:html.title')}"
+<f:be.container pageTitle="{f:translate(key:'html.title')}"
        includeCssFiles="{
                0:'{f:uri.resource(extensionName:\'openid\', path:\'StyleSheets/Wizard.css\')}'
        }"
 >
-       <h1><f:translate key="LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:html.title" /></h1>
+       <h1><f:translate key="html.title" /></h1>
 
-       <p><f:translate key="LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:html.description" /></p>
+       <p><f:translate key="html.description" /></p>
 
        <f:if condition="{messages->f:count()} > 0">
                <f:for each="{messages}" as="message">
                        <input type="hidden" name="P[fieldChangeFunc][TBE_EDITOR_fieldChanged]" value="{parentFormFieldChangeFunc}"/>
 
                        <div class="form-group">
-                               <label for="openid_url"><f:translate key="LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:html.openid_url" /></label>
+                               <label for="openid_url"><f:translate key="html.openid_url" /></label>
                                <input type="text" name="openid_url" class="form-control" id="openid_url" value="{openid_url}"/>
 
                        </div>
-                       <button type="submit" class="btn btn-default" name="search" title="{f:translate(key:'LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:html.search')}">
-                               <i class="fa fa-openid"></i> {f:translate(key:'LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:html.submit')}
+                       <button type="submit" class="btn btn-default" name="search" title="{f:translate(key:'html.search')}">
+                               <i class="fa fa-openid"></i> {f:translate(key:'html.submit')}
                        </button>
                </form>
                </div>
index 3bb1d46..385dbde 100644 (file)
@@ -12,6 +12,6 @@
  * The TYPO3 project - inspiring people to share!
  */
 
-$module = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidEid::class);
 /* @var \TYPO3\CMS\Openid\OpenidEid $module */
+$module = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidEid::class);
 $module->main();
index bde3253..e371581 100644 (file)
@@ -20,6 +20,6 @@ require_once '../../init.php';
 \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
        'The entry point to the openid return window was moved to an own module. Please use BackendUtility::getModuleUrl(\'openid_return\') to link to class.tx_openid_return.php. This script will be removed in TYPO3 CMS 8.'
 );
-$module = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidReturn::class);
 /* @var \TYPO3\CMS\Openid\OpenidReturn $module */
+$module = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\OpenidReturn::class);
 $module->main();
index 402f4d7..8c00435 100644 (file)
@@ -42,5 +42,6 @@ defined('TYPO3_MODE') or die();
 // Register eID script that performs final FE user authentication. It will be called by the OpenID provider
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_openid'] = 'EXT:openid/class.tx_openid_eid.php';
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['setup']['accessLevelCheck'][\TYPO3\CMS\Openid\OpenidModuleSetup::class] = '';
+
 // Use popup window to refresh login instead of the AJAX relogin:
 $GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup'] = 1;
index 30a6ffd..abefc42 100644 (file)
@@ -13,7 +13,5 @@
  */
 define('TYPO3_MOD_PATH', 'sysext/openid/wizard/');
 
-$wizard = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-       \TYPO3\CMS\Openid\Wizard::class
-);
+$wizard = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\Wizard::class);
 $wizard->main();