]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4874 from tobiasd/20180420-lng
authorHypolite Petovan <mrpetovan@gmail.com>
Fri, 20 Apr 2018 11:57:13 +0000 (07:57 -0400)
committerGitHub <noreply@github.com>
Fri, 20 Apr 2018 11:57:13 +0000 (07:57 -0400)
IT, FI and ZH_CN translation updates

composer.json
composer.lock
src/Core/Console/NewPassword.php
src/Model/User.php

index 5cb33e67d604ebca8c87bcc3f621b246309ddab7..b7cd645bdb43d72580af2d8e0e31c2a98c3a344a 100644 (file)
@@ -25,6 +25,7 @@
                "paragonie/random_compat": "^2.0",
                "pear/Text_LanguageDetect": "1.*",
                "pear/Text_Highlighter": "dev-master",
+               "seld/cli-prompt": "^1.0",
                "smarty/smarty": "^3.1",
                "fxp/composer-asset-plugin": "~1.3",
                "bower-asset/base64": "^1.0",
index 34362cb1bbca845108dbbfb7b81598015db600ef..f294c16ef5f59a6274ea9c75e0f867fbaf61b4dd 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "96062c2020a40f14b52e5e91c79995a7",
+    "content-hash": "f97245142e60a521f048a667bec4e436",
     "packages": [
         {
             "name": "asika/simple-console",
             "description": "PSR-6 adapter for RW File Cache",
             "time": "2018-01-30T19:13:45+00:00"
         },
+        {
+            "name": "seld/cli-prompt",
+            "version": "1.0.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Seldaek/cli-prompt.git",
+                "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
+                "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Seld\\CliPrompt\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jordi Boggiano",
+                    "email": "j.boggiano@seld.be"
+                }
+            ],
+            "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type",
+            "keywords": [
+                "cli",
+                "console",
+                "hidden",
+                "input",
+                "prompt"
+            ],
+            "time": "2017-03-18T11:32:45+00:00"
+        },
         {
             "name": "smarty/smarty",
             "version": "v3.1.31",
index d44286d28f7cc21f82b3207a1ee4c47ca737a082..f5698ba716ff62b1cf0e3258c2155436ca208769 100644 (file)
@@ -27,7 +27,7 @@ class NewPassword extends \Asika\SimpleConsole\Console
                $help = <<<HELP
 console newpassword - Creates a new password for a given user
 Usage
-       bin/console newpassword <nickname> <password> [-h|--help|-?] [-v]
+       bin/console newpassword <nickname> [<password>] [-h|--help|-?] [-v]
 
 Description
        Creates a new password for a user without using the "forgot password" functionality.
@@ -67,13 +67,22 @@ HELP;
                }
 
                $nick = $this->getArgument(0);
-               $password = $this->getArgument(1);
 
                $user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
                if (!DBM::is_result($user)) {
                        throw new \RuntimeException(L10n::t('User not found'));
                }
 
+               $password = $this->getArgument(1);
+               if (is_null($password)) {
+                       $this->out(L10n::t('Enter new password: '), false);
+                       $password = \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
+               }
+
+               if (!$password) {
+                       throw new \RuntimeException(L10n::t('Password can\'t be empty'));
+               }
+
                if (!Config::get('system', 'disable_password_exposed', false) && User::isPasswordExposed($password)) {
                        throw new \RuntimeException(L10n::t('The new password has been exposed in a public data dump, please choose another.'));
                }
index 2621897f4eb87084a97040bba458d7c8f1078560..41d26ee19d66f4c27d3b3a885f086564d9e466c0 100644 (file)
@@ -258,6 +258,10 @@ class User
         */
        public static function hashPassword($password)
        {
+               if (!trim($password)) {
+                       throw new Exception(L10n::t('Password can\'t be empty'));
+               }
+
                return password_hash($password, PASSWORD_DEFAULT);
        }