{"action":"created","comment":{"url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/comments/171040215","pull_request_review_id":99823389,"id":171040215,"diff_hunk":"@@ -25,50 +36,69 @@ public IActionResult Register()\n         }\n \n         [HttpPost]\n-        [ValidateAntiForgeryToken]\n-        public async Task<IActionResult> Register(UserView model)\n+        public async Task<JsonResult> Register([FromBody] UserView model)\n         {\n-            if (!ModelState.IsValid) return View(model);\n-            var user = new UserModel {UserName = model.Login};\n+            var user = new UserModel\n+            {\n+                UserName = model.Login\n+            };\n             var result = await _userManager.CreateAsync(user, model.Password);\n+\n             if (result.Succeeded)\n             {\n                 await _signInManager.SignInAsync(user, false);\n-                return RedirectToAction(\"Index\", \"Home\");\n+                return Json(new {Success=true, Token=await GenerateJwtToken(model.Login, user)});\n             }\n \n-            foreach (var error in result.Errors)\n-            {\n-                ModelState.AddModelError(String.Empty, error.Description);\n-            }\n-            return View(model);\n+            return Json(new {Success=false});\n         }\n \n         [HttpGet]\n         public IActionResult Login(string returnUrl = null)\n         {\n-            return View(new LoginView {ReturnUrl = returnUrl});\n+            return View(new LoginView { ReturnUrl = returnUrl });\n         }\n \n         [HttpPost]\n-        [ValidateAntiForgeryToken]\n-        public async Task<IActionResult> Login(LoginView model)\n+        public async Task<JsonResult> Login([FromBody] LoginView model)\n         {\n-            if (!ModelState.IsValid) return View(model);\n-            var result =\n-                await _signInManager.PasswordSignInAsync(model.Login, model.Password, model.Remember, false);\n-            if (result.Succeeded)\n+            if (!ModelState.IsValid)\n             {\n-                if (!string.IsNullOrEmpty(model.ReturnUrl) && Url.IsLocalUrl(model.ReturnUrl))\n-                {\n-                    return Redirect(model.ReturnUrl);\n-                }\n+                return Json(new {Success = false, error=ModelState});","path":"HaroldCI.Api/Controllers/AccountController.cs","position":87,"original_position":87,"commit_id":"d7ec61e51ee9bec332dd057d71e1707f1bc9bf27","original_commit_id":"0319af5114052dff51c912ac6cedf030a6aa7317","user":{"login":"weeellz","id":14861683,"avatar_url":"https://avatars2.githubusercontent.com/u/14861683?v=4","gravatar_id":"","url":"https://api.github.com/users/weeellz","html_url":"https://github.com/weeellz","followers_url":"https://api.github.com/users/weeellz/followers","following_url":"https://api.github.com/users/weeellz/following{/other_user}","gists_url":"https://api.github.com/users/weeellz/gists{/gist_id}","starred_url":"https://api.github.com/users/weeellz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weeellz/subscriptions","organizations_url":"https://api.github.com/users/weeellz/orgs","repos_url":"https://api.github.com/users/weeellz/repos","events_url":"https://api.github.com/users/weeellz/events{/privacy}","received_events_url":"https://api.github.com/users/weeellz/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-02-27T19:31:42Z","updated_at":"2018-02-27T19:31:42Z","html_url":"https://github.com/PieselBois/HaroldCI-Api/pull/22#discussion_r171040215","pull_request_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/comments/171040215"},"html":{"href":"https://github.com/PieselBois/HaroldCI-Api/pull/22#discussion_r171040215"},"pull_request":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22"}},"in_reply_to_id":170994538},"pull_request":{"url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22","id":171721551,"html_url":"https://github.com/PieselBois/HaroldCI-Api/pull/22","diff_url":"https://github.com/PieselBois/HaroldCI-Api/pull/22.diff","patch_url":"https://github.com/PieselBois/HaroldCI-Api/pull/22.patch","issue_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/22","number":22,"state":"open","locked":false,"title":"Token auth","user":{"login":"weeellz","id":14861683,"avatar_url":"https://avatars2.githubusercontent.com/u/14861683?v=4","gravatar_id":"","url":"https://api.github.com/users/weeellz","html_url":"https://github.com/weeellz","followers_url":"https://api.github.com/users/weeellz/followers","following_url":"https://api.github.com/users/weeellz/following{/other_user}","gists_url":"https://api.github.com/users/weeellz/gists{/gist_id}","starred_url":"https://api.github.com/users/weeellz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weeellz/subscriptions","organizations_url":"https://api.github.com/users/weeellz/orgs","repos_url":"https://api.github.com/users/weeellz/repos","events_url":"https://api.github.com/users/weeellz/events{/privacy}","received_events_url":"https://api.github.com/users/weeellz/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-27T16:51:07Z","updated_at":"2018-02-27T19:31:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27f5dd1af110a23a276a059604600ce401f6add3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":835323528,"url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22/commits","review_comments_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22/comments","review_comment_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/22/comments","statuses_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/statuses/d7ec61e51ee9bec332dd057d71e1707f1bc9bf27","head":{"label":"PieselBois:TokenAuth","ref":"TokenAuth","sha":"d7ec61e51ee9bec332dd057d71e1707f1bc9bf27","user":{"login":"PieselBois","id":36415830,"avatar_url":"https://avatars3.githubusercontent.com/u/36415830?v=4","gravatar_id":"","url":"https://api.github.com/users/PieselBois","html_url":"https://github.com/PieselBois","followers_url":"https://api.github.com/users/PieselBois/followers","following_url":"https://api.github.com/users/PieselBois/following{/other_user}","gists_url":"https://api.github.com/users/PieselBois/gists{/gist_id}","starred_url":"https://api.github.com/users/PieselBois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PieselBois/subscriptions","organizations_url":"https://api.github.com/users/PieselBois/orgs","repos_url":"https://api.github.com/users/PieselBois/repos","events_url":"https://api.github.com/users/PieselBois/events{/privacy}","received_events_url":"https://api.github.com/users/PieselBois/received_events","type":"Organization","site_admin":false},"repo":{"id":121278804,"name":"HaroldCI-Api","full_name":"PieselBois/HaroldCI-Api","owner":{"login":"PieselBois","id":36415830,"avatar_url":"https://avatars3.githubusercontent.com/u/36415830?v=4","gravatar_id":"","url":"https://api.github.com/users/PieselBois","html_url":"https://github.com/PieselBois","followers_url":"https://api.github.com/users/PieselBois/followers","following_url":"https://api.github.com/users/PieselBois/following{/other_user}","gists_url":"https://api.github.com/users/PieselBois/gists{/gist_id}","starred_url":"https://api.github.com/users/PieselBois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PieselBois/subscriptions","organizations_url":"https://api.github.com/users/PieselBois/orgs","repos_url":"https://api.github.com/users/PieselBois/repos","events_url":"https://api.github.com/users/PieselBois/events{/privacy}","received_events_url":"https://api.github.com/users/PieselBois/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PieselBois/HaroldCI-Api","description":null,"fork":false,"url":"https://api.github.com/repos/PieselBois/HaroldCI-Api","forks_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/forks","keys_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/teams","hooks_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/hooks","issue_events_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/events{/number}","events_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/events","assignees_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/assignees{/user}","branches_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/branches{/branch}","tags_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/tags","blobs_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/refs{/sha}","trees_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/statuses/{sha}","languages_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/languages","stargazers_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/stargazers","contributors_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/contributors","subscribers_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/subscribers","subscription_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/subscription","commits_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/commits{/sha}","git_commits_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/commits{/sha}","comments_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/comments{/number}","issue_comment_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/comments{/number}","contents_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/contents/{+path}","compare_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/merges","archive_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/downloads","issues_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues{/number}","pulls_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls{/number}","milestones_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/milestones{/number}","notifications_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/labels{/name}","releases_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/releases{/id}","deployments_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/deployments","created_at":"2018-02-12T17:31:46Z","updated_at":"2018-02-12T20:03:18Z","pushed_at":"2018-02-27T17:11:06Z","git_url":"git://github.com/PieselBois/HaroldCI-Api.git","ssh_url":"git@github.com:PieselBois/HaroldCI-Api.git","clone_url":"https://github.com/PieselBois/HaroldCI-Api.git","svn_url":"https://github.com/PieselBois/HaroldCI-Api","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"C#","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":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"PieselBois:master","ref":"master","sha":"126052a81381bfc778702d7366ca3cc6ab92f119","user":{"login":"PieselBois","id":36415830,"avatar_url":"https://avatars3.githubusercontent.com/u/36415830?v=4","gravatar_id":"","url":"https://api.github.com/users/PieselBois","html_url":"https://github.com/PieselBois","followers_url":"https://api.github.com/users/PieselBois/followers","following_url":"https://api.github.com/users/PieselBois/following{/other_user}","gists_url":"https://api.github.com/users/PieselBois/gists{/gist_id}","starred_url":"https://api.github.com/users/PieselBois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PieselBois/subscriptions","organizations_url":"https://api.github.com/users/PieselBois/orgs","repos_url":"https://api.github.com/users/PieselBois/repos","events_url":"https://api.github.com/users/PieselBois/events{/privacy}","received_events_url":"https://api.github.com/users/PieselBois/received_events","type":"Organization","site_admin":false},"repo":{"id":121278804,"name":"HaroldCI-Api","full_name":"PieselBois/HaroldCI-Api","owner":{"login":"PieselBois","id":36415830,"avatar_url":"https://avatars3.githubusercontent.com/u/36415830?v=4","gravatar_id":"","url":"https://api.github.com/users/PieselBois","html_url":"https://github.com/PieselBois","followers_url":"https://api.github.com/users/PieselBois/followers","following_url":"https://api.github.com/users/PieselBois/following{/other_user}","gists_url":"https://api.github.com/users/PieselBois/gists{/gist_id}","starred_url":"https://api.github.com/users/PieselBois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PieselBois/subscriptions","organizations_url":"https://api.github.com/users/PieselBois/orgs","repos_url":"https://api.github.com/users/PieselBois/repos","events_url":"https://api.github.com/users/PieselBois/events{/privacy}","received_events_url":"https://api.github.com/users/PieselBois/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PieselBois/HaroldCI-Api","description":null,"fork":false,"url":"https://api.github.com/repos/PieselBois/HaroldCI-Api","forks_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/forks","keys_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/teams","hooks_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/hooks","issue_events_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/events{/number}","events_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/events","assignees_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/assignees{/user}","branches_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/branches{/branch}","tags_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/tags","blobs_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/refs{/sha}","trees_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/statuses/{sha}","languages_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/languages","stargazers_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/stargazers","contributors_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/contributors","subscribers_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/subscribers","subscription_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/subscription","commits_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/commits{/sha}","git_commits_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/git/commits{/sha}","comments_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/comments{/number}","issue_comment_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/comments{/number}","contents_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/contents/{+path}","compare_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/merges","archive_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/downloads","issues_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues{/number}","pulls_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls{/number}","milestones_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/milestones{/number}","notifications_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/labels{/name}","releases_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/releases{/id}","deployments_url":"https://api.github.com/repos/PieselBois/HaroldCI-Api/deployments","created_at":"2018-02-12T17:31:46Z","updated_at":"2018-02-12T20:03:18Z","pushed_at":"2018-02-27T17:11:06Z","git_url":"git://github.com/PieselBois/HaroldCI-Api.git","ssh_url":"git@github.com:PieselBois/HaroldCI-Api.git","clone_url":"https://github.com/PieselBois/HaroldCI-Api.git","svn_url":"https://github.com/PieselBois/HaroldCI-Api","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"C#","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":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22"},"html":{"href":"https://github.com/PieselBois/HaroldCI-Api/pull/22"},"issue":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/22"},"comments":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/PieselBois/HaroldCI-Api/statuses/d7ec61e51ee9bec332dd057d71e1707f1bc9bf27"}},"author_association":"OWNER"}}
{"actor":{"display_login":"weeellz"}}