{"action":"created","issue":{"url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1117","labels_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1117/labels{/name}","comments_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1117/comments","events_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1117/events","html_url":"https://github.com/duckduckgo/community-platform/pull/1117","id":121083290,"number":1117,"title":"Login with Github","user":{"login":"jbarrett","id":444449,"avatar_url":"https://avatars.githubusercontent.com/u/444449?v=3","gravatar_id":"","url":"https://api.github.com/users/jbarrett","html_url":"https://github.com/jbarrett","followers_url":"https://api.github.com/users/jbarrett/followers","following_url":"https://api.github.com/users/jbarrett/following{/other_user}","gists_url":"https://api.github.com/users/jbarrett/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarrett/subscriptions","organizations_url":"https://api.github.com/users/jbarrett/orgs","repos_url":"https://api.github.com/users/jbarrett/repos","events_url":"https://api.github.com/users/jbarrett/events{/privacy}","received_events_url":"https://api.github.com/users/jbarrett/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/duckduckgo/community-platform/labels/Improvement","name":"Improvement","color":"fbca04"},{"url":"https://api.github.com/repos/duckduckgo/community-platform/labels/Priority:%20High","name":"Priority: High","color":"eb6420"},{"url":"https://api.github.com/repos/duckduckgo/community-platform/labels/WIP","name":"WIP","color":"fef2c0"}],"state":"open","locked":false,"assignee":{"login":"MariagraziaAlastra","id":3652195,"avatar_url":"https://avatars.githubusercontent.com/u/3652195?v=3","gravatar_id":"","url":"https://api.github.com/users/MariagraziaAlastra","html_url":"https://github.com/MariagraziaAlastra","followers_url":"https://api.github.com/users/MariagraziaAlastra/followers","following_url":"https://api.github.com/users/MariagraziaAlastra/following{/other_user}","gists_url":"https://api.github.com/users/MariagraziaAlastra/gists{/gist_id}","starred_url":"https://api.github.com/users/MariagraziaAlastra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MariagraziaAlastra/subscriptions","organizations_url":"https://api.github.com/users/MariagraziaAlastra/orgs","repos_url":"https://api.github.com/users/MariagraziaAlastra/repos","events_url":"https://api.github.com/users/MariagraziaAlastra/events{/privacy}","received_events_url":"https://api.github.com/users/MariagraziaAlastra/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2015-12-08T19:42:49Z","updated_at":"2015-12-21T15:11:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1117","html_url":"https://github.com/duckduckgo/community-platform/pull/1117","diff_url":"https://github.com/duckduckgo/community-platform/pull/1117.diff","patch_url":"https://github.com/duckduckgo/community-platform/pull/1117.patch"},"body":"#561 \r\n\r\nBehaviour:\r\n\r\n- Visit /my/github_oauth to be redirected to Github for verification\r\n- If the github_id matches an existing user you will be logged in\r\n- If the github verified public email matches an existing **verified** email, the github_id will be added to your account and you will be logged in\r\n- If neither of these happen, a new account is created with your github login or a username of your choice\r\n- If this login already exists, you should be prompted for a different username\r\n\r\nQuestions and comments:\r\n\r\n- There was an account linking feature previously. Most of these credentials have expired or been revoked - they will be deleted.\r\n- The Github box on the userpage settings page is going away, but its data is still available in the `$user->github_user` accessor\r\n- ghIssues was changed to use a rs method to find users by github login."},"comment":{"url":"https://api.github.com/repos/duckduckgo/community-platform/issues/comments/166326635","html_url":"https://github.com/duckduckgo/community-platform/pull/1117#issuecomment-166326635","issue_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1117","id":166326635,"user":{"login":"jbarrett","id":444449,"avatar_url":"https://avatars.githubusercontent.com/u/444449?v=3","gravatar_id":"","url":"https://api.github.com/users/jbarrett","html_url":"https://github.com/jbarrett","followers_url":"https://api.github.com/users/jbarrett/followers","following_url":"https://api.github.com/users/jbarrett/following{/other_user}","gists_url":"https://api.github.com/users/jbarrett/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarrett/subscriptions","organizations_url":"https://api.github.com/users/jbarrett/orgs","repos_url":"https://api.github.com/users/jbarrett/repos","events_url":"https://api.github.com/users/jbarrett/events{/privacy}","received_events_url":"https://api.github.com/users/jbarrett/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T15:11:44Z","updated_at":"2015-12-21T15:11:44Z","body":"#### To check this out in development:\r\n\r\n- Register your application here : https://github.com/settings/applications/new\r\n- Import the changes in  sql/1.110/00_github_login.sql (use sql/1.110/rollback/rollback.sql if you need to work on other branches)\r\n- Using the client id and secret for the application you registered, run:\r\n\r\n```\r\n$ DDGC_GITHUB_CLIENT_ID=[client_id] DDGC_GITHUB_CLIENT_SECRET=[client_secret] script/ddgc_dev_server.sh\r\n```\r\n\r\n#### Behaviour\r\n\r\nA new link has been added to the login page / modal and register page. You can click this or visit /my/github_oauth - this kicks off the Github auth process. You should be redirected to Github with a request to authorise the application you registered earlier.\r\n\r\nWhen you are redirected back to community platform:\r\n\r\n- If your github user id is associated with an account, you will be logged in as that user\r\n- If your public verified Github mail matches your verified duck.co email, you will be logged in as that user\r\n- If neither of these happen, you'll be prompted to register an account\r\n- If your Github username clashes with a duck.co username, there will be a warning displayed and the username box won't be pre-filled\r\n\r\nYou can link an existing account with Github by logging as normal with username / password, then clicking \"Link Github Account\" on the account page.\r\n\r\n#### Other changes, side effects\r\n\r\nWe are no longer accepting Github credentials as text on the userpage. Existing credentials have been migrated to `github_user_plaintext` - a resultset method `find_by_github_login` has been created to find these users as well as ones with linked Github accounts (see ghIssues.pl changes) in this PR.\r\n\r\nThe `$user->github_user` accessor should do the right thing here too.\r\n\r\nThe `github_user_link` table is being removed.\r\n\r\n`User` now has a relationship with `Github::User` via `github_id` (we should probably consider making this column the PK of github user)."}}