{"action":"created","comment":{"url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/comments/72547306","id":72547306,"diff_hunk":"@@ -214,10 +209,42 @@ def set_user_auth_token(username, password, securitytoken):\n     values['username'] = username\n     values['password'] = password\n     values['securitytoken'] = securitytoken\n+    auth_stmt_set = session.prepare(\n+        'INSERT INTO '\n+        + os.environ.get('DB_USER_TABLE')\n+        + ' (username, password, securitytoken)'\n+        + ' VALUES(?, ?, ?);'\n+    )\n     bound = auth_stmt_set.bind(values)\n \n     try:\n         session.execute(bound)\n+        return True\n+\n+    except Exception as e:\n+        raise Exception('Transaction Error Occurred: ' + str(e))\n+\n+def verify_auth_token(securitytoken):\n+    \"\"\"\n+    Verifies session authentication token.\n+    \"\"\"\n+    values = {}\n+    values['securitytoken'] = securitytoken\n+\n+    auth_stmt_get = session.prepare(\n+        'SELECT username'\n+        + ' FROM ' + os.environ.get('DB_USER_TABLE')\n+        + ' WHERE securitytoken=?'\n+        + ' ALLOW FILTERING;'\n+    )\n+    bound = auth_stmt_get.bind(values)\n+    session.row_factory = named_tuple_factory\n+\n+    try:\n+        rows = session.execute(bound)","path":"src/cassy.py","position":65,"original_position":65,"commit_id":"1c923ff4106ca7192062d121420520aa8572996e","original_commit_id":"1c923ff4106ca7192062d121420520aa8572996e","user":{"login":"something15525","id":1452739,"avatar_url":"https://avatars.githubusercontent.com/u/1452739?v=3","gravatar_id":"","url":"https://api.github.com/users/something15525","html_url":"https://github.com/something15525","followers_url":"https://api.github.com/users/something15525/followers","following_url":"https://api.github.com/users/something15525/following{/other_user}","gists_url":"https://api.github.com/users/something15525/gists{/gist_id}","starred_url":"https://api.github.com/users/something15525/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/something15525/subscriptions","organizations_url":"https://api.github.com/users/something15525/orgs","repos_url":"https://api.github.com/users/something15525/repos","events_url":"https://api.github.com/users/something15525/events{/privacy}","received_events_url":"https://api.github.com/users/something15525/received_events","type":"User","site_admin":false},"body":"Should probably return True or False based on whether the auth token is verified or not, instead of throwing an Exception. Will need to change this in the calling code as well.","created_at":"2016-07-28T00:16:17Z","updated_at":"2016-07-28T00:16:17Z","html_url":"https://github.com/Plantalytics/plantalytics-backend/pull/38#discussion_r72547306","pull_request_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/comments/72547306"},"html":{"href":"https://github.com/Plantalytics/plantalytics-backend/pull/38#discussion_r72547306"},"pull_request":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38","id":78624786,"html_url":"https://github.com/Plantalytics/plantalytics-backend/pull/38","diff_url":"https://github.com/Plantalytics/plantalytics-backend/pull/38.diff","patch_url":"https://github.com/Plantalytics/plantalytics-backend/pull/38.patch","issue_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/38","number":38,"state":"open","locked":false,"title":"BE#30-endpoint-auth","user":{"login":"SoySauceLabs","id":18404087,"avatar_url":"https://avatars.githubusercontent.com/u/18404087?v=3","gravatar_id":"","url":"https://api.github.com/users/SoySauceLabs","html_url":"https://github.com/SoySauceLabs","followers_url":"https://api.github.com/users/SoySauceLabs/followers","following_url":"https://api.github.com/users/SoySauceLabs/following{/other_user}","gists_url":"https://api.github.com/users/SoySauceLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/SoySauceLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoySauceLabs/subscriptions","organizations_url":"https://api.github.com/users/SoySauceLabs/orgs","repos_url":"https://api.github.com/users/SoySauceLabs/repos","events_url":"https://api.github.com/users/SoySauceLabs/events{/privacy}","received_events_url":"https://api.github.com/users/SoySauceLabs/received_events","type":"User","site_admin":false},"body":"# The Deets:\r\n\r\nSoooooo, as much as I love writing out detailed comments (which if you've been reading my PR comments, _I do_ ), I'm feeling a little lazy on a Sunday night, so...\r\n\r\n- [ ]  Ask Matt...\r\n- [ ] Check it...\r\n- [ ] **_SIP IT!!!_** 🍷 ","created_at":"2016-07-25T04:22:42Z","updated_at":"2016-07-28T00:16:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"256ec53b229ad5c6af9580c8c116ecf4c2a9717e","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/milestones/8","html_url":"https://github.com/Plantalytics/plantalytics-backend/milestones/Use%20tokens","labels_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/milestones/8/labels","id":1895770,"number":8,"title":"Use tokens","description":"","creator":{"login":"stripes416","id":15620458,"avatar_url":"https://avatars.githubusercontent.com/u/15620458?v=3","gravatar_id":"","url":"https://api.github.com/users/stripes416","html_url":"https://github.com/stripes416","followers_url":"https://api.github.com/users/stripes416/followers","following_url":"https://api.github.com/users/stripes416/following{/other_user}","gists_url":"https://api.github.com/users/stripes416/gists{/gist_id}","starred_url":"https://api.github.com/users/stripes416/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripes416/subscriptions","organizations_url":"https://api.github.com/users/stripes416/orgs","repos_url":"https://api.github.com/users/stripes416/repos","events_url":"https://api.github.com/users/stripes416/events{/privacy}","received_events_url":"https://api.github.com/users/stripes416/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":1,"state":"open","created_at":"2016-07-21T06:16:48Z","updated_at":"2016-07-25T04:22:42Z","due_on":"2016-07-25T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38/commits","review_comments_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38/comments","review_comment_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/38/comments","statuses_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/statuses/1c923ff4106ca7192062d121420520aa8572996e","head":{"label":"Plantalytics:BE#30-endpoint-auth","ref":"BE#30-endpoint-auth","sha":"1c923ff4106ca7192062d121420520aa8572996e","user":{"login":"Plantalytics","id":19215017,"avatar_url":"https://avatars.githubusercontent.com/u/19215017?v=3","gravatar_id":"","url":"https://api.github.com/users/Plantalytics","html_url":"https://github.com/Plantalytics","followers_url":"https://api.github.com/users/Plantalytics/followers","following_url":"https://api.github.com/users/Plantalytics/following{/other_user}","gists_url":"https://api.github.com/users/Plantalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/Plantalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Plantalytics/subscriptions","organizations_url":"https://api.github.com/users/Plantalytics/orgs","repos_url":"https://api.github.com/users/Plantalytics/repos","events_url":"https://api.github.com/users/Plantalytics/events{/privacy}","received_events_url":"https://api.github.com/users/Plantalytics/received_events","type":"Organization","site_admin":false},"repo":{"id":60988374,"name":"plantalytics-backend","full_name":"Plantalytics/plantalytics-backend","owner":{"login":"Plantalytics","id":19215017,"avatar_url":"https://avatars.githubusercontent.com/u/19215017?v=3","gravatar_id":"","url":"https://api.github.com/users/Plantalytics","html_url":"https://github.com/Plantalytics","followers_url":"https://api.github.com/users/Plantalytics/followers","following_url":"https://api.github.com/users/Plantalytics/following{/other_user}","gists_url":"https://api.github.com/users/Plantalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/Plantalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Plantalytics/subscriptions","organizations_url":"https://api.github.com/users/Plantalytics/orgs","repos_url":"https://api.github.com/users/Plantalytics/repos","events_url":"https://api.github.com/users/Plantalytics/events{/privacy}","received_events_url":"https://api.github.com/users/Plantalytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Plantalytics/plantalytics-backend","description":"All the stuff that's not pretty to look at. ;)","fork":false,"url":"https://api.github.com/repos/Plantalytics/plantalytics-backend","forks_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/forks","keys_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/teams","hooks_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/hooks","issue_events_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/events","assignees_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/tags","blobs_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/languages","stargazers_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/stargazers","contributors_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/contributors","subscribers_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/subscribers","subscription_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/subscription","commits_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/merges","archive_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/downloads","issues_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/labels{/name}","releases_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/deployments","created_at":"2016-06-12T20:43:56Z","updated_at":"2016-07-15T20:57:30Z","pushed_at":"2016-07-26T03:31:35Z","git_url":"git://github.com/Plantalytics/plantalytics-backend.git","ssh_url":"git@github.com:Plantalytics/plantalytics-backend.git","clone_url":"https://github.com/Plantalytics/plantalytics-backend.git","svn_url":"https://github.com/Plantalytics/plantalytics-backend","homepage":null,"size":174,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"Plantalytics:develop","ref":"develop","sha":"71fb46ffde6675511a08b5a7fafd28a7246f3015","user":{"login":"Plantalytics","id":19215017,"avatar_url":"https://avatars.githubusercontent.com/u/19215017?v=3","gravatar_id":"","url":"https://api.github.com/users/Plantalytics","html_url":"https://github.com/Plantalytics","followers_url":"https://api.github.com/users/Plantalytics/followers","following_url":"https://api.github.com/users/Plantalytics/following{/other_user}","gists_url":"https://api.github.com/users/Plantalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/Plantalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Plantalytics/subscriptions","organizations_url":"https://api.github.com/users/Plantalytics/orgs","repos_url":"https://api.github.com/users/Plantalytics/repos","events_url":"https://api.github.com/users/Plantalytics/events{/privacy}","received_events_url":"https://api.github.com/users/Plantalytics/received_events","type":"Organization","site_admin":false},"repo":{"id":60988374,"name":"plantalytics-backend","full_name":"Plantalytics/plantalytics-backend","owner":{"login":"Plantalytics","id":19215017,"avatar_url":"https://avatars.githubusercontent.com/u/19215017?v=3","gravatar_id":"","url":"https://api.github.com/users/Plantalytics","html_url":"https://github.com/Plantalytics","followers_url":"https://api.github.com/users/Plantalytics/followers","following_url":"https://api.github.com/users/Plantalytics/following{/other_user}","gists_url":"https://api.github.com/users/Plantalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/Plantalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Plantalytics/subscriptions","organizations_url":"https://api.github.com/users/Plantalytics/orgs","repos_url":"https://api.github.com/users/Plantalytics/repos","events_url":"https://api.github.com/users/Plantalytics/events{/privacy}","received_events_url":"https://api.github.com/users/Plantalytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Plantalytics/plantalytics-backend","description":"All the stuff that's not pretty to look at. ;)","fork":false,"url":"https://api.github.com/repos/Plantalytics/plantalytics-backend","forks_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/forks","keys_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/teams","hooks_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/hooks","issue_events_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/events","assignees_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/tags","blobs_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/languages","stargazers_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/stargazers","contributors_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/contributors","subscribers_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/subscribers","subscription_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/subscription","commits_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/merges","archive_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/downloads","issues_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/labels{/name}","releases_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Plantalytics/plantalytics-backend/deployments","created_at":"2016-06-12T20:43:56Z","updated_at":"2016-07-15T20:57:30Z","pushed_at":"2016-07-26T03:31:35Z","git_url":"git://github.com/Plantalytics/plantalytics-backend.git","ssh_url":"git@github.com:Plantalytics/plantalytics-backend.git","clone_url":"https://github.com/Plantalytics/plantalytics-backend.git","svn_url":"https://github.com/Plantalytics/plantalytics-backend","homepage":null,"size":174,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38"},"html":{"href":"https://github.com/Plantalytics/plantalytics-backend/pull/38"},"issue":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/38"},"comments":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/Plantalytics/plantalytics-backend/statuses/1c923ff4106ca7192062d121420520aa8572996e"}}}}
{"actor":{"display_login":"something15525"}}