{"action":"created","comment":{"url":"https://api.github.com/repos/systemkern/launcher/pulls/comments/204353380","pull_request_review_id":139414759,"id":204353380,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDM1MzM4MA==","diff_hunk":"@@ -0,0 +1,58 @@\n+package systemkern.profile\n+\n+import org.springframework.data.repository.CrudRepository\n+import org.springframework.http.HttpStatus\n+import org.springframework.security.core.Authentication\n+import org.springframework.stereotype.Service\n+import org.springframework.web.bind.annotation.*\n+import java.time.LocalDateTime\n+import java.util.*\n+import javax.persistence.*\n+\n+@RestController\n+internal class EmailVerificationController(\n+    val emailVerificationService: EmailVerificationService,\n+    val authenticationService: AuthenticationService) {\n+\n+    @PostMapping(\"/verify-email/{id}\")\n+    fun verifyUserByToken(@PathVariable(\"id\") tokenId: String,\n+                          @RequestHeader password: String,\n+                          auth: Authentication): AuthenticationResponse {\n+\n+        val emailVerification = emailVerificationService.findById(UUID.fromString(tokenId)).get()\n+        val completionDate = LocalDateTime.now()\n+        if (LocalDateTime.now() <= emailVerification.validUntil) {\n+            emailVerification.completionDate = completionDate\n+            emailVerificationService.save(emailVerification)\n+            return authenticationService.authenticationProcess(auth, password)\n+        }\n+        throw ExpiredTokenException(\"Token has expired\")\n+    }\n+}\n+\n+@Service\n+internal class EmailVerificationService(val repo: EmailVerificationRepository) {\n+    internal fun findById(id: UUID) =\n+        repo.findById(id)\n+\n+    internal fun save(emailVerification: EmailVerification) =\n+        repo.save(emailVerification)\n+}\n+\n+internal interface EmailVerificationRepository : CrudRepository<EmailVerification, UUID>\n+\n+@Entity\n+internal data class EmailVerification(\n+    @Id\n+    @Column(name = \"id_email_verification\")\n+    val id_email_verification: UUID,\n+    val creationDate: LocalDateTime,\n+    val validUntil: LocalDateTime,\n+    var completionDate: LocalDateTime,\n+    @ManyToOne(fetch = FetchType.LAZY)","path":"user-profile/src/main/kotlin/systemkern/profile/EmailVerification.kt","position":52,"original_position":52,"commit_id":"b3f7e6c20a4fed8b955e25227f4d3f7c1c69bc30","original_commit_id":"b3f7e6c20a4fed8b955e25227f4d3f7c1c69bc30","user":{"login":"rainerkern","id":11457729,"node_id":"MDQ6VXNlcjExNDU3NzI5","avatar_url":"https://avatars3.githubusercontent.com/u/11457729?v=4","gravatar_id":"","url":"https://api.github.com/users/rainerkern","html_url":"https://github.com/rainerkern","followers_url":"https://api.github.com/users/rainerkern/followers","following_url":"https://api.github.com/users/rainerkern/following{/other_user}","gists_url":"https://api.github.com/users/rainerkern/gists{/gist_id}","starred_url":"https://api.github.com/users/rainerkern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainerkern/subscriptions","organizations_url":"https://api.github.com/users/rainerkern/orgs","repos_url":"https://api.github.com/users/rainerkern/repos","events_url":"https://api.github.com/users/rainerkern/events{/privacy}","received_events_url":"https://api.github.com/users/rainerkern/received_events","type":"User","site_admin":false},"body":"Fetch Type LAZY should be default and thus this annotation should be redundant\r\n\r\n","created_at":"2018-07-23T10:30:21Z","updated_at":"2018-07-23T10:36:05Z","html_url":"https://github.com/systemkern/launcher/pull/48#discussion_r204353380","pull_request_url":"https://api.github.com/repos/systemkern/launcher/pulls/48","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/systemkern/launcher/pulls/comments/204353380"},"html":{"href":"https://github.com/systemkern/launcher/pull/48#discussion_r204353380"},"pull_request":{"href":"https://api.github.com/repos/systemkern/launcher/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/systemkern/launcher/pulls/48","id":202404472,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyNDA0NDcy","html_url":"https://github.com/systemkern/launcher/pull/48","diff_url":"https://github.com/systemkern/launcher/pull/48.diff","patch_url":"https://github.com/systemkern/launcher/pull/48.patch","issue_url":"https://api.github.com/repos/systemkern/launcher/issues/48","number":48,"state":"open","locked":false,"title":"#25 email change process","user":{"login":"AndresAusecha","id":16170080,"node_id":"MDQ6VXNlcjE2MTcwMDgw","avatar_url":"https://avatars2.githubusercontent.com/u/16170080?v=4","gravatar_id":"","url":"https://api.github.com/users/AndresAusecha","html_url":"https://github.com/AndresAusecha","followers_url":"https://api.github.com/users/AndresAusecha/followers","following_url":"https://api.github.com/users/AndresAusecha/following{/other_user}","gists_url":"https://api.github.com/users/AndresAusecha/gists{/gist_id}","starred_url":"https://api.github.com/users/AndresAusecha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndresAusecha/subscriptions","organizations_url":"https://api.github.com/users/AndresAusecha/orgs","repos_url":"https://api.github.com/users/AndresAusecha/repos","events_url":"https://api.github.com/users/AndresAusecha/events{/privacy}","received_events_url":"https://api.github.com/users/AndresAusecha/received_events","type":"User","site_admin":false},"body":"@rainerkern i create the pull request, but it is not ready to merge yet","created_at":"2018-07-18T23:10:14Z","updated_at":"2018-07-23T10:36:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb8b673caeca17104046a5e1c18b778135b5835f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/systemkern/launcher/pulls/48/commits","review_comments_url":"https://api.github.com/repos/systemkern/launcher/pulls/48/comments","review_comment_url":"https://api.github.com/repos/systemkern/launcher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systemkern/launcher/issues/48/comments","statuses_url":"https://api.github.com/repos/systemkern/launcher/statuses/b3f7e6c20a4fed8b955e25227f4d3f7c1c69bc30","head":{"label":"systemkern:#25-email-change-process","ref":"#25-email-change-process","sha":"b3f7e6c20a4fed8b955e25227f4d3f7c1c69bc30","user":{"login":"systemkern","id":32642006,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNjQyMDA2","avatar_url":"https://avatars3.githubusercontent.com/u/32642006?v=4","gravatar_id":"","url":"https://api.github.com/users/systemkern","html_url":"https://github.com/systemkern","followers_url":"https://api.github.com/users/systemkern/followers","following_url":"https://api.github.com/users/systemkern/following{/other_user}","gists_url":"https://api.github.com/users/systemkern/gists{/gist_id}","starred_url":"https://api.github.com/users/systemkern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemkern/subscriptions","organizations_url":"https://api.github.com/users/systemkern/orgs","repos_url":"https://api.github.com/users/systemkern/repos","events_url":"https://api.github.com/users/systemkern/events{/privacy}","received_events_url":"https://api.github.com/users/systemkern/received_events","type":"Organization","site_admin":false},"repo":{"id":127404422,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc0MDQ0MjI=","name":"launcher","full_name":"systemkern/launcher","owner":{"login":"systemkern","id":32642006,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNjQyMDA2","avatar_url":"https://avatars3.githubusercontent.com/u/32642006?v=4","gravatar_id":"","url":"https://api.github.com/users/systemkern","html_url":"https://github.com/systemkern","followers_url":"https://api.github.com/users/systemkern/followers","following_url":"https://api.github.com/users/systemkern/following{/other_user}","gists_url":"https://api.github.com/users/systemkern/gists{/gist_id}","starred_url":"https://api.github.com/users/systemkern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemkern/subscriptions","organizations_url":"https://api.github.com/users/systemkern/orgs","repos_url":"https://api.github.com/users/systemkern/repos","events_url":"https://api.github.com/users/systemkern/events{/privacy}","received_events_url":"https://api.github.com/users/systemkern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systemkern/launcher","description":"Provides a prepackaged opinionated default set of technologies of how to build a Java/Kotlin project","fork":false,"url":"https://api.github.com/repos/systemkern/launcher","forks_url":"https://api.github.com/repos/systemkern/launcher/forks","keys_url":"https://api.github.com/repos/systemkern/launcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systemkern/launcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systemkern/launcher/teams","hooks_url":"https://api.github.com/repos/systemkern/launcher/hooks","issue_events_url":"https://api.github.com/repos/systemkern/launcher/issues/events{/number}","events_url":"https://api.github.com/repos/systemkern/launcher/events","assignees_url":"https://api.github.com/repos/systemkern/launcher/assignees{/user}","branches_url":"https://api.github.com/repos/systemkern/launcher/branches{/branch}","tags_url":"https://api.github.com/repos/systemkern/launcher/tags","blobs_url":"https://api.github.com/repos/systemkern/launcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systemkern/launcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systemkern/launcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/systemkern/launcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systemkern/launcher/statuses/{sha}","languages_url":"https://api.github.com/repos/systemkern/launcher/languages","stargazers_url":"https://api.github.com/repos/systemkern/launcher/stargazers","contributors_url":"https://api.github.com/repos/systemkern/launcher/contributors","subscribers_url":"https://api.github.com/repos/systemkern/launcher/subscribers","subscription_url":"https://api.github.com/repos/systemkern/launcher/subscription","commits_url":"https://api.github.com/repos/systemkern/launcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/systemkern/launcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/systemkern/launcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/systemkern/launcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/systemkern/launcher/contents/{+path}","compare_url":"https://api.github.com/repos/systemkern/launcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systemkern/launcher/merges","archive_url":"https://api.github.com/repos/systemkern/launcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systemkern/launcher/downloads","issues_url":"https://api.github.com/repos/systemkern/launcher/issues{/number}","pulls_url":"https://api.github.com/repos/systemkern/launcher/pulls{/number}","milestones_url":"https://api.github.com/repos/systemkern/launcher/milestones{/number}","notifications_url":"https://api.github.com/repos/systemkern/launcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systemkern/launcher/labels{/name}","releases_url":"https://api.github.com/repos/systemkern/launcher/releases{/id}","deployments_url":"https://api.github.com/repos/systemkern/launcher/deployments","created_at":"2018-03-30T08:41:40Z","updated_at":"2018-07-22T09:56:58Z","pushed_at":"2018-07-23T05:42:08Z","git_url":"git://github.com/systemkern/launcher.git","ssh_url":"git@github.com:systemkern/launcher.git","clone_url":"https://github.com/systemkern/launcher.git","svn_url":"https://github.com/systemkern/launcher","homepage":null,"size":385,"stargazers_count":1,"watchers_count":1,"language":"Kotlin","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"unlicense","name":"The Unlicense","spdx_id":"Unlicense","url":"https://api.github.com/licenses/unlicense","node_id":"MDc6TGljZW5zZTE1"},"forks":2,"open_issues":18,"watchers":1,"default_branch":"master"}},"base":{"label":"systemkern:master","ref":"master","sha":"a90ef09739ee5bf662a40bfaf1c7e011ca5f86de","user":{"login":"systemkern","id":32642006,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNjQyMDA2","avatar_url":"https://avatars3.githubusercontent.com/u/32642006?v=4","gravatar_id":"","url":"https://api.github.com/users/systemkern","html_url":"https://github.com/systemkern","followers_url":"https://api.github.com/users/systemkern/followers","following_url":"https://api.github.com/users/systemkern/following{/other_user}","gists_url":"https://api.github.com/users/systemkern/gists{/gist_id}","starred_url":"https://api.github.com/users/systemkern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemkern/subscriptions","organizations_url":"https://api.github.com/users/systemkern/orgs","repos_url":"https://api.github.com/users/systemkern/repos","events_url":"https://api.github.com/users/systemkern/events{/privacy}","received_events_url":"https://api.github.com/users/systemkern/received_events","type":"Organization","site_admin":false},"repo":{"id":127404422,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc0MDQ0MjI=","name":"launcher","full_name":"systemkern/launcher","owner":{"login":"systemkern","id":32642006,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNjQyMDA2","avatar_url":"https://avatars3.githubusercontent.com/u/32642006?v=4","gravatar_id":"","url":"https://api.github.com/users/systemkern","html_url":"https://github.com/systemkern","followers_url":"https://api.github.com/users/systemkern/followers","following_url":"https://api.github.com/users/systemkern/following{/other_user}","gists_url":"https://api.github.com/users/systemkern/gists{/gist_id}","starred_url":"https://api.github.com/users/systemkern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemkern/subscriptions","organizations_url":"https://api.github.com/users/systemkern/orgs","repos_url":"https://api.github.com/users/systemkern/repos","events_url":"https://api.github.com/users/systemkern/events{/privacy}","received_events_url":"https://api.github.com/users/systemkern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systemkern/launcher","description":"Provides a prepackaged opinionated default set of technologies of how to build a Java/Kotlin project","fork":false,"url":"https://api.github.com/repos/systemkern/launcher","forks_url":"https://api.github.com/repos/systemkern/launcher/forks","keys_url":"https://api.github.com/repos/systemkern/launcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systemkern/launcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systemkern/launcher/teams","hooks_url":"https://api.github.com/repos/systemkern/launcher/hooks","issue_events_url":"https://api.github.com/repos/systemkern/launcher/issues/events{/number}","events_url":"https://api.github.com/repos/systemkern/launcher/events","assignees_url":"https://api.github.com/repos/systemkern/launcher/assignees{/user}","branches_url":"https://api.github.com/repos/systemkern/launcher/branches{/branch}","tags_url":"https://api.github.com/repos/systemkern/launcher/tags","blobs_url":"https://api.github.com/repos/systemkern/launcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systemkern/launcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systemkern/launcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/systemkern/launcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systemkern/launcher/statuses/{sha}","languages_url":"https://api.github.com/repos/systemkern/launcher/languages","stargazers_url":"https://api.github.com/repos/systemkern/launcher/stargazers","contributors_url":"https://api.github.com/repos/systemkern/launcher/contributors","subscribers_url":"https://api.github.com/repos/systemkern/launcher/subscribers","subscription_url":"https://api.github.com/repos/systemkern/launcher/subscription","commits_url":"https://api.github.com/repos/systemkern/launcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/systemkern/launcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/systemkern/launcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/systemkern/launcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/systemkern/launcher/contents/{+path}","compare_url":"https://api.github.com/repos/systemkern/launcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systemkern/launcher/merges","archive_url":"https://api.github.com/repos/systemkern/launcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systemkern/launcher/downloads","issues_url":"https://api.github.com/repos/systemkern/launcher/issues{/number}","pulls_url":"https://api.github.com/repos/systemkern/launcher/pulls{/number}","milestones_url":"https://api.github.com/repos/systemkern/launcher/milestones{/number}","notifications_url":"https://api.github.com/repos/systemkern/launcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systemkern/launcher/labels{/name}","releases_url":"https://api.github.com/repos/systemkern/launcher/releases{/id}","deployments_url":"https://api.github.com/repos/systemkern/launcher/deployments","created_at":"2018-03-30T08:41:40Z","updated_at":"2018-07-22T09:56:58Z","pushed_at":"2018-07-23T05:42:08Z","git_url":"git://github.com/systemkern/launcher.git","ssh_url":"git@github.com:systemkern/launcher.git","clone_url":"https://github.com/systemkern/launcher.git","svn_url":"https://github.com/systemkern/launcher","homepage":null,"size":385,"stargazers_count":1,"watchers_count":1,"language":"Kotlin","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"unlicense","name":"The Unlicense","spdx_id":"Unlicense","url":"https://api.github.com/licenses/unlicense","node_id":"MDc6TGljZW5zZTE1"},"forks":2,"open_issues":18,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/systemkern/launcher/pulls/48"},"html":{"href":"https://github.com/systemkern/launcher/pull/48"},"issue":{"href":"https://api.github.com/repos/systemkern/launcher/issues/48"},"comments":{"href":"https://api.github.com/repos/systemkern/launcher/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/systemkern/launcher/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/systemkern/launcher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systemkern/launcher/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/systemkern/launcher/statuses/b3f7e6c20a4fed8b955e25227f4d3f7c1c69bc30"}},"author_association":"NONE"}}
{"actor":{"display_login":"rainerkern"}}