{"action":"created","comment":{"url":"https://api.github.com/repos/andela/chopbox/pulls/comments/38909778","id":38909778,"diff_hunk":"@@ -11,115 +13,164 @@\n use Illuminate\\Support\\Facades\\Auth;\n \n class AuthController extends Controller {\n-\t/*\n-\t * |--------------------------------------------------------------------------\n-\t * | Registration & Login Controller\n-\t * |--------------------------------------------------------------------------\n-\t * |\n-\t * | This controller handles the registration of new users, as well as the\n-\t * | authentication of existing users. By default, this controller uses\n-\t * | a simple trait to add these behaviors. Why don't you explore it?\n-\t * |\n-\t */\n-\t\n-\tuse AuthenticatesAndRegistersUsers, ThrottlesLogins;\n-\tprotected $loginPath = '/login';\n-\tprotected $registerPath = '/register';\n-\tprotected $redirectPath = '/';\n-\t/**\n-\t * Create a new authentication controller instance.\n-\t *\n-\t * @return void\n-\t */\n-\tpublic function __construct() {\n-\t\t$this->middleware ( 'guest', [ \n-\t\t\t\t'except' => 'getLogout' \n-\t\t] );\n-\t}\n-\t\n-\t/**\n-\t * Authenticate users.\n-\t *\n-\t * @param array $request        \t\n-\t * @return User\n-\t */\n-\tpublic function doLogin(Request $request) {\n-\t\t\n-\t\t// If the class is using the ThrottlesLogins trait, we can automatically throttle\n-\t\t// the login attempts for this application. We'll key this by the username and\n-\t\t// the IP address of the client making these requests into this application.\n-\t\t$throttles = $this->isUsingThrottlesLoginsTrait ();\n-\t\t\n-\t\tif ($throttles && $this->hasTooManyLoginAttempts ( $request )) {\n-\t\t\treturn $this->sendLockoutResponse ( $request );\n-\t\t}\n-\t\t\n-\t\t$credentials = $this->getCredentials ( $request );\n-\t\t$field = (filter_var ( $credentials ['email'], FILTER_VALIDATE_EMAIL )) ? \"email\" : \"username\";\n-\t\tif (Auth::attempt ( [ \n-\t\t\t\t$field => $credentials ['email'],\n-\t\t\t\t'password' => $credentials ['password'],\n-\t\t\t\t'status' => TRUE \n-\t\t], $request->has ( 'remember' ) )) {\n-\t\t\treturn $this->handleUserWasAuthenticated ( $request, $throttles );\n-\t\t}\n-\t\t\n-\t\t// If the login attempt was unsuccessful we will increment the number of attempts\n-\t\t// to login and redirect the user back to the login form. Of course, when this\n-\t\t// user surpasses their maximum number of attempts they will get locked out.\n-\t\tif ($throttles) {\n-\t\t\t$this->incrementLoginAttempts ( $request );\n-\t\t}\n-\t\t\n-\t\treturn redirect ( $this->loginPath () )->withInput ( $request->only ( $this->loginUsername (), 'remember' ) )->withErrors ( [ \n-\t\t\t\t$this->loginUsername () => $this->getFailedLoginMessage () \n-\t\t] );\n-\t}\n-\t\n-\t/**\n-\t * Handle a registration request for the application.\n-\t *\n-\t * @param \\Illuminate\\Http\\Request $request        \t\n-\t * @return \\Illuminate\\Http\\Response\n-\t */\n-\tpublic function postRegister(Request $request) {\n-\t\t$validator = $this->validator ( $request->all () );\n-\t\t\n-\t\tif ($validator->fails ()) {\n-\t\t\treturn redirect ( $this->registerPath )->withErrors ( $validator );\n-\t\t}\n-\t\t\n-\t\tAuth::login ( $this->create ( $request->all () ) );\n-\t\treturn redirect ( $this->redirectPath () );\n-\t}\n-\t\n-\t/**\n-\t * Get a validator for an incoming registration request.\n-\t *\n-\t * @param array $data        \t\n-\t * @return \\Illuminate\\Contracts\\Validation\\Validator\n-\t */\n-\tprotected function validator(array $data) {\n-\t\treturn Validator::make ( $data, [ \n-\t\t\t\t'name' => 'required|max:255|unique:users,username|min:3',\n-\t\t\t\t'email' => 'required|email|max:255|unique:users',\n-\t\t\t\t'password' => 'required|confirmed|min:8' \n-\t\t] );\n-\t}\n-\t\n-\t/**\n-\t * Create a new user instance after a valid registration.\n-\t *\n-\t * @param array $data        \t\n-\t * @return User\n-\t */\n-\tprotected function create(array $data) {\n-\t\treturn User::create([\n-                'email' => $data['email'],\n-            \t\t  'username' => $data['name'],\n-                'password' => bcrypt($data['password']),\n-            \t\t'status' =>TRUE,\n-            \t\t'profile_state' => FALSE\n-            ]);\n-        }\n+  /*\n+   * |--------------------------------------------------------------------------\n+   * | Registration & Login Controller\n+   * |--------------------------------------------------------------------------\n+   * |\n+   * | This controller handles the registration of new users, as well as the\n+   * | authentication of existing users. By default, this controller uses\n+   * | a simple trait to add these behaviors. Why don't you explore it?\n+   * |\n+   */\n+  \n+  use AuthenticatesAndRegistersUsers, ThrottlesLogins;\n+  protected $loginPath = '/login';\n+  protected $registerPath = '/register';\n+  protected $redirectPath = '/';\n+\n+  /**\n+   * Create a new authentication controller instance.\n+   *\n+   * @return void\n+   */\n+  public function __construct() {\n+    $this->middleware('guest', [ \n+        'except' => 'getLogout' \n+    ]);\n+  }\n+\n+  public function socialLogin(SocialAuthenticateUser $authenticateUser, Request $request, $provider = null) {\n+    $social_providders = array (\n+        \"facebook\",\n+        \"google\" \n+    );","path":"app/Http/Controllers/Auth/AuthController.php","position":155,"original_position":155,"commit_id":"5ea667921e212db5c07ae43d85d49e0f68bdf41f","original_commit_id":"5ea667921e212db5c07ae43d85d49e0f68bdf41f","user":{"login":"busayo","id":2946769,"avatar_url":"https://avatars.githubusercontent.com/u/2946769?v=3","gravatar_id":"","url":"https://api.github.com/users/busayo","html_url":"https://github.com/busayo","followers_url":"https://api.github.com/users/busayo/followers","following_url":"https://api.github.com/users/busayo/following{/other_user}","gists_url":"https://api.github.com/users/busayo/gists{/gist_id}","starred_url":"https://api.github.com/users/busayo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/busayo/subscriptions","organizations_url":"https://api.github.com/users/busayo/orgs","repos_url":"https://api.github.com/users/busayo/repos","events_url":"https://api.github.com/users/busayo/events{/privacy}","received_events_url":"https://api.github.com/users/busayo/received_events","type":"User","site_admin":false},"body":"Give a space between line 47 and 48","created_at":"2015-09-08T10:14:14Z","updated_at":"2015-09-08T10:14:14Z","html_url":"https://github.com/andela/chopbox/pull/49#discussion_r38909778","pull_request_url":"https://api.github.com/repos/andela/chopbox/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/andela/chopbox/pulls/comments/38909778"},"html":{"href":"https://github.com/andela/chopbox/pull/49#discussion_r38909778"},"pull_request":{"href":"https://api.github.com/repos/andela/chopbox/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/andela/chopbox/pulls/49","id":43980391,"html_url":"https://github.com/andela/chopbox/pull/49","diff_url":"https://github.com/andela/chopbox/pull/49.diff","patch_url":"https://github.com/andela/chopbox/pull/49.patch","issue_url":"https://api.github.com/repos/andela/chopbox/issues/49","number":49,"state":"open","locked":false,"title":"Feature/auth completion","user":{"login":"andela-cijeomah","id":12733001,"avatar_url":"https://avatars.githubusercontent.com/u/12733001?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cijeomah","html_url":"https://github.com/andela-cijeomah","followers_url":"https://api.github.com/users/andela-cijeomah/followers","following_url":"https://api.github.com/users/andela-cijeomah/following{/other_user}","gists_url":"https://api.github.com/users/andela-cijeomah/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cijeomah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cijeomah/subscriptions","organizations_url":"https://api.github.com/users/andela-cijeomah/orgs","repos_url":"https://api.github.com/users/andela-cijeomah/repos","events_url":"https://api.github.com/users/andela-cijeomah/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cijeomah/received_events","type":"User","site_admin":false},"body":"Completed user registration","created_at":"2015-09-02T11:23:48Z","updated_at":"2015-09-08T10:14:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48258a0c44b89bd015664c2f59c3deb379c7b7ef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela/chopbox/pulls/49/commits","review_comments_url":"https://api.github.com/repos/andela/chopbox/pulls/49/comments","review_comment_url":"https://api.github.com/repos/andela/chopbox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/chopbox/issues/49/comments","statuses_url":"https://api.github.com/repos/andela/chopbox/statuses/5ea667921e212db5c07ae43d85d49e0f68bdf41f","head":{"label":"andela:feature/auth-completion","ref":"feature/auth-completion","sha":"5ea667921e212db5c07ae43d85d49e0f68bdf41f","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":39066259,"name":"chopbox","full_name":"andela/chopbox","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/chopbox","description":"Twitter Clone for Food Consumption and Expression - Simulation Project ","fork":false,"url":"https://api.github.com/repos/andela/chopbox","forks_url":"https://api.github.com/repos/andela/chopbox/forks","keys_url":"https://api.github.com/repos/andela/chopbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/chopbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/chopbox/teams","hooks_url":"https://api.github.com/repos/andela/chopbox/hooks","issue_events_url":"https://api.github.com/repos/andela/chopbox/issues/events{/number}","events_url":"https://api.github.com/repos/andela/chopbox/events","assignees_url":"https://api.github.com/repos/andela/chopbox/assignees{/user}","branches_url":"https://api.github.com/repos/andela/chopbox/branches{/branch}","tags_url":"https://api.github.com/repos/andela/chopbox/tags","blobs_url":"https://api.github.com/repos/andela/chopbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/chopbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/chopbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/chopbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/chopbox/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/chopbox/languages","stargazers_url":"https://api.github.com/repos/andela/chopbox/stargazers","contributors_url":"https://api.github.com/repos/andela/chopbox/contributors","subscribers_url":"https://api.github.com/repos/andela/chopbox/subscribers","subscription_url":"https://api.github.com/repos/andela/chopbox/subscription","commits_url":"https://api.github.com/repos/andela/chopbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/chopbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/chopbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/chopbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/chopbox/contents/{+path}","compare_url":"https://api.github.com/repos/andela/chopbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/chopbox/merges","archive_url":"https://api.github.com/repos/andela/chopbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/chopbox/downloads","issues_url":"https://api.github.com/repos/andela/chopbox/issues{/number}","pulls_url":"https://api.github.com/repos/andela/chopbox/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/chopbox/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/chopbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/chopbox/labels{/name}","releases_url":"https://api.github.com/repos/andela/chopbox/releases{/id}","created_at":"2015-07-14T09:32:37Z","updated_at":"2015-08-24T10:49:25Z","pushed_at":"2015-09-08T09:55:30Z","git_url":"git://github.com/andela/chopbox.git","ssh_url":"git@github.com:andela/chopbox.git","clone_url":"https://github.com/andela/chopbox.git","svn_url":"https://github.com/andela/chopbox","homepage":"http://chopbox-staging.herokuapp.com/","size":7451,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"andela:staging","ref":"staging","sha":"bcf9a8db4c8cd0c61dde60f36bc50cb0e46d65a8","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":39066259,"name":"chopbox","full_name":"andela/chopbox","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/chopbox","description":"Twitter Clone for Food Consumption and Expression - Simulation Project ","fork":false,"url":"https://api.github.com/repos/andela/chopbox","forks_url":"https://api.github.com/repos/andela/chopbox/forks","keys_url":"https://api.github.com/repos/andela/chopbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/chopbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/chopbox/teams","hooks_url":"https://api.github.com/repos/andela/chopbox/hooks","issue_events_url":"https://api.github.com/repos/andela/chopbox/issues/events{/number}","events_url":"https://api.github.com/repos/andela/chopbox/events","assignees_url":"https://api.github.com/repos/andela/chopbox/assignees{/user}","branches_url":"https://api.github.com/repos/andela/chopbox/branches{/branch}","tags_url":"https://api.github.com/repos/andela/chopbox/tags","blobs_url":"https://api.github.com/repos/andela/chopbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/chopbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/chopbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/chopbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/chopbox/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/chopbox/languages","stargazers_url":"https://api.github.com/repos/andela/chopbox/stargazers","contributors_url":"https://api.github.com/repos/andela/chopbox/contributors","subscribers_url":"https://api.github.com/repos/andela/chopbox/subscribers","subscription_url":"https://api.github.com/repos/andela/chopbox/subscription","commits_url":"https://api.github.com/repos/andela/chopbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/chopbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/chopbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/chopbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/chopbox/contents/{+path}","compare_url":"https://api.github.com/repos/andela/chopbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/chopbox/merges","archive_url":"https://api.github.com/repos/andela/chopbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/chopbox/downloads","issues_url":"https://api.github.com/repos/andela/chopbox/issues{/number}","pulls_url":"https://api.github.com/repos/andela/chopbox/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/chopbox/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/chopbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/chopbox/labels{/name}","releases_url":"https://api.github.com/repos/andela/chopbox/releases{/id}","created_at":"2015-07-14T09:32:37Z","updated_at":"2015-08-24T10:49:25Z","pushed_at":"2015-09-08T09:55:30Z","git_url":"git://github.com/andela/chopbox.git","ssh_url":"git@github.com:andela/chopbox.git","clone_url":"https://github.com/andela/chopbox.git","svn_url":"https://github.com/andela/chopbox","homepage":"http://chopbox-staging.herokuapp.com/","size":7451,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/chopbox/pulls/49"},"html":{"href":"https://github.com/andela/chopbox/pull/49"},"issue":{"href":"https://api.github.com/repos/andela/chopbox/issues/49"},"comments":{"href":"https://api.github.com/repos/andela/chopbox/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/chopbox/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/chopbox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/chopbox/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/andela/chopbox/statuses/5ea667921e212db5c07ae43d85d49e0f68bdf41f"}}}}