{"action":"created","comment":{"url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/comments/44207358","id":44207358,"diff_hunk":"@@ -35,35 +37,67 @@ class LoginController: UIViewController, UITextFieldDelegate {\n         })\n     }\n     \n-    func textFieldShouldReturn(textField: UITextField) -> Bool {\n+    //\n+    // MARK: - Methods to handle navigation\n+    //\n+    \n+    func pushRootTabBarController() {\n+        LoginHelper.setUserSingleton()\n+        let rootTabBarController = RootTabBarController()\n+        self.presentViewController(rootTabBarController, animated: false, completion: nil)\n+    }\n+    \n+    func showError(message: String) {\n+        if let current = self.currentErrorMessage {\n+            current.removeFromSuperview()\n+        }\n+        \n+        let errorView = ErrorView(height: 64.0, messageString: message)\n+        self.view.addSubview(errorView)\n+        self.view.bringSubviewToFront(errorView)\n+        errorView.setX(0)\n+        errorView.setY(-10)\n+        self.currentErrorMessage = errorView\n+        \n+        UIView.animateWithDuration(UIView.animationTime, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.1, options: UIViewAnimationOptions.CurveLinear, animations: { () -> Void in\n+            errorView.setY(0)\n+            }) { (bool) -> Void in\n+                UIView.animateWithDuration(UIView.animationTime, delay: 3, options: .CurveLinear, animations: { () -> Void in\n+                    errorView.alpha = 0.0\n+                    errorView.setY(-64)\n+                    }, completion: nil)\n+        }\n+    }\n+    \n+    func attemptLogin() {\n         let loginView = (self.view as! LoginView)\n-        if textField == loginView.loginEmailField {\n-            loginView.loginPasswordField.becomeFirstResponder()\n-        } else if textField == loginView.loginPasswordField {\n-            if let email = loginView.loginEmailField.text {\n-                if let password = loginView.loginPasswordField.text {\n-                    LoginHelper.isValidLogin(email, password: password, completion: {\n-                        (valid: Bool) -> Void in\n+        if let email = loginView.loginEmailField.text {\n+            if let password = loginView.loginPasswordField.text {\n+                LoginHelper.isValidLogin(email, password: password, completion: {\n+                    (valid: Bool) -> Void in\n+                    dispatch_async(dispatch_get_main_queue(), { () -> Void in\n                         if (valid) {\n                             self.pushRootTabBarController()\n                         } else {\n                             // indicate bad login\n+                            self.showError(\"Invalid login - try again!\")\n                         }\n                     })\n-                }\n+                })\n             }\n         }\n-        return true\n     }\n     \n-    //\n-    // MARK: - Methods to handle navigation\n-    //\n-    \n-    func pushRootTabBarController() {\n-        LoginHelper.setUserSingleton()\n-        let rootTabBarController = RootTabBarController()\n-        self.presentViewController(rootTabBarController, animated: false, completion: nil)\n+}\n+","path":"sage-ios/SAGE/SAGE/LoginController.swift","position":91,"original_position":91,"commit_id":"3d7cc24c19037c0480362b0217f83280f8c509c8","original_commit_id":"3d7cc24c19037c0480362b0217f83280f8c509c8","user":{"login":"amillman","id":4883505,"avatar_url":"https://avatars.githubusercontent.com/u/4883505?v=3","gravatar_id":"","url":"https://api.github.com/users/amillman","html_url":"https://github.com/amillman","followers_url":"https://api.github.com/users/amillman/followers","following_url":"https://api.github.com/users/amillman/following{/other_user}","gists_url":"https://api.github.com/users/amillman/gists{/gist_id}","starred_url":"https://api.github.com/users/amillman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amillman/subscriptions","organizations_url":"https://api.github.com/users/amillman/orgs","repos_url":"https://api.github.com/users/amillman/repos","events_url":"https://api.github.com/users/amillman/events{/privacy}","received_events_url":"https://api.github.com/users/amillman/received_events","type":"User","site_admin":false},"body":"please MARK it","created_at":"2015-11-07T03:43:40Z","updated_at":"2015-11-07T03:43:40Z","html_url":"https://github.com/calblueprint/sage-mobile/pull/15#discussion_r44207358","pull_request_url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/comments/44207358"},"html":{"href":"https://github.com/calblueprint/sage-mobile/pull/15#discussion_r44207358"},"pull_request":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15","id":49791924,"html_url":"https://github.com/calblueprint/sage-mobile/pull/15","diff_url":"https://github.com/calblueprint/sage-mobile/pull/15.diff","patch_url":"https://github.com/calblueprint/sage-mobile/pull/15.patch","issue_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues/15","number":15,"state":"open","locked":false,"title":"Sameera/login network requests and validation","user":{"login":"sameerav","id":7706852,"avatar_url":"https://avatars.githubusercontent.com/u/7706852?v=3","gravatar_id":"","url":"https://api.github.com/users/sameerav","html_url":"https://github.com/sameerav","followers_url":"https://api.github.com/users/sameerav/followers","following_url":"https://api.github.com/users/sameerav/following{/other_user}","gists_url":"https://api.github.com/users/sameerav/gists{/gist_id}","starred_url":"https://api.github.com/users/sameerav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sameerav/subscriptions","organizations_url":"https://api.github.com/users/sameerav/orgs","repos_url":"https://api.github.com/users/sameerav/repos","events_url":"https://api.github.com/users/sameerav/events{/privacy}","received_events_url":"https://api.github.com/users/sameerav/received_events","type":"User","site_admin":false},"body":"Review @amillman ?\r\n\r\nThis pr:\r\n1. Adds validation to sign in and login screens\r\n2. Creates and animates error messages\r\n3. Makes network requests for login, user creation, and checking whether a user is verified\r\n4. Writes and reads appropriate data from the keychain\r\n5. Fixes a few other small bugs","created_at":"2015-11-05T07:48:51Z","updated_at":"2015-11-07T03:43:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f654d176764f4c203e89e58df79c3b5efaea6fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15/commits","review_comments_url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15/comments","review_comment_url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues/15/comments","statuses_url":"https://api.github.com/repos/calblueprint/sage-mobile/statuses/3d7cc24c19037c0480362b0217f83280f8c509c8","head":{"label":"calblueprint:sameera/login-network-requests-and-validation","ref":"sameera/login-network-requests-and-validation","sha":"3d7cc24c19037c0480362b0217f83280f8c509c8","user":{"login":"calblueprint","id":2729578,"avatar_url":"https://avatars.githubusercontent.com/u/2729578?v=3","gravatar_id":"","url":"https://api.github.com/users/calblueprint","html_url":"https://github.com/calblueprint","followers_url":"https://api.github.com/users/calblueprint/followers","following_url":"https://api.github.com/users/calblueprint/following{/other_user}","gists_url":"https://api.github.com/users/calblueprint/gists{/gist_id}","starred_url":"https://api.github.com/users/calblueprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calblueprint/subscriptions","organizations_url":"https://api.github.com/users/calblueprint/orgs","repos_url":"https://api.github.com/users/calblueprint/repos","events_url":"https://api.github.com/users/calblueprint/events{/privacy}","received_events_url":"https://api.github.com/users/calblueprint/received_events","type":"Organization","site_admin":false},"repo":{"id":42952348,"name":"sage-mobile","full_name":"calblueprint/sage-mobile","owner":{"login":"calblueprint","id":2729578,"avatar_url":"https://avatars.githubusercontent.com/u/2729578?v=3","gravatar_id":"","url":"https://api.github.com/users/calblueprint","html_url":"https://github.com/calblueprint","followers_url":"https://api.github.com/users/calblueprint/followers","following_url":"https://api.github.com/users/calblueprint/following{/other_user}","gists_url":"https://api.github.com/users/calblueprint/gists{/gist_id}","starred_url":"https://api.github.com/users/calblueprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calblueprint/subscriptions","organizations_url":"https://api.github.com/users/calblueprint/orgs","repos_url":"https://api.github.com/users/calblueprint/repos","events_url":"https://api.github.com/users/calblueprint/events{/privacy}","received_events_url":"https://api.github.com/users/calblueprint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/calblueprint/sage-mobile","description":"Mobile repo for SAGE","fork":false,"url":"https://api.github.com/repos/calblueprint/sage-mobile","forks_url":"https://api.github.com/repos/calblueprint/sage-mobile/forks","keys_url":"https://api.github.com/repos/calblueprint/sage-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/calblueprint/sage-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/calblueprint/sage-mobile/teams","hooks_url":"https://api.github.com/repos/calblueprint/sage-mobile/hooks","issue_events_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/calblueprint/sage-mobile/events","assignees_url":"https://api.github.com/repos/calblueprint/sage-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/calblueprint/sage-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/calblueprint/sage-mobile/tags","blobs_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/calblueprint/sage-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/calblueprint/sage-mobile/languages","stargazers_url":"https://api.github.com/repos/calblueprint/sage-mobile/stargazers","contributors_url":"https://api.github.com/repos/calblueprint/sage-mobile/contributors","subscribers_url":"https://api.github.com/repos/calblueprint/sage-mobile/subscribers","subscription_url":"https://api.github.com/repos/calblueprint/sage-mobile/subscription","commits_url":"https://api.github.com/repos/calblueprint/sage-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/calblueprint/sage-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/calblueprint/sage-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/calblueprint/sage-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/calblueprint/sage-mobile/merges","archive_url":"https://api.github.com/repos/calblueprint/sage-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/calblueprint/sage-mobile/downloads","issues_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/calblueprint/sage-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/calblueprint/sage-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/calblueprint/sage-mobile/labels{/name}","releases_url":"https://api.github.com/repos/calblueprint/sage-mobile/releases{/id}","created_at":"2015-09-22T18:19:43Z","updated_at":"2015-11-04T20:48:34Z","pushed_at":"2015-11-05T09:23:55Z","git_url":"git://github.com/calblueprint/sage-mobile.git","ssh_url":"git@github.com:calblueprint/sage-mobile.git","clone_url":"https://github.com/calblueprint/sage-mobile.git","svn_url":"https://github.com/calblueprint/sage-mobile","homepage":null,"size":10084,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"calblueprint:master","ref":"master","sha":"7796ff212fa169ccbe8fcf784b647ae0d10be6af","user":{"login":"calblueprint","id":2729578,"avatar_url":"https://avatars.githubusercontent.com/u/2729578?v=3","gravatar_id":"","url":"https://api.github.com/users/calblueprint","html_url":"https://github.com/calblueprint","followers_url":"https://api.github.com/users/calblueprint/followers","following_url":"https://api.github.com/users/calblueprint/following{/other_user}","gists_url":"https://api.github.com/users/calblueprint/gists{/gist_id}","starred_url":"https://api.github.com/users/calblueprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calblueprint/subscriptions","organizations_url":"https://api.github.com/users/calblueprint/orgs","repos_url":"https://api.github.com/users/calblueprint/repos","events_url":"https://api.github.com/users/calblueprint/events{/privacy}","received_events_url":"https://api.github.com/users/calblueprint/received_events","type":"Organization","site_admin":false},"repo":{"id":42952348,"name":"sage-mobile","full_name":"calblueprint/sage-mobile","owner":{"login":"calblueprint","id":2729578,"avatar_url":"https://avatars.githubusercontent.com/u/2729578?v=3","gravatar_id":"","url":"https://api.github.com/users/calblueprint","html_url":"https://github.com/calblueprint","followers_url":"https://api.github.com/users/calblueprint/followers","following_url":"https://api.github.com/users/calblueprint/following{/other_user}","gists_url":"https://api.github.com/users/calblueprint/gists{/gist_id}","starred_url":"https://api.github.com/users/calblueprint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calblueprint/subscriptions","organizations_url":"https://api.github.com/users/calblueprint/orgs","repos_url":"https://api.github.com/users/calblueprint/repos","events_url":"https://api.github.com/users/calblueprint/events{/privacy}","received_events_url":"https://api.github.com/users/calblueprint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/calblueprint/sage-mobile","description":"Mobile repo for SAGE","fork":false,"url":"https://api.github.com/repos/calblueprint/sage-mobile","forks_url":"https://api.github.com/repos/calblueprint/sage-mobile/forks","keys_url":"https://api.github.com/repos/calblueprint/sage-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/calblueprint/sage-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/calblueprint/sage-mobile/teams","hooks_url":"https://api.github.com/repos/calblueprint/sage-mobile/hooks","issue_events_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/calblueprint/sage-mobile/events","assignees_url":"https://api.github.com/repos/calblueprint/sage-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/calblueprint/sage-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/calblueprint/sage-mobile/tags","blobs_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/calblueprint/sage-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/calblueprint/sage-mobile/languages","stargazers_url":"https://api.github.com/repos/calblueprint/sage-mobile/stargazers","contributors_url":"https://api.github.com/repos/calblueprint/sage-mobile/contributors","subscribers_url":"https://api.github.com/repos/calblueprint/sage-mobile/subscribers","subscription_url":"https://api.github.com/repos/calblueprint/sage-mobile/subscription","commits_url":"https://api.github.com/repos/calblueprint/sage-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/calblueprint/sage-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/calblueprint/sage-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/calblueprint/sage-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/calblueprint/sage-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/calblueprint/sage-mobile/merges","archive_url":"https://api.github.com/repos/calblueprint/sage-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/calblueprint/sage-mobile/downloads","issues_url":"https://api.github.com/repos/calblueprint/sage-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/calblueprint/sage-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/calblueprint/sage-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/calblueprint/sage-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/calblueprint/sage-mobile/labels{/name}","releases_url":"https://api.github.com/repos/calblueprint/sage-mobile/releases{/id}","created_at":"2015-09-22T18:19:43Z","updated_at":"2015-11-04T20:48:34Z","pushed_at":"2015-11-05T09:23:55Z","git_url":"git://github.com/calblueprint/sage-mobile.git","ssh_url":"git@github.com:calblueprint/sage-mobile.git","clone_url":"https://github.com/calblueprint/sage-mobile.git","svn_url":"https://github.com/calblueprint/sage-mobile","homepage":null,"size":10084,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15"},"html":{"href":"https://github.com/calblueprint/sage-mobile/pull/15"},"issue":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/issues/15"},"comments":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/calblueprint/sage-mobile/statuses/3d7cc24c19037c0480362b0217f83280f8c509c8"}}}}