]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Security/Login.php
Merge pull request #10166 from mexon/mat/refactor-user-arguments
[friendica.git] / src / Module / Security / Login.php
index a52a38f6824acb32d9e297264171358cefc98dd5..9f5095452e5dbdd83342e4b769f0215c3d562fc9 100644 (file)
@@ -1,15 +1,28 @@
 <?php
-
 /**
- * @file src/Module/Login.php
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
 
 namespace Friendica\Module\Security;
 
 use Friendica\BaseModule;
-use Friendica\Core\Config;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\Session;
 use Friendica\DI;
@@ -18,8 +31,6 @@ use Friendica\Util\Strings;
 
 /**
  * Login module
- *
- * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
 class Login extends BaseModule
 {
@@ -29,7 +40,7 @@ class Login extends BaseModule
                        DI::baseUrl()->redirect();
                }
 
-               return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
+               return self::form(Session::get('return_path'), intval(DI::config()->get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
        }
 
        public static function post(array $parameters = [])
@@ -60,7 +71,7 @@ class Login extends BaseModule
        }
 
        /**
-        * @brief Wrapper for adding a login box.
+        * Wrapper for adding a login box.
         *
         * @param string $return_path  The path relative to the base the user should be sent
         *                             back to after login completes
@@ -77,7 +88,7 @@ class Login extends BaseModule
        {
                $o = '';
 
-               $noid = Config::get('system', 'no_openid');
+               $noid = DI::config()->get('system', 'no_openid');
 
                if ($noid) {
                        Session::remove('openid_identity');
@@ -87,8 +98,8 @@ class Login extends BaseModule
                $reg = false;
                if ($register && intval(DI::config()->get('config', 'register_policy')) !== Register::CLOSED) {
                        $reg = [
-                               'title' => L10n::t('Create a New Account'),
-                               'desc' => L10n::t('Register'),
+                               'title' => DI::l10n()->t('Create a New Account'),
+                               'desc' => DI::l10n()->t('Register'),
                                'url' => self::getRegisterURL()
                        ];
                }
@@ -112,12 +123,12 @@ class Login extends BaseModule
                }
 
                if (!empty(Session::get('openid_identity'))) {
-                       $openid_title = L10n::t('Your OpenID: ');
+                       $openid_title = DI::l10n()->t('Your OpenID: ');
                        $openid_readonly = true;
                        $identity = Session::get('openid_identity');
-                       $username_desc = L10n::t('Please enter your username and password to add the OpenID to your existing account.');
+                       $username_desc = DI::l10n()->t('Please enter your username and password to add the OpenID to your existing account.');
                } else {
-                       $openid_title = L10n::t('Or login using OpenID: ');
+                       $openid_title = DI::l10n()->t('Or login using OpenID: ');
                        $openid_readonly = false;
                        $identity = '';
                        $username_desc = '';
@@ -127,12 +138,12 @@ class Login extends BaseModule
                        $tpl,
                        [
                                '$dest_url'     => DI::baseUrl()->get(true) . '/login',
-                               '$logout'       => L10n::t('Logout'),
-                               '$login'        => L10n::t('Login'),
+                               '$logout'       => DI::l10n()->t('Logout'),
+                               '$login'        => DI::l10n()->t('Login'),
 
-                               '$lname'        => ['username', L10n::t('Nickname or Email: '), '', $username_desc],
-                               '$lpassword'    => ['password', L10n::t('Password: '), '', ''],
-                               '$lremember'    => ['remember', L10n::t('Remember me'), 0,  ''],
+                               '$lname'        => ['username', DI::l10n()->t('Nickname or Email: '), '', $username_desc],
+                               '$lpassword'    => ['password', DI::l10n()->t('Password: '), '', ''],
+                               '$lremember'    => ['remember', DI::l10n()->t('Remember me'), 0,  ''],
 
                                '$openid'       => !$noid,
                                '$lopenid'      => ['openid_url', $openid_title, $identity, '', $openid_readonly],
@@ -141,14 +152,14 @@ class Login extends BaseModule
 
                                '$register'     => $reg,
 
-                               '$lostpass'     => L10n::t('Forgot your password?'),
-                               '$lostlink'     => L10n::t('Password Reset'),
+                               '$lostpass'     => DI::l10n()->t('Forgot your password?'),
+                               '$lostlink'     => DI::l10n()->t('Password Reset'),
 
-                               '$tostitle'     => L10n::t('Website Terms of Service'),
-                               '$toslink'      => L10n::t('terms of service'),
+                               '$tostitle'     => DI::l10n()->t('Website Terms of Service'),
+                               '$toslink'      => DI::l10n()->t('terms of service'),
 
-                               '$privacytitle' => L10n::t('Website Privacy Policy'),
-                               '$privacylink'  => L10n::t('privacy policy'),
+                               '$privacytitle' => DI::l10n()->t('Website Privacy Policy'),
+                               '$privacylink'  => DI::l10n()->t('privacy policy'),
                        ]
                );