{"action":"created","comment":{"url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/comments/126754076","pull_request_review_id":49268629,"id":126754076,"diff_hunk":"@@ -121,64 +107,88 @@ export default {\n     mounted() {\n         this.loading = true;\n         this.$http.get('/api/v1/login').then(({ data }) => {\n-            this.original = data;\n             this.username = data.name;\n             this.email = data.email;\n             this.loading = false;\n         });\n     },\n \n     methods: {\n-        resetErrors() {\n-            this.invalid_password_error = '';\n-            this.invalid_username_error = '';\n-            this.invalid_credentials_error = '';\n-        },\n-\n         resetParams() {\n-            this.username = this.original.name;\n-            this.email = this.original.email;\n-            this.oldPassword = '';\n-            this.newPassword = '';\n-            this.confirmPassword = '';\n-            this.o_pw_visible = false;\n-            this.n_pw_visible = false;\n-            this.c_pw_visible = false;\n+            this.username = this.$store.state.user.name;\n+            this.email = this.$store.state.user.email;\n+            this.oldPw = '';\n+            this.newPw = '';\n+            this.confirmPw = '';\n         },\n \n         submit() {\n-            this.resetErrors();\n+            this.error = '';\n \n-            if (this.newPassword !== this.confirmPassword || !validator.validate(this.email)) {\n+            if (this.newPw !== this.confirmPw) {\n+                this.error = 'New password doesn\\'t match confirm password.';\n+                return;\n+            } else if (!validator.validate(this.email)) {\n+                this.error = 'Invalid email address.';\n                 return;\n             }\n \n             this.submitted = true;\n-\n-            this.$http.patch('/api/v1/login', {\n+            this.$store.dispatch('user/updateUserInfo', {\n                 username: this.username,\n                 email: this.email,\n-                o_password: this.oldPassword,\n-                n_password: this.newPassword,\n+                oldPw: this.oldPw,\n+                newPw: this.newPw,\n             }).then(() => {\n-                this.original.name = this.username;\n-                this.original.email = this.email;\n                 this.resetParams();\n                 this.success = true;\n                 this.$nextTick(() =>\n                     setTimeout(() => { this.success = false; }, 1000));\n-            }, ({ response }) => {\n-                if (response.data.code === 5) {\n-                    this.invalid_password_error = response.data.rest.password;\n-                    this.invalid_username_error = response.data.rest.username;\n-                } else if (response.data.code === 12) {\n-                    this.invalid_credentials_error = response.data.message;\n+            }, (err) => {\n+                // eslint-disable-next-line\n+                console.dir(err);\n+\n+                switch (err.response.data.code) {\n+                case 5:\n+                    this.error = err.response.data.rest.username || err.response.data.rest.password;\n+                    break;\n+                case 12:\n+                    this.error = err.response.data.message;\n+                    break;\n+                default:\n+                    this.error = 'Unknown error';\n+                    break;\n                 }\n                 this.failure = true;\n-                setTimeout(() => { this.failure = false; }, 1000);\n+                this.$nextTick(() =>\n+                    setTimeout(() => { this.failure = false; }, 1000));\n             }).then(() => {\n                 this.submitted = false;\n             });\n+","path":"src/components/UserInfo.vue","position":220,"original_position":220,"commit_id":"6c87d5b581bef40403ed0d72dc7fcceccf260caf","original_commit_id":"6c87d5b581bef40403ed0d72dc7fcceccf260caf","user":{"login":"libre-man","id":12597247,"avatar_url":"https://avatars0.githubusercontent.com/u/12597247?v=3","gravatar_id":"","url":"https://api.github.com/users/libre-man","html_url":"https://github.com/libre-man","followers_url":"https://api.github.com/users/libre-man/followers","following_url":"https://api.github.com/users/libre-man/following{/other_user}","gists_url":"https://api.github.com/users/libre-man/gists{/gist_id}","starred_url":"https://api.github.com/users/libre-man/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libre-man/subscriptions","organizations_url":"https://api.github.com/users/libre-man/orgs","repos_url":"https://api.github.com/users/libre-man/repos","events_url":"https://api.github.com/users/libre-man/events{/privacy}","received_events_url":"https://api.github.com/users/libre-man/received_events","type":"User","site_admin":false},"body":"This needs to be removed.","created_at":"2017-07-11T17:21:17Z","updated_at":"2017-07-11T17:22:18Z","html_url":"https://github.com/CodeGra-de/CodeGra.de/pull/66#discussion_r126754076","pull_request_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66","_links":{"self":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/comments/126754076"},"html":{"href":"https://github.com/CodeGra-de/CodeGra.de/pull/66#discussion_r126754076"},"pull_request":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66"}}},"pull_request":{"url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66","id":129885874,"html_url":"https://github.com/CodeGra-de/CodeGra.de/pull/66","diff_url":"https://github.com/CodeGra-de/CodeGra.de/pull/66.diff","patch_url":"https://github.com/CodeGra-de/CodeGra.de/pull/66.patch","issue_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/66","number":66,"state":"open","locked":false,"title":"Update username in navbar when updated via userinfo page","user":{"login":"olmokramer","id":3612514,"avatar_url":"https://avatars2.githubusercontent.com/u/3612514?v=3","gravatar_id":"","url":"https://api.github.com/users/olmokramer","html_url":"https://github.com/olmokramer","followers_url":"https://api.github.com/users/olmokramer/followers","following_url":"https://api.github.com/users/olmokramer/following{/other_user}","gists_url":"https://api.github.com/users/olmokramer/gists{/gist_id}","starred_url":"https://api.github.com/users/olmokramer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olmokramer/subscriptions","organizations_url":"https://api.github.com/users/olmokramer/orgs","repos_url":"https://api.github.com/users/olmokramer/repos","events_url":"https://api.github.com/users/olmokramer/events{/privacy}","received_events_url":"https://api.github.com/users/olmokramer/received_events","type":"User","site_admin":false},"body":"## Description\r\nFixes #62.","created_at":"2017-07-11T11:36:51Z","updated_at":"2017-07-11T17:22:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ebc0c8c796deed04a4fb35c6aa59252e9347b54","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66/commits","review_comments_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66/comments","review_comment_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/66/comments","statuses_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/statuses/6c87d5b581bef40403ed0d72dc7fcceccf260caf","head":{"label":"CodeGra-de:update-navbar-username","ref":"update-navbar-username","sha":"6c87d5b581bef40403ed0d72dc7fcceccf260caf","user":{"login":"CodeGra-de","id":30043325,"avatar_url":"https://avatars2.githubusercontent.com/u/30043325?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeGra-de","html_url":"https://github.com/CodeGra-de","followers_url":"https://api.github.com/users/CodeGra-de/followers","following_url":"https://api.github.com/users/CodeGra-de/following{/other_user}","gists_url":"https://api.github.com/users/CodeGra-de/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeGra-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeGra-de/subscriptions","organizations_url":"https://api.github.com/users/CodeGra-de/orgs","repos_url":"https://api.github.com/users/CodeGra-de/repos","events_url":"https://api.github.com/users/CodeGra-de/events{/privacy}","received_events_url":"https://api.github.com/users/CodeGra-de/received_events","type":"Organization","site_admin":false},"repo":{"id":96698423,"name":"CodeGra.de","full_name":"CodeGra-de/CodeGra.de","owner":{"login":"CodeGra-de","id":30043325,"avatar_url":"https://avatars2.githubusercontent.com/u/30043325?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeGra-de","html_url":"https://github.com/CodeGra-de","followers_url":"https://api.github.com/users/CodeGra-de/followers","following_url":"https://api.github.com/users/CodeGra-de/following{/other_user}","gists_url":"https://api.github.com/users/CodeGra-de/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeGra-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeGra-de/subscriptions","organizations_url":"https://api.github.com/users/CodeGra-de/orgs","repos_url":"https://api.github.com/users/CodeGra-de/repos","events_url":"https://api.github.com/users/CodeGra-de/events{/privacy}","received_events_url":"https://api.github.com/users/CodeGra-de/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CodeGra-de/CodeGra.de","description":"Code grading made intuitive","fork":false,"url":"https://api.github.com/repos/CodeGra-de/CodeGra.de","forks_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/forks","keys_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/teams","hooks_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/hooks","issue_events_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/events{/number}","events_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/events","assignees_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/assignees{/user}","branches_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/branches{/branch}","tags_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/tags","blobs_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/refs{/sha}","trees_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/statuses/{sha}","languages_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/languages","stargazers_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/stargazers","contributors_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/contributors","subscribers_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/subscribers","subscription_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/subscription","commits_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/commits{/sha}","git_commits_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/commits{/sha}","comments_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/comments{/number}","issue_comment_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/comments{/number}","contents_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/contents/{+path}","compare_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/merges","archive_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/downloads","issues_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues{/number}","pulls_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls{/number}","milestones_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/milestones{/number}","notifications_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/labels{/name}","releases_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/releases{/id}","deployments_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/deployments","created_at":"2017-07-09T17:00:27Z","updated_at":"2017-07-10T18:19:04Z","pushed_at":"2017-07-11T16:52:28Z","git_url":"git://github.com/CodeGra-de/CodeGra.de.git","ssh_url":"git@github.com:CodeGra-de/CodeGra.de.git","clone_url":"https://github.com/CodeGra-de/CodeGra.de.git","svn_url":"https://github.com/CodeGra-de/CodeGra.de","homepage":"https://codegra.de","size":15888,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":51,"forks":0,"open_issues":51,"watchers":2,"default_branch":"master"}},"base":{"label":"CodeGra-de:master","ref":"master","sha":"5b40b408ec3fd500deb4189e335515cd4d02aa13","user":{"login":"CodeGra-de","id":30043325,"avatar_url":"https://avatars2.githubusercontent.com/u/30043325?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeGra-de","html_url":"https://github.com/CodeGra-de","followers_url":"https://api.github.com/users/CodeGra-de/followers","following_url":"https://api.github.com/users/CodeGra-de/following{/other_user}","gists_url":"https://api.github.com/users/CodeGra-de/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeGra-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeGra-de/subscriptions","organizations_url":"https://api.github.com/users/CodeGra-de/orgs","repos_url":"https://api.github.com/users/CodeGra-de/repos","events_url":"https://api.github.com/users/CodeGra-de/events{/privacy}","received_events_url":"https://api.github.com/users/CodeGra-de/received_events","type":"Organization","site_admin":false},"repo":{"id":96698423,"name":"CodeGra.de","full_name":"CodeGra-de/CodeGra.de","owner":{"login":"CodeGra-de","id":30043325,"avatar_url":"https://avatars2.githubusercontent.com/u/30043325?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeGra-de","html_url":"https://github.com/CodeGra-de","followers_url":"https://api.github.com/users/CodeGra-de/followers","following_url":"https://api.github.com/users/CodeGra-de/following{/other_user}","gists_url":"https://api.github.com/users/CodeGra-de/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeGra-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeGra-de/subscriptions","organizations_url":"https://api.github.com/users/CodeGra-de/orgs","repos_url":"https://api.github.com/users/CodeGra-de/repos","events_url":"https://api.github.com/users/CodeGra-de/events{/privacy}","received_events_url":"https://api.github.com/users/CodeGra-de/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CodeGra-de/CodeGra.de","description":"Code grading made intuitive","fork":false,"url":"https://api.github.com/repos/CodeGra-de/CodeGra.de","forks_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/forks","keys_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/teams","hooks_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/hooks","issue_events_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/events{/number}","events_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/events","assignees_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/assignees{/user}","branches_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/branches{/branch}","tags_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/tags","blobs_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/refs{/sha}","trees_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/statuses/{sha}","languages_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/languages","stargazers_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/stargazers","contributors_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/contributors","subscribers_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/subscribers","subscription_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/subscription","commits_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/commits{/sha}","git_commits_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/git/commits{/sha}","comments_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/comments{/number}","issue_comment_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/comments{/number}","contents_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/contents/{+path}","compare_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/merges","archive_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/downloads","issues_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues{/number}","pulls_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls{/number}","milestones_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/milestones{/number}","notifications_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/labels{/name}","releases_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/releases{/id}","deployments_url":"https://api.github.com/repos/CodeGra-de/CodeGra.de/deployments","created_at":"2017-07-09T17:00:27Z","updated_at":"2017-07-10T18:19:04Z","pushed_at":"2017-07-11T16:52:28Z","git_url":"git://github.com/CodeGra-de/CodeGra.de.git","ssh_url":"git@github.com:CodeGra-de/CodeGra.de.git","clone_url":"https://github.com/CodeGra-de/CodeGra.de.git","svn_url":"https://github.com/CodeGra-de/CodeGra.de","homepage":"https://codegra.de","size":15888,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":51,"forks":0,"open_issues":51,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66"},"html":{"href":"https://github.com/CodeGra-de/CodeGra.de/pull/66"},"issue":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/66"},"comments":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/issues/66/comments"},"review_comments":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66/comments"},"review_comment":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/pulls/66/commits"},"statuses":{"href":"https://api.github.com/repos/CodeGra-de/CodeGra.de/statuses/6c87d5b581bef40403ed0d72dc7fcceccf260caf"}}}}
{"actor":{"display_login":"libre-man"}}