{"action":"created","comment":{"url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/comments/231183397","pull_request_review_id":172095455,"id":231183397,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTE4MzM5Nw==","diff_hunk":"@@ -0,0 +1,48 @@\n+const _user = require('../models/user'),\n+  token = require('jsonwebtoken'),\n+  secret = require('../../config/index').config;\n+\n+const giveToken = user => {\n+  return token.sign(\n+    {\n+      _user: user\n+    },\n+    secret.session.secret\n+  );\n+};\n+const valid = req => {\n+  const usermail = req.body.email;\n+  return _user.findAll({ attributes: ['email', 'password'] }, { where: { email: usermail } }).then(user => {\n+    _user.validpw(user.password, req.body.password) && usermail === user.email;\n+  });\n+};\n+\n+const autentication = req => {\n+  const usermail = req.body.email;\n+  return valid(req)\n+    .then(cookie => {\n+      cookie = { 'valid-token': giveToken(usermail) };\n+    })\n+    .catch(error => {\n+      throw error;\n+    });\n+};\n+\n+exports.sesion = (req, res) => {\n+  const usermail = req.body.email;\n+  return _user\n+    .findAll({ where: { email: usermail } })\n+    .then(user => {\n+      user.update({ sesion: true });","path":"app/controllers/signIn.js","position":36,"original_position":36,"commit_id":"420ba9d0f20b715ef1f454561d5cb52271884e8a","original_commit_id":"420ba9d0f20b715ef1f454561d5cb52271884e8a","user":{"login":"gonziesc","id":5241126,"node_id":"MDQ6VXNlcjUyNDExMjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5241126?v=4","gravatar_id":"","url":"https://api.github.com/users/gonziesc","html_url":"https://github.com/gonziesc","followers_url":"https://api.github.com/users/gonziesc/followers","following_url":"https://api.github.com/users/gonziesc/following{/other_user}","gists_url":"https://api.github.com/users/gonziesc/gists{/gist_id}","starred_url":"https://api.github.com/users/gonziesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonziesc/subscriptions","organizations_url":"https://api.github.com/users/gonziesc/orgs","repos_url":"https://api.github.com/users/gonziesc/repos","events_url":"https://api.github.com/users/gonziesc/events{/privacy}","received_events_url":"https://api.github.com/users/gonziesc/received_events","type":"User","site_admin":false},"body":"return","created_at":"2018-11-06T16:03:47Z","updated_at":"2018-11-06T16:04:38Z","html_url":"https://github.com/wolox-training/jdl-express-js/pull/6#discussion_r231183397","pull_request_url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/comments/231183397"},"html":{"href":"https://github.com/wolox-training/jdl-express-js/pull/6#discussion_r231183397"},"pull_request":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6","id":226994318,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2OTk0MzE4","html_url":"https://github.com/wolox-training/jdl-express-js/pull/6","diff_url":"https://github.com/wolox-training/jdl-express-js/pull/6.diff","patch_url":"https://github.com/wolox-training/jdl-express-js/pull/6.patch","issue_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/6","number":6,"state":"open","locked":false,"title":"Sign up","user":{"login":"juada96","id":43753855,"node_id":"MDQ6VXNlcjQzNzUzODU1","avatar_url":"https://avatars3.githubusercontent.com/u/43753855?v=4","gravatar_id":"","url":"https://api.github.com/users/juada96","html_url":"https://github.com/juada96","followers_url":"https://api.github.com/users/juada96/followers","following_url":"https://api.github.com/users/juada96/following{/other_user}","gists_url":"https://api.github.com/users/juada96/gists{/gist_id}","starred_url":"https://api.github.com/users/juada96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juada96/subscriptions","organizations_url":"https://api.github.com/users/juada96/orgs","repos_url":"https://api.github.com/users/juada96/repos","events_url":"https://api.github.com/users/juada96/events{/privacy}","received_events_url":"https://api.github.com/users/juada96/received_events","type":"User","site_admin":false},"body":"## Summary\r\n\r\n*names for sign Up and sign In are switch, this is sign In module. \r\n*after validating data from the user (email and password) token is generated and sent in a cookie.\r\n*there is a new validation in the user model, in order to check valid password\r\n\r\n## Known Issues\r\n\r\nN/A\r\n\r\n## Trello Card\r\n\r\nhttps://trello.com/c/GIAPTFeV/3-sign-in\r\n","created_at":"2018-10-30T16:32:07Z","updated_at":"2018-11-06T16:04:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96983886724a5dfab29e492c1316dc33b8fe9256","assignee":{"login":"gonziesc","id":5241126,"node_id":"MDQ6VXNlcjUyNDExMjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5241126?v=4","gravatar_id":"","url":"https://api.github.com/users/gonziesc","html_url":"https://github.com/gonziesc","followers_url":"https://api.github.com/users/gonziesc/followers","following_url":"https://api.github.com/users/gonziesc/following{/other_user}","gists_url":"https://api.github.com/users/gonziesc/gists{/gist_id}","starred_url":"https://api.github.com/users/gonziesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonziesc/subscriptions","organizations_url":"https://api.github.com/users/gonziesc/orgs","repos_url":"https://api.github.com/users/gonziesc/repos","events_url":"https://api.github.com/users/gonziesc/events{/privacy}","received_events_url":"https://api.github.com/users/gonziesc/received_events","type":"User","site_admin":false},"assignees":[{"login":"gonziesc","id":5241126,"node_id":"MDQ6VXNlcjUyNDExMjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5241126?v=4","gravatar_id":"","url":"https://api.github.com/users/gonziesc","html_url":"https://github.com/gonziesc","followers_url":"https://api.github.com/users/gonziesc/followers","following_url":"https://api.github.com/users/gonziesc/following{/other_user}","gists_url":"https://api.github.com/users/gonziesc/gists{/gist_id}","starred_url":"https://api.github.com/users/gonziesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonziesc/subscriptions","organizations_url":"https://api.github.com/users/gonziesc/orgs","repos_url":"https://api.github.com/users/gonziesc/repos","events_url":"https://api.github.com/users/gonziesc/events{/privacy}","received_events_url":"https://api.github.com/users/gonziesc/received_events","type":"User","site_admin":false},{"login":"juada96","id":43753855,"node_id":"MDQ6VXNlcjQzNzUzODU1","avatar_url":"https://avatars3.githubusercontent.com/u/43753855?v=4","gravatar_id":"","url":"https://api.github.com/users/juada96","html_url":"https://github.com/juada96","followers_url":"https://api.github.com/users/juada96/followers","following_url":"https://api.github.com/users/juada96/following{/other_user}","gists_url":"https://api.github.com/users/juada96/gists{/gist_id}","starred_url":"https://api.github.com/users/juada96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juada96/subscriptions","organizations_url":"https://api.github.com/users/juada96/orgs","repos_url":"https://api.github.com/users/juada96/repos","events_url":"https://api.github.com/users/juada96/events{/privacy}","received_events_url":"https://api.github.com/users/juada96/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6/commits","review_comments_url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6/comments","review_comment_url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/6/comments","statuses_url":"https://api.github.com/repos/wolox-training/jdl-express-js/statuses/420ba9d0f20b715ef1f454561d5cb52271884e8a","head":{"label":"wolox-training:signUp","ref":"signUp","sha":"420ba9d0f20b715ef1f454561d5cb52271884e8a","user":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"repo":{"id":150981452,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA5ODE0NTI=","name":"jdl-express-js","full_name":"wolox-training/jdl-express-js","private":false,"owner":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/wolox-training/jdl-express-js","description":null,"fork":false,"url":"https://api.github.com/repos/wolox-training/jdl-express-js","forks_url":"https://api.github.com/repos/wolox-training/jdl-express-js/forks","keys_url":"https://api.github.com/repos/wolox-training/jdl-express-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wolox-training/jdl-express-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wolox-training/jdl-express-js/teams","hooks_url":"https://api.github.com/repos/wolox-training/jdl-express-js/hooks","issue_events_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/events{/number}","events_url":"https://api.github.com/repos/wolox-training/jdl-express-js/events","assignees_url":"https://api.github.com/repos/wolox-training/jdl-express-js/assignees{/user}","branches_url":"https://api.github.com/repos/wolox-training/jdl-express-js/branches{/branch}","tags_url":"https://api.github.com/repos/wolox-training/jdl-express-js/tags","blobs_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wolox-training/jdl-express-js/statuses/{sha}","languages_url":"https://api.github.com/repos/wolox-training/jdl-express-js/languages","stargazers_url":"https://api.github.com/repos/wolox-training/jdl-express-js/stargazers","contributors_url":"https://api.github.com/repos/wolox-training/jdl-express-js/contributors","subscribers_url":"https://api.github.com/repos/wolox-training/jdl-express-js/subscribers","subscription_url":"https://api.github.com/repos/wolox-training/jdl-express-js/subscription","commits_url":"https://api.github.com/repos/wolox-training/jdl-express-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/wolox-training/jdl-express-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/wolox-training/jdl-express-js/contents/{+path}","compare_url":"https://api.github.com/repos/wolox-training/jdl-express-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wolox-training/jdl-express-js/merges","archive_url":"https://api.github.com/repos/wolox-training/jdl-express-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wolox-training/jdl-express-js/downloads","issues_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues{/number}","pulls_url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls{/number}","milestones_url":"https://api.github.com/repos/wolox-training/jdl-express-js/milestones{/number}","notifications_url":"https://api.github.com/repos/wolox-training/jdl-express-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wolox-training/jdl-express-js/labels{/name}","releases_url":"https://api.github.com/repos/wolox-training/jdl-express-js/releases{/id}","deployments_url":"https://api.github.com/repos/wolox-training/jdl-express-js/deployments","created_at":"2018-09-30T15:53:06Z","updated_at":"2018-10-31T19:49:29Z","pushed_at":"2018-11-06T15:23:19Z","git_url":"git://github.com/wolox-training/jdl-express-js.git","ssh_url":"git@github.com:wolox-training/jdl-express-js.git","clone_url":"https://github.com/wolox-training/jdl-express-js.git","svn_url":"https://github.com/wolox-training/jdl-express-js","homepage":null,"size":151,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"wolox-training:master","ref":"master","sha":"718f8a8084e2148e1cc7d1fd74d34cc24e513755","user":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"repo":{"id":150981452,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA5ODE0NTI=","name":"jdl-express-js","full_name":"wolox-training/jdl-express-js","private":false,"owner":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/wolox-training/jdl-express-js","description":null,"fork":false,"url":"https://api.github.com/repos/wolox-training/jdl-express-js","forks_url":"https://api.github.com/repos/wolox-training/jdl-express-js/forks","keys_url":"https://api.github.com/repos/wolox-training/jdl-express-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wolox-training/jdl-express-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wolox-training/jdl-express-js/teams","hooks_url":"https://api.github.com/repos/wolox-training/jdl-express-js/hooks","issue_events_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/events{/number}","events_url":"https://api.github.com/repos/wolox-training/jdl-express-js/events","assignees_url":"https://api.github.com/repos/wolox-training/jdl-express-js/assignees{/user}","branches_url":"https://api.github.com/repos/wolox-training/jdl-express-js/branches{/branch}","tags_url":"https://api.github.com/repos/wolox-training/jdl-express-js/tags","blobs_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wolox-training/jdl-express-js/statuses/{sha}","languages_url":"https://api.github.com/repos/wolox-training/jdl-express-js/languages","stargazers_url":"https://api.github.com/repos/wolox-training/jdl-express-js/stargazers","contributors_url":"https://api.github.com/repos/wolox-training/jdl-express-js/contributors","subscribers_url":"https://api.github.com/repos/wolox-training/jdl-express-js/subscribers","subscription_url":"https://api.github.com/repos/wolox-training/jdl-express-js/subscription","commits_url":"https://api.github.com/repos/wolox-training/jdl-express-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/wolox-training/jdl-express-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/wolox-training/jdl-express-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/wolox-training/jdl-express-js/contents/{+path}","compare_url":"https://api.github.com/repos/wolox-training/jdl-express-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wolox-training/jdl-express-js/merges","archive_url":"https://api.github.com/repos/wolox-training/jdl-express-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wolox-training/jdl-express-js/downloads","issues_url":"https://api.github.com/repos/wolox-training/jdl-express-js/issues{/number}","pulls_url":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls{/number}","milestones_url":"https://api.github.com/repos/wolox-training/jdl-express-js/milestones{/number}","notifications_url":"https://api.github.com/repos/wolox-training/jdl-express-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wolox-training/jdl-express-js/labels{/name}","releases_url":"https://api.github.com/repos/wolox-training/jdl-express-js/releases{/id}","deployments_url":"https://api.github.com/repos/wolox-training/jdl-express-js/deployments","created_at":"2018-09-30T15:53:06Z","updated_at":"2018-10-31T19:49:29Z","pushed_at":"2018-11-06T15:23:19Z","git_url":"git://github.com/wolox-training/jdl-express-js.git","ssh_url":"git@github.com:wolox-training/jdl-express-js.git","clone_url":"https://github.com/wolox-training/jdl-express-js.git","svn_url":"https://github.com/wolox-training/jdl-express-js","homepage":null,"size":151,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6"},"html":{"href":"https://github.com/wolox-training/jdl-express-js/pull/6"},"issue":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/6"},"comments":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/wolox-training/jdl-express-js/statuses/420ba9d0f20b715ef1f454561d5cb52271884e8a"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"gonziesc"}}