{"action":"created","comment":{"url":"https://api.github.com/repos/storiwaterboy/simfle/pulls/comments/130234879","pull_request_review_id":53089773,"id":130234879,"diff_hunk":"@@ -0,0 +1,156 @@\n+<?php defined('BASEPATH') OR exit('No direct script access allowed');\n+\n+class AccountApi extends API_Controller\n+{\n+\tpublic function __construct()\n+\t{\n+\t\tparent::__construct();\n+\n+\t\t$this->load->library('form_validation');\n+\t\t$this->load->model('user_model');\n+\n+\t\t$this->allow_without_login = ['signup', 'login'];\n+\t}\n+\n+\tpublic function signup()\n+\t{\n+\t\tif ($this->accountlib->is_login()) {\n+\t\t\t$this->return_fail_response('101', ['message' => '로그아웃 해주세요.']);\n+\t\t}\n+\n+\t\tif (!$this->_is_validate_signup()) {\n+\t\t\t$this->return_fail_response('105', ['message' => $this->form_validation->error_string()]);\n+\t\t}\n+\n+\t\t$id = $this->user_model->signup_and_get_id(\n+\t\t\t$this->input->post('email'),\n+\t\t\tpassword_hash($this->input->post('password'), PASSWORD_BCRYPT),\n+\t\t\t$this->input->post('name'),\n+\t\t\tdate('Y-m-d H:i:s'),\n+\t\t\t$this->input->post('facebook_id')\n+\t\t);\n+\n+\t\t$this->session->set_userdata('id', $id);\n+\t\t$this->return_success_response();\n+\t}\n+\n+\t/**\n+\t * @return bool\n+\t */\n+\tprivate function _is_validate_signup()\n+\t{\n+\t\t$this->load->library('form_validation');\n+\n+\t\t$this->form_validation->set_rules('email', '이메일',\n+\t\t\t'trim|required|max_length[100]|valid_email|callback_is_unique_email',\n+\t\t\t[\n+\t\t\t\t'required' => '이메일을 입력해주세요',\n+\t\t\t\t'max_length' => '이메일 최대 길이는 100글자입니다.',\n+\t\t\t\t'valid_email' => '유효한 이메일 형식이 아닙니다.',\n+\t\t\t\t'is_unique_email' => '중복되는 이메일이 있습니다.'\n+\t\t\t]);\n+\n+\t\t$this->form_validation->set_rules('name', '이름',\n+\t\t\t'trim|required|min_length[2]|max_length[30]|callback_is_unique_name|callback_check_name_password_regexp',\n+\t\t\t[\n+\t\t\t\t'required' => '이름을 입력해주세요.',\n+\t\t\t\t'min_length' => '이름의 최소 길이는 2글자입니다.',\n+\t\t\t\t'max_length' => '이름의 최대 길이는 30글자입니다.',\n+\t\t\t\t'is_unique_name' => '중복되는 이름이 있습니다.',\n+\t\t\t\t'check_name_password_regexp' => '공백을 제거해주세요.'\n+\t\t\t]);\n+\n+\t\t$this->form_validation->set_rules('password', '비밀번호',\n+\t\t\t'trim|required|min_length[8]|callback_check_name_password_regexp',\n+\t\t\t[\n+\t\t\t\t'required' => '비밀번호를 입력해주세요',\n+\t\t\t\t'min_length' => '비밀번호 최소 길이는 8글자입니다.',\n+\t\t\t\t'check_name_password_regexp' => '공백을 제거해주세요.'\n+\t\t\t]);\n+\n+\t\t$this->form_validation->set_rules('check_password', '확인비밀번호',\n+\t\t\t'required|matches[password]',\n+\t\t\t[\n+\t\t\t\t'required' => '확인 비밀번호를 입력해주세요.',\n+\t\t\t\t'matches' => '확인 비밀번호가 일치하지 않습니다.'\n+\t\t\t]);\n+\n+\t\treturn $this->form_validation->run();\n+\t}\n+\n+\tpublic function is_unique_email($email)\n+\t{\n+\t\treturn $this->user_model->is_unique_email($email);\n+\t}\n+\n+\tpublic function is_unique_name($name)\n+\t{\n+\t\treturn $this->user_model->is_unique_name($name);\n+\t}\n+\n+\tpublic function check_name_password_regexp($value)\n+\t{\n+\t\treturn !preg_match('/[\\s]/', $value);\n+\t}\n+\n+\tpublic function login()\n+\t{\n+\t\tif ($this->accountlib->is_login()) {\n+\t\t\t$this->return_fail_response('101', ['message' => '이미 로그인 되어있습니다.']);\n+\t\t}\n+\n+\t\tif ($this->input->post('is_facebook') === '1') {\n+\t\t\t$this->_facebook_login();\n+\t\t} else {\n+\t\t\t$this->_normal_login();\n+\t\t}\n+\t}\n+\n+\tprivate function _facebook_login()\n+\t{\n+\t\t$this->config->load('facebook');\n+\t\t$fb = new Facebook\\Facebook([\n+\t\t\t'app_id' => $this->config->item('app_id'),\n+\t\t\t'app_secret' => $this->config->item('app_secret'),\n+\t\t\t'default_graph_version' => $this->config->item('api_version')\n+\t\t]);\n+\n+\t\t$access_token = $fb->getJavaScriptHelper()->getAccessToken();\n+\t\t$long_lived_access_token = $fb->getOAuth2Client()->getLongLivedAccessToken($access_token);\n+\t\tif ($long_lived_access_token === NULL) {\n+\t\t\t$this->return_fail_response('500', ['message' => '페이스북 로그인 정보를 가져오는 중에 오류가 발생했습니다.']);\n+\t\t}\n+\n+\t\t$fb->setDefaultAccessToken($long_lived_access_token);\n+\n+\t\t$this->session->set_userdata(['facebook_access_token' => $long_lived_access_token]);\n+\n+\t\t$user_node = $fb->get('/me?fields=id')->getGraphUser();\n+\t\t$facebook_id = $user_node->getId();\n+\n+\t\t$user = $this->user_model->get_user_if_exist_fb_id($facebook_id);","path":"application/controllers/AccountApi.php","position":131,"original_position":131,"commit_id":"2280a34b2c68c9afa14e1ec2edaeb27f9f08b354","original_commit_id":"2280a34b2c68c9afa14e1ec2edaeb27f9f08b354","user":{"login":"kimtree","id":557307,"avatar_url":"https://avatars0.githubusercontent.com/u/557307?v=4","gravatar_id":"","url":"https://api.github.com/users/kimtree","html_url":"https://github.com/kimtree","followers_url":"https://api.github.com/users/kimtree/followers","following_url":"https://api.github.com/users/kimtree/following{/other_user}","gists_url":"https://api.github.com/users/kimtree/gists{/gist_id}","starred_url":"https://api.github.com/users/kimtree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimtree/subscriptions","organizations_url":"https://api.github.com/users/kimtree/orgs","repos_url":"https://api.github.com/users/kimtree/repos","events_url":"https://api.github.com/users/kimtree/events{/privacy}","received_events_url":"https://api.github.com/users/kimtree/received_events","type":"User","site_admin":false},"body":"get_by_facebook_id","created_at":"2017-07-30T07:03:01Z","updated_at":"2017-07-30T07:18:09Z","html_url":"https://github.com/storiwaterboy/simfle/pull/1#discussion_r130234879","pull_request_url":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/storiwaterboy/simfle/pulls/comments/130234879"},"html":{"href":"https://github.com/storiwaterboy/simfle/pull/1#discussion_r130234879"},"pull_request":{"href":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1","id":133088695,"html_url":"https://github.com/storiwaterboy/simfle/pull/1","diff_url":"https://github.com/storiwaterboy/simfle/pull/1.diff","patch_url":"https://github.com/storiwaterboy/simfle/pull/1.patch","issue_url":"https://api.github.com/repos/storiwaterboy/simfle/issues/1","number":1,"state":"open","locked":false,"title":"feature/user","user":{"login":"hiel","id":1549263,"avatar_url":"https://avatars0.githubusercontent.com/u/1549263?v=4","gravatar_id":"","url":"https://api.github.com/users/hiel","html_url":"https://github.com/hiel","followers_url":"https://api.github.com/users/hiel/followers","following_url":"https://api.github.com/users/hiel/following{/other_user}","gists_url":"https://api.github.com/users/hiel/gists{/gist_id}","starred_url":"https://api.github.com/users/hiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hiel/subscriptions","organizations_url":"https://api.github.com/users/hiel/orgs","repos_url":"https://api.github.com/users/hiel/repos","events_url":"https://api.github.com/users/hiel/events{/privacy}","received_events_url":"https://api.github.com/users/hiel/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-29T10:39:41Z","updated_at":"2017-07-30T07:18:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5131d40158168e668855c4b175513710313250b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1/commits","review_comments_url":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1/comments","review_comment_url":"https://api.github.com/repos/storiwaterboy/simfle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/storiwaterboy/simfle/issues/1/comments","statuses_url":"https://api.github.com/repos/storiwaterboy/simfle/statuses/2280a34b2c68c9afa14e1ec2edaeb27f9f08b354","head":{"label":"storiwaterboy:feature/user","ref":"feature/user","sha":"2280a34b2c68c9afa14e1ec2edaeb27f9f08b354","user":{"login":"storiwaterboy","id":8760872,"avatar_url":"https://avatars2.githubusercontent.com/u/8760872?v=4","gravatar_id":"","url":"https://api.github.com/users/storiwaterboy","html_url":"https://github.com/storiwaterboy","followers_url":"https://api.github.com/users/storiwaterboy/followers","following_url":"https://api.github.com/users/storiwaterboy/following{/other_user}","gists_url":"https://api.github.com/users/storiwaterboy/gists{/gist_id}","starred_url":"https://api.github.com/users/storiwaterboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storiwaterboy/subscriptions","organizations_url":"https://api.github.com/users/storiwaterboy/orgs","repos_url":"https://api.github.com/users/storiwaterboy/repos","events_url":"https://api.github.com/users/storiwaterboy/events{/privacy}","received_events_url":"https://api.github.com/users/storiwaterboy/received_events","type":"User","site_admin":false},"repo":{"id":98632396,"name":"simfle","full_name":"storiwaterboy/simfle","owner":{"login":"storiwaterboy","id":8760872,"avatar_url":"https://avatars2.githubusercontent.com/u/8760872?v=4","gravatar_id":"","url":"https://api.github.com/users/storiwaterboy","html_url":"https://github.com/storiwaterboy","followers_url":"https://api.github.com/users/storiwaterboy/followers","following_url":"https://api.github.com/users/storiwaterboy/following{/other_user}","gists_url":"https://api.github.com/users/storiwaterboy/gists{/gist_id}","starred_url":"https://api.github.com/users/storiwaterboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storiwaterboy/subscriptions","organizations_url":"https://api.github.com/users/storiwaterboy/orgs","repos_url":"https://api.github.com/users/storiwaterboy/repos","events_url":"https://api.github.com/users/storiwaterboy/events{/privacy}","received_events_url":"https://api.github.com/users/storiwaterboy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/storiwaterboy/simfle","description":null,"fork":false,"url":"https://api.github.com/repos/storiwaterboy/simfle","forks_url":"https://api.github.com/repos/storiwaterboy/simfle/forks","keys_url":"https://api.github.com/repos/storiwaterboy/simfle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storiwaterboy/simfle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storiwaterboy/simfle/teams","hooks_url":"https://api.github.com/repos/storiwaterboy/simfle/hooks","issue_events_url":"https://api.github.com/repos/storiwaterboy/simfle/issues/events{/number}","events_url":"https://api.github.com/repos/storiwaterboy/simfle/events","assignees_url":"https://api.github.com/repos/storiwaterboy/simfle/assignees{/user}","branches_url":"https://api.github.com/repos/storiwaterboy/simfle/branches{/branch}","tags_url":"https://api.github.com/repos/storiwaterboy/simfle/tags","blobs_url":"https://api.github.com/repos/storiwaterboy/simfle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storiwaterboy/simfle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storiwaterboy/simfle/git/refs{/sha}","trees_url":"https://api.github.com/repos/storiwaterboy/simfle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storiwaterboy/simfle/statuses/{sha}","languages_url":"https://api.github.com/repos/storiwaterboy/simfle/languages","stargazers_url":"https://api.github.com/repos/storiwaterboy/simfle/stargazers","contributors_url":"https://api.github.com/repos/storiwaterboy/simfle/contributors","subscribers_url":"https://api.github.com/repos/storiwaterboy/simfle/subscribers","subscription_url":"https://api.github.com/repos/storiwaterboy/simfle/subscription","commits_url":"https://api.github.com/repos/storiwaterboy/simfle/commits{/sha}","git_commits_url":"https://api.github.com/repos/storiwaterboy/simfle/git/commits{/sha}","comments_url":"https://api.github.com/repos/storiwaterboy/simfle/comments{/number}","issue_comment_url":"https://api.github.com/repos/storiwaterboy/simfle/issues/comments{/number}","contents_url":"https://api.github.com/repos/storiwaterboy/simfle/contents/{+path}","compare_url":"https://api.github.com/repos/storiwaterboy/simfle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storiwaterboy/simfle/merges","archive_url":"https://api.github.com/repos/storiwaterboy/simfle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storiwaterboy/simfle/downloads","issues_url":"https://api.github.com/repos/storiwaterboy/simfle/issues{/number}","pulls_url":"https://api.github.com/repos/storiwaterboy/simfle/pulls{/number}","milestones_url":"https://api.github.com/repos/storiwaterboy/simfle/milestones{/number}","notifications_url":"https://api.github.com/repos/storiwaterboy/simfle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storiwaterboy/simfle/labels{/name}","releases_url":"https://api.github.com/repos/storiwaterboy/simfle/releases{/id}","deployments_url":"https://api.github.com/repos/storiwaterboy/simfle/deployments","created_at":"2017-07-28T09:17:06Z","updated_at":"2017-07-28T09:33:40Z","pushed_at":"2017-07-30T06:42:40Z","git_url":"git://github.com/storiwaterboy/simfle.git","ssh_url":"git@github.com:storiwaterboy/simfle.git","clone_url":"https://github.com/storiwaterboy/simfle.git","svn_url":"https://github.com/storiwaterboy/simfle","homepage":null,"size":1516,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"storiwaterboy:master","ref":"master","sha":"7d2b80d184d5a4ab505ab242f6e7aa877ff37b88","user":{"login":"storiwaterboy","id":8760872,"avatar_url":"https://avatars2.githubusercontent.com/u/8760872?v=4","gravatar_id":"","url":"https://api.github.com/users/storiwaterboy","html_url":"https://github.com/storiwaterboy","followers_url":"https://api.github.com/users/storiwaterboy/followers","following_url":"https://api.github.com/users/storiwaterboy/following{/other_user}","gists_url":"https://api.github.com/users/storiwaterboy/gists{/gist_id}","starred_url":"https://api.github.com/users/storiwaterboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storiwaterboy/subscriptions","organizations_url":"https://api.github.com/users/storiwaterboy/orgs","repos_url":"https://api.github.com/users/storiwaterboy/repos","events_url":"https://api.github.com/users/storiwaterboy/events{/privacy}","received_events_url":"https://api.github.com/users/storiwaterboy/received_events","type":"User","site_admin":false},"repo":{"id":98632396,"name":"simfle","full_name":"storiwaterboy/simfle","owner":{"login":"storiwaterboy","id":8760872,"avatar_url":"https://avatars2.githubusercontent.com/u/8760872?v=4","gravatar_id":"","url":"https://api.github.com/users/storiwaterboy","html_url":"https://github.com/storiwaterboy","followers_url":"https://api.github.com/users/storiwaterboy/followers","following_url":"https://api.github.com/users/storiwaterboy/following{/other_user}","gists_url":"https://api.github.com/users/storiwaterboy/gists{/gist_id}","starred_url":"https://api.github.com/users/storiwaterboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storiwaterboy/subscriptions","organizations_url":"https://api.github.com/users/storiwaterboy/orgs","repos_url":"https://api.github.com/users/storiwaterboy/repos","events_url":"https://api.github.com/users/storiwaterboy/events{/privacy}","received_events_url":"https://api.github.com/users/storiwaterboy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/storiwaterboy/simfle","description":null,"fork":false,"url":"https://api.github.com/repos/storiwaterboy/simfle","forks_url":"https://api.github.com/repos/storiwaterboy/simfle/forks","keys_url":"https://api.github.com/repos/storiwaterboy/simfle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storiwaterboy/simfle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storiwaterboy/simfle/teams","hooks_url":"https://api.github.com/repos/storiwaterboy/simfle/hooks","issue_events_url":"https://api.github.com/repos/storiwaterboy/simfle/issues/events{/number}","events_url":"https://api.github.com/repos/storiwaterboy/simfle/events","assignees_url":"https://api.github.com/repos/storiwaterboy/simfle/assignees{/user}","branches_url":"https://api.github.com/repos/storiwaterboy/simfle/branches{/branch}","tags_url":"https://api.github.com/repos/storiwaterboy/simfle/tags","blobs_url":"https://api.github.com/repos/storiwaterboy/simfle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storiwaterboy/simfle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storiwaterboy/simfle/git/refs{/sha}","trees_url":"https://api.github.com/repos/storiwaterboy/simfle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storiwaterboy/simfle/statuses/{sha}","languages_url":"https://api.github.com/repos/storiwaterboy/simfle/languages","stargazers_url":"https://api.github.com/repos/storiwaterboy/simfle/stargazers","contributors_url":"https://api.github.com/repos/storiwaterboy/simfle/contributors","subscribers_url":"https://api.github.com/repos/storiwaterboy/simfle/subscribers","subscription_url":"https://api.github.com/repos/storiwaterboy/simfle/subscription","commits_url":"https://api.github.com/repos/storiwaterboy/simfle/commits{/sha}","git_commits_url":"https://api.github.com/repos/storiwaterboy/simfle/git/commits{/sha}","comments_url":"https://api.github.com/repos/storiwaterboy/simfle/comments{/number}","issue_comment_url":"https://api.github.com/repos/storiwaterboy/simfle/issues/comments{/number}","contents_url":"https://api.github.com/repos/storiwaterboy/simfle/contents/{+path}","compare_url":"https://api.github.com/repos/storiwaterboy/simfle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storiwaterboy/simfle/merges","archive_url":"https://api.github.com/repos/storiwaterboy/simfle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storiwaterboy/simfle/downloads","issues_url":"https://api.github.com/repos/storiwaterboy/simfle/issues{/number}","pulls_url":"https://api.github.com/repos/storiwaterboy/simfle/pulls{/number}","milestones_url":"https://api.github.com/repos/storiwaterboy/simfle/milestones{/number}","notifications_url":"https://api.github.com/repos/storiwaterboy/simfle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storiwaterboy/simfle/labels{/name}","releases_url":"https://api.github.com/repos/storiwaterboy/simfle/releases{/id}","deployments_url":"https://api.github.com/repos/storiwaterboy/simfle/deployments","created_at":"2017-07-28T09:17:06Z","updated_at":"2017-07-28T09:33:40Z","pushed_at":"2017-07-30T06:42:40Z","git_url":"git://github.com/storiwaterboy/simfle.git","ssh_url":"git@github.com:storiwaterboy/simfle.git","clone_url":"https://github.com/storiwaterboy/simfle.git","svn_url":"https://github.com/storiwaterboy/simfle","homepage":null,"size":1516,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1"},"html":{"href":"https://github.com/storiwaterboy/simfle/pull/1"},"issue":{"href":"https://api.github.com/repos/storiwaterboy/simfle/issues/1"},"comments":{"href":"https://api.github.com/repos/storiwaterboy/simfle/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/storiwaterboy/simfle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/storiwaterboy/simfle/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/storiwaterboy/simfle/statuses/2280a34b2c68c9afa14e1ec2edaeb27f9f08b354"}}}}
{"actor":{"display_login":"kimtree"}}