{"action":"created","comment":{"url":"https://api.github.com/repos/tidepool-org/shoreline/pulls/comments/34938285","id":34938285,"diff_hunk":"@@ -30,28 +30,50 @@ type UserDetail struct {\n \tVerified bool     `json:\"authenticated\"` //tag is name `authenticated` for historical reasons\n }\n \n-func NewUser(details *UserDetail, salt string) (user *User, err error) {\n+func NewUser(details *UserDetail, salt string) (*User, error) {\n \n \tif details.Name == \"\" || details.Pw == \"\" {\n-\t\treturn user, errors.New(\"both the name and pw are required\")\n+\t\treturn nil, errors.New(\"both the name and pw are required\")\n \t}\n \t//name is always lowercase\n \tdetails.Name = strings.ToLower(details.Name)\n-\n-\tid, _ := generateUniqueHash([]string{details.Name, details.Pw}, 10)\n-\thash, _ := generateUniqueHash([]string{details.Name, details.Pw, id}, 24)\n-\tpwHash, _ := GeneratePasswordHash(id, details.Pw, salt)\n-\n+\t//generate the hashes\n+\tid, err := generateUniqueHash([]string{details.Name, details.Pw}, 10)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\thash, err := generateUniqueHash([]string{details.Name, details.Pw, id}, 24)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tpwHash, err := GeneratePasswordHash(id, details.Pw, salt)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\t//all good we have a user\n \treturn &User{Id: id, Name: details.Name, Emails: details.Emails, Hash: hash, PwHash: pwHash, Verified: false}, nil\n }\n \n //Child Account are linked to another users account and don't require a password or emails\n-func NewChildUser(details *UserDetail, salt string) (user *User, err error) {\n+func NewChildUser(details *UserDetail, salt string) (*User, error) {\n+\n+\tif details.Name == \"\" {\n+\t\treturn nil, errors.New(\"name is required\")\n+\t}\n ","path":"user/user.go","position":42,"original_position":42,"commit_id":"0e557fd67cdf93a69a23b19325bf91d52301a23e","original_commit_id":"0e557fd67cdf93a69a23b19325bf91d52301a23e","user":{"login":"darinkrauss","id":1224433,"avatar_url":"https://avatars.githubusercontent.com/u/1224433?v=3","gravatar_id":"","url":"https://api.github.com/users/darinkrauss","html_url":"https://github.com/darinkrauss","followers_url":"https://api.github.com/users/darinkrauss/followers","following_url":"https://api.github.com/users/darinkrauss/following{/other_user}","gists_url":"https://api.github.com/users/darinkrauss/gists{/gist_id}","starred_url":"https://api.github.com/users/darinkrauss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darinkrauss/subscriptions","organizations_url":"https://api.github.com/users/darinkrauss/orgs","repos_url":"https://api.github.com/users/darinkrauss/repos","events_url":"https://api.github.com/users/darinkrauss/events{/privacy}","received_events_url":"https://api.github.com/users/darinkrauss/received_events","type":"User","site_admin":false},"body":"I know this isn't part of this particular PR, but I notice the above `NewUser` function forces the `details.Name` to lowercase (line 39), but this `NewChildUser` function does not force that.","created_at":"2015-07-17T23:01:00Z","updated_at":"2015-07-17T23:01:00Z","html_url":"https://github.com/tidepool-org/shoreline/pull/17#discussion_r34938285","pull_request_url":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/shoreline/pulls/comments/34938285"},"html":{"href":"https://github.com/tidepool-org/shoreline/pull/17#discussion_r34938285"},"pull_request":{"href":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17","id":40116695,"html_url":"https://github.com/tidepool-org/shoreline/pull/17","diff_url":"https://github.com/tidepool-org/shoreline/pull/17.diff","patch_url":"https://github.com/tidepool-org/shoreline/pull/17.patch","issue_url":"https://api.github.com/repos/tidepool-org/shoreline/issues/17","number":17,"state":"open","locked":false,"title":"Jhbate/hash","user":{"login":"jh-bate","id":5168993,"avatar_url":"https://avatars.githubusercontent.com/u/5168993?v=3","gravatar_id":"","url":"https://api.github.com/users/jh-bate","html_url":"https://github.com/jh-bate","followers_url":"https://api.github.com/users/jh-bate/followers","following_url":"https://api.github.com/users/jh-bate/following{/other_user}","gists_url":"https://api.github.com/users/jh-bate/gists{/gist_id}","starred_url":"https://api.github.com/users/jh-bate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jh-bate/subscriptions","organizations_url":"https://api.github.com/users/jh-bate/orgs","repos_url":"https://api.github.com/users/jh-bate/repos","events_url":"https://api.github.com/users/jh-bate/events{/privacy}","received_events_url":"https://api.github.com/users/jh-bate/received_events","type":"User","site_admin":false},"body":"@darinkrauss done as an initial talking point - I did some cleanup but might be barking up the wrong tree.","created_at":"2015-07-16T10:50:43Z","updated_at":"2015-07-17T23:01:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55b756906b1ad0be6bcd962f369072b734e6e9dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17/commits","review_comments_url":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17/comments","review_comment_url":"https://api.github.com/repos/tidepool-org/shoreline/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidepool-org/shoreline/issues/17/comments","statuses_url":"https://api.github.com/repos/tidepool-org/shoreline/statuses/0e557fd67cdf93a69a23b19325bf91d52301a23e","head":{"label":"tidepool-org:jhbate/hash","ref":"jhbate/hash","sha":"0e557fd67cdf93a69a23b19325bf91d52301a23e","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":21628959,"name":"shoreline","full_name":"tidepool-org/shoreline","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/shoreline","description":"Shoreline is the entrance to the ocean; in our case it manages logins and user accounts","fork":false,"url":"https://api.github.com/repos/tidepool-org/shoreline","forks_url":"https://api.github.com/repos/tidepool-org/shoreline/forks","keys_url":"https://api.github.com/repos/tidepool-org/shoreline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/shoreline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/shoreline/teams","hooks_url":"https://api.github.com/repos/tidepool-org/shoreline/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/shoreline/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/shoreline/events","assignees_url":"https://api.github.com/repos/tidepool-org/shoreline/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/shoreline/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/shoreline/tags","blobs_url":"https://api.github.com/repos/tidepool-org/shoreline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/shoreline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/shoreline/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/shoreline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/shoreline/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/shoreline/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/shoreline/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/shoreline/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/shoreline/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/shoreline/subscription","commits_url":"https://api.github.com/repos/tidepool-org/shoreline/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/shoreline/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/shoreline/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/shoreline/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/shoreline/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/shoreline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/shoreline/merges","archive_url":"https://api.github.com/repos/tidepool-org/shoreline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/shoreline/downloads","issues_url":"https://api.github.com/repos/tidepool-org/shoreline/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/shoreline/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/shoreline/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/shoreline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/shoreline/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/shoreline/releases{/id}","created_at":"2014-07-08T20:47:07Z","updated_at":"2015-04-30T00:04:19Z","pushed_at":"2015-07-17T10:22:25Z","git_url":"git://github.com/tidepool-org/shoreline.git","ssh_url":"git@github.com:tidepool-org/shoreline.git","clone_url":"https://github.com/tidepool-org/shoreline.git","svn_url":"https://github.com/tidepool-org/shoreline","homepage":null,"size":1295,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"tidepool-org:master","ref":"master","sha":"1efe12234bff8c958adb82002e5fb54dc6adbba8","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":21628959,"name":"shoreline","full_name":"tidepool-org/shoreline","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/shoreline","description":"Shoreline is the entrance to the ocean; in our case it manages logins and user accounts","fork":false,"url":"https://api.github.com/repos/tidepool-org/shoreline","forks_url":"https://api.github.com/repos/tidepool-org/shoreline/forks","keys_url":"https://api.github.com/repos/tidepool-org/shoreline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/shoreline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/shoreline/teams","hooks_url":"https://api.github.com/repos/tidepool-org/shoreline/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/shoreline/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/shoreline/events","assignees_url":"https://api.github.com/repos/tidepool-org/shoreline/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/shoreline/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/shoreline/tags","blobs_url":"https://api.github.com/repos/tidepool-org/shoreline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/shoreline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/shoreline/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/shoreline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/shoreline/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/shoreline/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/shoreline/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/shoreline/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/shoreline/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/shoreline/subscription","commits_url":"https://api.github.com/repos/tidepool-org/shoreline/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/shoreline/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/shoreline/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/shoreline/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/shoreline/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/shoreline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/shoreline/merges","archive_url":"https://api.github.com/repos/tidepool-org/shoreline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/shoreline/downloads","issues_url":"https://api.github.com/repos/tidepool-org/shoreline/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/shoreline/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/shoreline/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/shoreline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/shoreline/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/shoreline/releases{/id}","created_at":"2014-07-08T20:47:07Z","updated_at":"2015-04-30T00:04:19Z","pushed_at":"2015-07-17T10:22:25Z","git_url":"git://github.com/tidepool-org/shoreline.git","ssh_url":"git@github.com:tidepool-org/shoreline.git","clone_url":"https://github.com/tidepool-org/shoreline.git","svn_url":"https://github.com/tidepool-org/shoreline","homepage":null,"size":1295,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17"},"html":{"href":"https://github.com/tidepool-org/shoreline/pull/17"},"issue":{"href":"https://api.github.com/repos/tidepool-org/shoreline/issues/17"},"comments":{"href":"https://api.github.com/repos/tidepool-org/shoreline/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/tidepool-org/shoreline/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidepool-org/shoreline/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/tidepool-org/shoreline/statuses/0e557fd67cdf93a69a23b19325bf91d52301a23e"}}}}