{"action":"created","comment":{"url":"https://api.github.com/repos/tempo-project/tempo/pulls/comments/27729115","id":27729115,"diff_hunk":"@@ -11,65 +11,62 @@\n \n namespace Tempo\\Bundle\\AppBundle\\Controller;\n \n+use Doctrine\\Common\\Util\\Debug;\n use Symfony\\Component\\HttpFoundation\\Request;\n use Tempo\\Bundle\\AppBundle\\Form\\Type\\ResettingFormType;\n+use Tempo\\Bundle\\AppBundle\\Manager\\UserManager;\n+use Tempo\\Bundle\\AppBundle\\Model\\UserInterface;\n \n class ResettingController extends Controller\n {\n-    /**\n-     * Request reset user password: show form\n-     */\n-    public function requestAction()\n+    public function resetAction(Request $request)\n     {\n-        $error = '';\n-        return $this->render('TempoAppBundle:Resetting:request.html.twig', array(\n-            'error'         => $error\n-        ));\n-    }\n+        if ($request->isMethod('POST') && $username = $request->request->get('username')) {\n+            /** @var UserManager $userManager */\n+            $userManager = $this->getManager('user');\n+\n+            $user = $userManager->findUserByUsernameOrEmail($username);\n+            if (!$user) {\n+                return $this->render('TempoAppBundle:Resetting:reset.html.twig', array(\n+                    'error' => $username\n+                ));\n+            }\n+\n+            if ($user->isPasswordRequestNonExpired(60*60*24)) {\n+                $this->addFlash('normal', 'tempo.security.resetting.request_non_expired');\n+            }\n+\n+            if (!$user->getConfirmationToken()) {\n+                $user->setConfirmationToken($user->generateToken());\n+                $user->setPasswordRequestedAt(new \\DateTime('now', new \\DateTimeZone('UTC')));\n+                $userManager->save($user);","path":"src/Tempo/Bundle/AppBundle/Controller/ResettingController.php","position":41,"original_position":41,"commit_id":"2d60cb48b44c7474716d35a6b36be9aeec206198","original_commit_id":"2d60cb48b44c7474716d35a6b36be9aeec206198","user":{"login":"Shine-neko","id":884441,"avatar_url":"https://avatars.githubusercontent.com/u/884441?v=3","gravatar_id":"","url":"https://api.github.com/users/Shine-neko","html_url":"https://github.com/Shine-neko","followers_url":"https://api.github.com/users/Shine-neko/followers","following_url":"https://api.github.com/users/Shine-neko/following{/other_user}","gists_url":"https://api.github.com/users/Shine-neko/gists{/gist_id}","starred_url":"https://api.github.com/users/Shine-neko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shine-neko/subscriptions","organizations_url":"https://api.github.com/users/Shine-neko/orgs","repos_url":"https://api.github.com/users/Shine-neko/repos","events_url":"https://api.github.com/users/Shine-neko/events{/privacy}","received_events_url":"https://api.github.com/users/Shine-neko/received_events","type":"User","site_admin":false},"body":"use DomainManager and send event.","created_at":"2015-04-03T13:30:47Z","updated_at":"2015-04-03T13:30:47Z","html_url":"https://github.com/tempo-project/tempo/pull/78#discussion_r27729115","pull_request_url":"https://api.github.com/repos/tempo-project/tempo/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/tempo-project/tempo/pulls/comments/27729115"},"html":{"href":"https://github.com/tempo-project/tempo/pull/78#discussion_r27729115"},"pull_request":{"href":"https://api.github.com/repos/tempo-project/tempo/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/tempo-project/tempo/pulls/78","id":32588612,"html_url":"https://github.com/tempo-project/tempo/pull/78","diff_url":"https://github.com/tempo-project/tempo/pull/78.diff","patch_url":"https://github.com/tempo-project/tempo/pull/78.patch","issue_url":"https://api.github.com/repos/tempo-project/tempo/issues/78","number":78,"state":"open","locked":false,"title":"[WIP] User password management","user":{"login":"amenophis","id":2158235,"avatar_url":"https://avatars.githubusercontent.com/u/2158235?v=3","gravatar_id":"","url":"https://api.github.com/users/amenophis","html_url":"https://github.com/amenophis","followers_url":"https://api.github.com/users/amenophis/followers","following_url":"https://api.github.com/users/amenophis/following{/other_user}","gists_url":"https://api.github.com/users/amenophis/gists{/gist_id}","starred_url":"https://api.github.com/users/amenophis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amenophis/subscriptions","organizations_url":"https://api.github.com/users/amenophis/orgs","repos_url":"https://api.github.com/users/amenophis/repos","events_url":"https://api.github.com/users/amenophis/events{/privacy}","received_events_url":"https://api.github.com/users/amenophis/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-03T13:27:31Z","updated_at":"2015-04-03T13:30:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe922fccec8a032b98b1866362df0d10dbf4f528","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tempo-project/tempo/pulls/78/commits","review_comments_url":"https://api.github.com/repos/tempo-project/tempo/pulls/78/comments","review_comment_url":"https://api.github.com/repos/tempo-project/tempo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tempo-project/tempo/issues/78/comments","statuses_url":"https://api.github.com/repos/tempo-project/tempo/statuses/2d60cb48b44c7474716d35a6b36be9aeec206198","head":{"label":"tempo-project:forgot-password","ref":"forgot-password","sha":"2d60cb48b44c7474716d35a6b36be9aeec206198","user":{"login":"tempo-project","id":1522102,"avatar_url":"https://avatars.githubusercontent.com/u/1522102?v=3","gravatar_id":"","url":"https://api.github.com/users/tempo-project","html_url":"https://github.com/tempo-project","followers_url":"https://api.github.com/users/tempo-project/followers","following_url":"https://api.github.com/users/tempo-project/following{/other_user}","gists_url":"https://api.github.com/users/tempo-project/gists{/gist_id}","starred_url":"https://api.github.com/users/tempo-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tempo-project/subscriptions","organizations_url":"https://api.github.com/users/tempo-project/orgs","repos_url":"https://api.github.com/users/tempo-project/repos","events_url":"https://api.github.com/users/tempo-project/events{/privacy}","received_events_url":"https://api.github.com/users/tempo-project/received_events","type":"Organization","site_admin":false},"repo":{"id":4233459,"name":"tempo","full_name":"tempo-project/tempo","owner":{"login":"tempo-project","id":1522102,"avatar_url":"https://avatars.githubusercontent.com/u/1522102?v=3","gravatar_id":"","url":"https://api.github.com/users/tempo-project","html_url":"https://github.com/tempo-project","followers_url":"https://api.github.com/users/tempo-project/followers","following_url":"https://api.github.com/users/tempo-project/following{/other_user}","gists_url":"https://api.github.com/users/tempo-project/gists{/gist_id}","starred_url":"https://api.github.com/users/tempo-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tempo-project/subscriptions","organizations_url":"https://api.github.com/users/tempo-project/orgs","repos_url":"https://api.github.com/users/tempo-project/repos","events_url":"https://api.github.com/users/tempo-project/events{/privacy}","received_events_url":"https://api.github.com/users/tempo-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tempo-project/tempo","description":"Tempo - Modern Project Management Software","fork":false,"url":"https://api.github.com/repos/tempo-project/tempo","forks_url":"https://api.github.com/repos/tempo-project/tempo/forks","keys_url":"https://api.github.com/repos/tempo-project/tempo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tempo-project/tempo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tempo-project/tempo/teams","hooks_url":"https://api.github.com/repos/tempo-project/tempo/hooks","issue_events_url":"https://api.github.com/repos/tempo-project/tempo/issues/events{/number}","events_url":"https://api.github.com/repos/tempo-project/tempo/events","assignees_url":"https://api.github.com/repos/tempo-project/tempo/assignees{/user}","branches_url":"https://api.github.com/repos/tempo-project/tempo/branches{/branch}","tags_url":"https://api.github.com/repos/tempo-project/tempo/tags","blobs_url":"https://api.github.com/repos/tempo-project/tempo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tempo-project/tempo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tempo-project/tempo/git/refs{/sha}","trees_url":"https://api.github.com/repos/tempo-project/tempo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tempo-project/tempo/statuses/{sha}","languages_url":"https://api.github.com/repos/tempo-project/tempo/languages","stargazers_url":"https://api.github.com/repos/tempo-project/tempo/stargazers","contributors_url":"https://api.github.com/repos/tempo-project/tempo/contributors","subscribers_url":"https://api.github.com/repos/tempo-project/tempo/subscribers","subscription_url":"https://api.github.com/repos/tempo-project/tempo/subscription","commits_url":"https://api.github.com/repos/tempo-project/tempo/commits{/sha}","git_commits_url":"https://api.github.com/repos/tempo-project/tempo/git/commits{/sha}","comments_url":"https://api.github.com/repos/tempo-project/tempo/comments{/number}","issue_comment_url":"https://api.github.com/repos/tempo-project/tempo/issues/comments{/number}","contents_url":"https://api.github.com/repos/tempo-project/tempo/contents/{+path}","compare_url":"https://api.github.com/repos/tempo-project/tempo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tempo-project/tempo/merges","archive_url":"https://api.github.com/repos/tempo-project/tempo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tempo-project/tempo/downloads","issues_url":"https://api.github.com/repos/tempo-project/tempo/issues{/number}","pulls_url":"https://api.github.com/repos/tempo-project/tempo/pulls{/number}","milestones_url":"https://api.github.com/repos/tempo-project/tempo/milestones{/number}","notifications_url":"https://api.github.com/repos/tempo-project/tempo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tempo-project/tempo/labels{/name}","releases_url":"https://api.github.com/repos/tempo-project/tempo/releases{/id}","created_at":"2012-05-05T11:57:40Z","updated_at":"2015-04-03T12:01:00Z","pushed_at":"2015-04-03T13:27:31Z","git_url":"git://github.com/tempo-project/tempo.git","ssh_url":"git@github.com:tempo-project/tempo.git","clone_url":"https://github.com/tempo-project/tempo.git","svn_url":"https://github.com/tempo-project/tempo","homepage":"http://demo.tempo-project.org","size":5329,"stargazers_count":18,"watchers_count":18,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":18,"default_branch":"master"}},"base":{"label":"tempo-project:master","ref":"master","sha":"b8bd60cbb29967e78b47d0592e8d5209839aee17","user":{"login":"tempo-project","id":1522102,"avatar_url":"https://avatars.githubusercontent.com/u/1522102?v=3","gravatar_id":"","url":"https://api.github.com/users/tempo-project","html_url":"https://github.com/tempo-project","followers_url":"https://api.github.com/users/tempo-project/followers","following_url":"https://api.github.com/users/tempo-project/following{/other_user}","gists_url":"https://api.github.com/users/tempo-project/gists{/gist_id}","starred_url":"https://api.github.com/users/tempo-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tempo-project/subscriptions","organizations_url":"https://api.github.com/users/tempo-project/orgs","repos_url":"https://api.github.com/users/tempo-project/repos","events_url":"https://api.github.com/users/tempo-project/events{/privacy}","received_events_url":"https://api.github.com/users/tempo-project/received_events","type":"Organization","site_admin":false},"repo":{"id":4233459,"name":"tempo","full_name":"tempo-project/tempo","owner":{"login":"tempo-project","id":1522102,"avatar_url":"https://avatars.githubusercontent.com/u/1522102?v=3","gravatar_id":"","url":"https://api.github.com/users/tempo-project","html_url":"https://github.com/tempo-project","followers_url":"https://api.github.com/users/tempo-project/followers","following_url":"https://api.github.com/users/tempo-project/following{/other_user}","gists_url":"https://api.github.com/users/tempo-project/gists{/gist_id}","starred_url":"https://api.github.com/users/tempo-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tempo-project/subscriptions","organizations_url":"https://api.github.com/users/tempo-project/orgs","repos_url":"https://api.github.com/users/tempo-project/repos","events_url":"https://api.github.com/users/tempo-project/events{/privacy}","received_events_url":"https://api.github.com/users/tempo-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tempo-project/tempo","description":"Tempo - Modern Project Management Software","fork":false,"url":"https://api.github.com/repos/tempo-project/tempo","forks_url":"https://api.github.com/repos/tempo-project/tempo/forks","keys_url":"https://api.github.com/repos/tempo-project/tempo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tempo-project/tempo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tempo-project/tempo/teams","hooks_url":"https://api.github.com/repos/tempo-project/tempo/hooks","issue_events_url":"https://api.github.com/repos/tempo-project/tempo/issues/events{/number}","events_url":"https://api.github.com/repos/tempo-project/tempo/events","assignees_url":"https://api.github.com/repos/tempo-project/tempo/assignees{/user}","branches_url":"https://api.github.com/repos/tempo-project/tempo/branches{/branch}","tags_url":"https://api.github.com/repos/tempo-project/tempo/tags","blobs_url":"https://api.github.com/repos/tempo-project/tempo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tempo-project/tempo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tempo-project/tempo/git/refs{/sha}","trees_url":"https://api.github.com/repos/tempo-project/tempo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tempo-project/tempo/statuses/{sha}","languages_url":"https://api.github.com/repos/tempo-project/tempo/languages","stargazers_url":"https://api.github.com/repos/tempo-project/tempo/stargazers","contributors_url":"https://api.github.com/repos/tempo-project/tempo/contributors","subscribers_url":"https://api.github.com/repos/tempo-project/tempo/subscribers","subscription_url":"https://api.github.com/repos/tempo-project/tempo/subscription","commits_url":"https://api.github.com/repos/tempo-project/tempo/commits{/sha}","git_commits_url":"https://api.github.com/repos/tempo-project/tempo/git/commits{/sha}","comments_url":"https://api.github.com/repos/tempo-project/tempo/comments{/number}","issue_comment_url":"https://api.github.com/repos/tempo-project/tempo/issues/comments{/number}","contents_url":"https://api.github.com/repos/tempo-project/tempo/contents/{+path}","compare_url":"https://api.github.com/repos/tempo-project/tempo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tempo-project/tempo/merges","archive_url":"https://api.github.com/repos/tempo-project/tempo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tempo-project/tempo/downloads","issues_url":"https://api.github.com/repos/tempo-project/tempo/issues{/number}","pulls_url":"https://api.github.com/repos/tempo-project/tempo/pulls{/number}","milestones_url":"https://api.github.com/repos/tempo-project/tempo/milestones{/number}","notifications_url":"https://api.github.com/repos/tempo-project/tempo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tempo-project/tempo/labels{/name}","releases_url":"https://api.github.com/repos/tempo-project/tempo/releases{/id}","created_at":"2012-05-05T11:57:40Z","updated_at":"2015-04-03T12:01:00Z","pushed_at":"2015-04-03T13:27:31Z","git_url":"git://github.com/tempo-project/tempo.git","ssh_url":"git@github.com:tempo-project/tempo.git","clone_url":"https://github.com/tempo-project/tempo.git","svn_url":"https://github.com/tempo-project/tempo","homepage":"http://demo.tempo-project.org","size":5329,"stargazers_count":18,"watchers_count":18,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tempo-project/tempo/pulls/78"},"html":{"href":"https://github.com/tempo-project/tempo/pull/78"},"issue":{"href":"https://api.github.com/repos/tempo-project/tempo/issues/78"},"comments":{"href":"https://api.github.com/repos/tempo-project/tempo/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/tempo-project/tempo/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/tempo-project/tempo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tempo-project/tempo/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/tempo-project/tempo/statuses/2d60cb48b44c7474716d35a6b36be9aeec206198"}}}}