{"action":"created","issue":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1388","labels_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1388/labels{/name}","comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1388/comments","events_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1388/events","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1388","id":103891177,"number":1388,"title":"EZP-24744 - Increase password security","user":{"login":"pedroresende","id":951377,"avatar_url":"https://avatars.githubusercontent.com/u/951377?v=3","gravatar_id":"","url":"https://api.github.com/users/pedroresende","html_url":"https://github.com/pedroresende","followers_url":"https://api.github.com/users/pedroresende/followers","following_url":"https://api.github.com/users/pedroresende/following{/other_user}","gists_url":"https://api.github.com/users/pedroresende/gists{/gist_id}","starred_url":"https://api.github.com/users/pedroresende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedroresende/subscriptions","organizations_url":"https://api.github.com/users/pedroresende/orgs","repos_url":"https://api.github.com/users/pedroresende/repos","events_url":"https://api.github.com/users/pedroresende/events{/privacy}","received_events_url":"https://api.github.com/users/pedroresende/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-30T00:23:08Z","updated_at":"2015-08-30T12:36:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1388","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1388","diff_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1388.diff","patch_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1388.patch"},"body":"## EZP-24744 - Increase password security\r\n\r\nCurrently eZ Publish is only using plain text or MD5 for password hash, this improvement implements the usage of BCRYPT to improve the security of the stored passwords"},"comment":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/comments/136132463","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1388#issuecomment-136132463","issue_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1388","id":136132463,"user":{"login":"ezrobot","id":681611,"avatar_url":"https://avatars.githubusercontent.com/u/681611?v=3","gravatar_id":"","url":"https://api.github.com/users/ezrobot","html_url":"https://github.com/ezrobot","followers_url":"https://api.github.com/users/ezrobot/followers","following_url":"https://api.github.com/users/ezrobot/following{/other_user}","gists_url":"https://api.github.com/users/ezrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/ezrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezrobot/subscriptions","organizations_url":"https://api.github.com/users/ezrobot/orgs","repos_url":"https://api.github.com/users/ezrobot/repos","events_url":"https://api.github.com/users/ezrobot/events{/privacy}","received_events_url":"https://api.github.com/users/ezrobot/received_events","type":"User","site_admin":false},"created_at":"2015-08-30T12:36:54Z","updated_at":"2015-08-30T12:36:54Z","body":"This Pull Request does not respect [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/), please, see the suggested diff below:\n\n```diff\nLoaded config from \"/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs\"\n.F\nLegend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error\n   1) eZ/Publish/Core/Repository/UserService.php (phpdoc_scalar, phpdoc_short_description, return, braces)\n      ---------- begin diff ----------\n      --- Original\n      +++ New\n      @@ @@\n       \n      -        if (!$this->verifyPassword($login, $password))\n      +        if (!$this->verifyPassword($login, $password)) {\n                   throw new NotFoundException('user', $login);\n      +        }\n      \n      @@ @@\n           /**\n      -     * Verifies if the provided login and password are valid\n      +     * Verifies if the provided login and password are valid.\n            * \n            * @param string $login User login\n            * @param string $password User password\n            * \n      -     * @return boolean return true if the login and password as sucessfully\n      +     * @return bool return true if the login and password as sucessfully\n      \n      @@ @@\n               }\n      +\n               return false;\n           }\n       \n           /**\n            * Returns password hash based on user data and site settings.\n            *\n            * @param string $login User login\n            * @param string $password User password\n            * @param string $site The name of the site\n            * @param int $type Type of password to generate\n            *\n            * @return string Generated password hash\n            */\n           protected function createPasswordHash($login, $password, $site, $type)\n           {\n               switch ($type) {\n                   case User::PASSWORD_HASH_MD5_PASSWORD:\n                       return md5($password);\n       \n                   case User::PASSWORD_HASH_MD5_USER:\n                       return md5(\"$login\\n$password\");\n       \n                   case User::PASSWORD_HASH_MD5_SITE:\n                       return md5(\"$login\\n$password\\n$site\");\n       \n                   case User::PASSWORD_HASH_PLAINTEXT:\n                       return $password;\n       \n                   case User::PASSWORD_BCRYPT:\n                       return password_hash($password, PASSWORD_BCRYPT);\n       \n                   default:\n                       return md5($password);\n               }\n           }\n       \n           /**\n            * Instantiates a correct sort clause object based on provided location sort field and sort order.\n            *\n            * @param int $sortField\n            * @param int $sortOrder\n            *\n            * @return \\eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\SortClause\n            */\n           protected function getSortClauseBySortField($sortField, $sortOrder = Location::SORT_ORDER_ASC)\n           {\n               $sortOrder = $sortOrder == Location::SORT_ORDER_DESC ? LocationQuery::SORT_DESC : LocationQuery::SORT_ASC;\n               switch ($sortField) {\n                   case Location::SORT_FIELD_PATH:\n                       return new SortClause\\Location\\Path($sortOrder);\n       \n                   case Location::SORT_FIELD_PUBLISHED:\n                       return new SortClause\\DatePublished($sortOrder);\n       \n                   case Location::SORT_FIELD_MODIFIED:\n                       return new SortClause\\DateModified($sortOrder);\n       \n                   case Location::SORT_FIELD_SECTION:\n                       return new SortClause\\SectionIdentifier($sortOrder);\n       \n                   case Location::SORT_FIELD_DEPTH:\n                       return new SortClause\\Location\\Depth($sortOrder);\n       \n                   //@todo: enable\n                   // case APILocation::SORT_FIELD_CLASS_IDENTIFIER:\n       \n                   //@todo: enable\n                   // case APILocation::SORT_FIELD_CLASS_NAME:\n       \n                   case Location::SORT_FIELD_PRIORITY:\n                       return new SortClause\\Location\\Priority($sortOrder);\n       \n                   case Location::SORT_FIELD_NAME:\n                       return new SortClause\\ContentName($sortOrder);\n       \n                   //@todo: enable\n                   // case APILocation::SORT_FIELD_MODIFIED_SUBNODE:\n       \n                   //@todo: enable\n                   // case APILocation::SORT_FIELD_NODE_ID:\n       \n                   //@todo: enable\n                   // case APILocation::SORT_FIELD_CONTENTOBJECT_ID:\n       \n                   default:\n                       return new SortClause\\Location\\Path($sortOrder);\n               }\n           }\n       }\n       \n      \n      ---------- end diff ----------\n\nFixed all files in 16.095 seconds, 14.250 MB memory used\n```\n"}}