{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/identity-frontend/pulls/comments/61561781","id":61561781,"diff_hunk":"@@ -29,7 +30,52 @@ class SignInFormModel {\n     this.state.save( email );\n   }\n \n+  smartLockSubmit() {\n+\n+    const formElement = this.formElement.elem;\n+\n+    if (navigator.credentials) {\n+      var c = new PasswordCredential(formElement);\n+      fetch(formElement.action, {credentials: c, method: 'POST'})\n+        .then(r => {\n+        if (r.type == 'opaqueredirect' && !r.url.endsWith('/actions/signin')) {\n+          navigator.credentials.store(c).then(_ => {\n+            window.location = getElementById( 'signin_returnUrl' ).value();\n+          });\n+        }\n+        })\n+      ;\n+    }\n+\n+  }\n+\n+  smartLock() {\n+    navigator.credentials.get({\n+        password: true,\n+      })\n+      .then(c => {\n+      if (c instanceof PasswordCredential)\n+    {\n+      c.additionalData = new FormData(document.querySelector('#signin-form'));\n+      c.idName = \"email\";","path":"public/components/signin-form/signin-form.js","position":39,"original_position":39,"commit_id":"acd78783225f423d01d38b5c94b7434fd60e31b0","original_commit_id":"acd78783225f423d01d38b5c94b7434fd60e31b0","user":{"login":"nlindblad","id":164991,"avatar_url":"https://avatars.githubusercontent.com/u/164991?v=3","gravatar_id":"","url":"https://api.github.com/users/nlindblad","html_url":"https://github.com/nlindblad","followers_url":"https://api.github.com/users/nlindblad/followers","following_url":"https://api.github.com/users/nlindblad/following{/other_user}","gists_url":"https://api.github.com/users/nlindblad/gists{/gist_id}","starred_url":"https://api.github.com/users/nlindblad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlindblad/subscriptions","organizations_url":"https://api.github.com/users/nlindblad/orgs","repos_url":"https://api.github.com/users/nlindblad/repos","events_url":"https://api.github.com/users/nlindblad/events{/privacy}","received_events_url":"https://api.github.com/users/nlindblad/received_events","type":"User","site_admin":false},"body":"For completeness, it might also be worth setting the `passwordName`, even though it defaults to `password` [1]\r\n\r\n1. https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential/passwordName","created_at":"2016-04-29T11:03:52Z","updated_at":"2016-04-29T11:03:52Z","html_url":"https://github.com/guardian/identity-frontend/pull/141#discussion_r61561781","pull_request_url":"https://api.github.com/repos/guardian/identity-frontend/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/guardian/identity-frontend/pulls/comments/61561781"},"html":{"href":"https://github.com/guardian/identity-frontend/pull/141#discussion_r61561781"},"pull_request":{"href":"https://api.github.com/repos/guardian/identity-frontend/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/identity-frontend/pulls/141","id":68348383,"html_url":"https://github.com/guardian/identity-frontend/pull/141","diff_url":"https://github.com/guardian/identity-frontend/pull/141.diff","patch_url":"https://github.com/guardian/identity-frontend/pull/141.patch","issue_url":"https://api.github.com/repos/guardian/identity-frontend/issues/141","number":141,"state":"open","locked":false,"title":"Smartlock for passwords","user":{"login":"markjamesbutler","id":406099,"avatar_url":"https://avatars.githubusercontent.com/u/406099?v=3","gravatar_id":"","url":"https://api.github.com/users/markjamesbutler","html_url":"https://github.com/markjamesbutler","followers_url":"https://api.github.com/users/markjamesbutler/followers","following_url":"https://api.github.com/users/markjamesbutler/following{/other_user}","gists_url":"https://api.github.com/users/markjamesbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/markjamesbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markjamesbutler/subscriptions","organizations_url":"https://api.github.com/users/markjamesbutler/orgs","repos_url":"https://api.github.com/users/markjamesbutler/repos","events_url":"https://api.github.com/users/markjamesbutler/events{/privacy}","received_events_url":"https://api.github.com/users/markjamesbutler/received_events","type":"User","site_admin":false},"body":"Implementation of SmartLock functionality providing cross device sign-in.  \r\n\r\n[Smart Lock](https://developers.google.com/identity/smartlock-passwords/android/associate-apps-and-sites#associate_your_app_with_your_website)","created_at":"2016-04-29T09:57:57Z","updated_at":"2016-04-29T11:03:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7d325850c8c1a253e01c53458c5dfbd6d3b390b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/identity-frontend/pulls/141/commits","review_comments_url":"https://api.github.com/repos/guardian/identity-frontend/pulls/141/comments","review_comment_url":"https://api.github.com/repos/guardian/identity-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/identity-frontend/issues/141/comments","statuses_url":"https://api.github.com/repos/guardian/identity-frontend/statuses/acd78783225f423d01d38b5c94b7434fd60e31b0","head":{"label":"guardian:smart-lock","ref":"smart-lock","sha":"acd78783225f423d01d38b5c94b7434fd60e31b0","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":45927868,"name":"identity-frontend","full_name":"guardian/identity-frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/identity-frontend","description":"Frontend for sign-in and registration at theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/identity-frontend","forks_url":"https://api.github.com/repos/guardian/identity-frontend/forks","keys_url":"https://api.github.com/repos/guardian/identity-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/identity-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/identity-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/identity-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/identity-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/identity-frontend/events","assignees_url":"https://api.github.com/repos/guardian/identity-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/identity-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/identity-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/identity-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/identity-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/identity-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/identity-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/identity-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/identity-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/identity-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/identity-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/identity-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/identity-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/identity-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/identity-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/identity-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/identity-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/identity-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/identity-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/identity-frontend/merges","archive_url":"https://api.github.com/repos/guardian/identity-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/identity-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/identity-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/identity-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/identity-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/identity-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/identity-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/identity-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/identity-frontend/deployments","created_at":"2015-11-10T17:19:02Z","updated_at":"2016-03-16T12:04:07Z","pushed_at":"2016-04-29T09:58:45Z","git_url":"git://github.com/guardian/identity-frontend.git","ssh_url":"git@github.com:guardian/identity-frontend.git","clone_url":"https://github.com/guardian/identity-frontend.git","svn_url":"https://github.com/guardian/identity-frontend","homepage":"","size":3861,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"d5ccaa5f6162c8746e61454714e3845d8ccf584d","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":45927868,"name":"identity-frontend","full_name":"guardian/identity-frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/identity-frontend","description":"Frontend for sign-in and registration at theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/identity-frontend","forks_url":"https://api.github.com/repos/guardian/identity-frontend/forks","keys_url":"https://api.github.com/repos/guardian/identity-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/identity-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/identity-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/identity-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/identity-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/identity-frontend/events","assignees_url":"https://api.github.com/repos/guardian/identity-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/identity-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/identity-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/identity-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/identity-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/identity-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/identity-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/identity-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/identity-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/identity-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/identity-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/identity-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/identity-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/identity-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/identity-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/identity-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/identity-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/identity-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/identity-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/identity-frontend/merges","archive_url":"https://api.github.com/repos/guardian/identity-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/identity-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/identity-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/identity-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/identity-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/identity-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/identity-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/identity-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/identity-frontend/deployments","created_at":"2015-11-10T17:19:02Z","updated_at":"2016-03-16T12:04:07Z","pushed_at":"2016-04-29T09:58:45Z","git_url":"git://github.com/guardian/identity-frontend.git","ssh_url":"git@github.com:guardian/identity-frontend.git","clone_url":"https://github.com/guardian/identity-frontend.git","svn_url":"https://github.com/guardian/identity-frontend","homepage":"","size":3861,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/identity-frontend/pulls/141"},"html":{"href":"https://github.com/guardian/identity-frontend/pull/141"},"issue":{"href":"https://api.github.com/repos/guardian/identity-frontend/issues/141"},"comments":{"href":"https://api.github.com/repos/guardian/identity-frontend/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/identity-frontend/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/identity-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/identity-frontend/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/identity-frontend/statuses/acd78783225f423d01d38b5c94b7434fd60e31b0"}}}}