{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/tms_39/pulls/comments/43982668","id":43982668,"diff_hunk":"@@ -1,15 +1,45 @@\n class User < ActiveRecord::Base\n   VALID_EMAIL_REGEX = /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i\n-  has_many :activities, foreign_key: \"user_id\"\n-  has_many :usercourses, foreign_key: \"user_id\"\n-  has_many :courses, through: :usercourse\n-  has_many :usersubjects, foreign_key: \"user_id\"\n-  has_many :subjects, through: :usersubject\n+  attr_accessor :remember_token\n   validates :name, presence: true, length: { maximum: 50 }\n   validates :email, presence: true, length: { maximum: 255 },\n                     format: { with: VALID_EMAIL_REGEX },\n                     uniqueness: { case_sensitive: false }\n-  validates :password, presence: true, length: { minimum: 6 }\n+  validates :password, presence: true, length: { minimum: 6 }, allow_nil: true\n   has_secure_password\n   before_save { self.email = email.downcase }\n+  \n+  def User.digest(string)\n+    cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :\n+    BCrypt::Engine.cost\n+    BCrypt::Password.create(string, cost: cost)\n+  end\n+  \n+  def User.new_token\n+    SecureRandom.urlsafe_base64\n+  end\n+  \n+  def remember\n+    self.remember_token = User.new_token\n+    update_attribute(:remember_digest, User.digest(remember_token))\n+  end\n+  \n+  def authenticated?(attribute, token)\n+    digest = send(\"#{attribute}_digest\")\n+    return false if digest.nil?\n+    BCrypt::Password.new(digest).is_password?(token)\n+  end\n+  \n+  def forget\n+    update_attribute(:remember_digest, nil)\n+  end\n+\n+  private\n+\n+  def downcase_email\n+    self.email= email.downcase\n+  end\n+\n+>>>>>>> login logout","path":"app/models/user.rb","position":49,"original_position":49,"commit_id":"1e05e0c4ae3230af6b7f3e06e095f4ece3366aac","original_commit_id":"1e05e0c4ae3230af6b7f3e06e095f4ece3366aac","user":{"login":"chuanhtuan","id":5590771,"avatar_url":"https://avatars.githubusercontent.com/u/5590771?v=3","gravatar_id":"","url":"https://api.github.com/users/chuanhtuan","html_url":"https://github.com/chuanhtuan","followers_url":"https://api.github.com/users/chuanhtuan/followers","following_url":"https://api.github.com/users/chuanhtuan/following{/other_user}","gists_url":"https://api.github.com/users/chuanhtuan/gists{/gist_id}","starred_url":"https://api.github.com/users/chuanhtuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuanhtuan/subscriptions","organizations_url":"https://api.github.com/users/chuanhtuan/orgs","repos_url":"https://api.github.com/users/chuanhtuan/repos","events_url":"https://api.github.com/users/chuanhtuan/events{/privacy}","received_events_url":"https://api.github.com/users/chuanhtuan/received_events","type":"User","site_admin":false},"body":"?????","created_at":"2015-11-05T07:18:57Z","updated_at":"2015-11-05T07:18:57Z","html_url":"https://github.com/framgia/tms_39/pull/5#discussion_r43982668","pull_request_url":"https://api.github.com/repos/framgia/tms_39/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/comments/43982668"},"html":{"href":"https://github.com/framgia/tms_39/pull/5#discussion_r43982668"},"pull_request":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/tms_39/pulls/5","id":49785950,"html_url":"https://github.com/framgia/tms_39/pull/5","diff_url":"https://github.com/framgia/tms_39/pull/5.diff","patch_url":"https://github.com/framgia/tms_39/pull/5.patch","issue_url":"https://api.github.com/repos/framgia/tms_39/issues/5","number":5,"state":"open","locked":false,"title":"login logout","user":{"login":"huyhoang12","id":15138895,"avatar_url":"https://avatars.githubusercontent.com/u/15138895?v=3","gravatar_id":"","url":"https://api.github.com/users/huyhoang12","html_url":"https://github.com/huyhoang12","followers_url":"https://api.github.com/users/huyhoang12/followers","following_url":"https://api.github.com/users/huyhoang12/following{/other_user}","gists_url":"https://api.github.com/users/huyhoang12/gists{/gist_id}","starred_url":"https://api.github.com/users/huyhoang12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huyhoang12/subscriptions","organizations_url":"https://api.github.com/users/huyhoang12/orgs","repos_url":"https://api.github.com/users/huyhoang12/repos","events_url":"https://api.github.com/users/huyhoang12/events{/privacy}","received_events_url":"https://api.github.com/users/huyhoang12/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-05T06:08:14Z","updated_at":"2015-11-05T07:18:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77e7b1cfd9ae9a9426b02b1e27d6fdf6d2c1fee3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/tms_39/pulls/5/commits","review_comments_url":"https://api.github.com/repos/framgia/tms_39/pulls/5/comments","review_comment_url":"https://api.github.com/repos/framgia/tms_39/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/tms_39/issues/5/comments","statuses_url":"https://api.github.com/repos/framgia/tms_39/statuses/1e05e0c4ae3230af6b7f3e06e095f4ece3366aac","head":{"label":"huyhoang12:task_44267","ref":"task_44267","sha":"1e05e0c4ae3230af6b7f3e06e095f4ece3366aac","user":{"login":"huyhoang12","id":15138895,"avatar_url":"https://avatars.githubusercontent.com/u/15138895?v=3","gravatar_id":"","url":"https://api.github.com/users/huyhoang12","html_url":"https://github.com/huyhoang12","followers_url":"https://api.github.com/users/huyhoang12/followers","following_url":"https://api.github.com/users/huyhoang12/following{/other_user}","gists_url":"https://api.github.com/users/huyhoang12/gists{/gist_id}","starred_url":"https://api.github.com/users/huyhoang12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huyhoang12/subscriptions","organizations_url":"https://api.github.com/users/huyhoang12/orgs","repos_url":"https://api.github.com/users/huyhoang12/repos","events_url":"https://api.github.com/users/huyhoang12/events{/privacy}","received_events_url":"https://api.github.com/users/huyhoang12/received_events","type":"User","site_admin":false},"repo":{"id":45523079,"name":"tms_39","full_name":"huyhoang12/tms_39","owner":{"login":"huyhoang12","id":15138895,"avatar_url":"https://avatars.githubusercontent.com/u/15138895?v=3","gravatar_id":"","url":"https://api.github.com/users/huyhoang12","html_url":"https://github.com/huyhoang12","followers_url":"https://api.github.com/users/huyhoang12/followers","following_url":"https://api.github.com/users/huyhoang12/following{/other_user}","gists_url":"https://api.github.com/users/huyhoang12/gists{/gist_id}","starred_url":"https://api.github.com/users/huyhoang12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huyhoang12/subscriptions","organizations_url":"https://api.github.com/users/huyhoang12/orgs","repos_url":"https://api.github.com/users/huyhoang12/repos","events_url":"https://api.github.com/users/huyhoang12/events{/privacy}","received_events_url":"https://api.github.com/users/huyhoang12/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/huyhoang12/tms_39","description":"Framgia Training Management System (training)","fork":true,"url":"https://api.github.com/repos/huyhoang12/tms_39","forks_url":"https://api.github.com/repos/huyhoang12/tms_39/forks","keys_url":"https://api.github.com/repos/huyhoang12/tms_39/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huyhoang12/tms_39/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huyhoang12/tms_39/teams","hooks_url":"https://api.github.com/repos/huyhoang12/tms_39/hooks","issue_events_url":"https://api.github.com/repos/huyhoang12/tms_39/issues/events{/number}","events_url":"https://api.github.com/repos/huyhoang12/tms_39/events","assignees_url":"https://api.github.com/repos/huyhoang12/tms_39/assignees{/user}","branches_url":"https://api.github.com/repos/huyhoang12/tms_39/branches{/branch}","tags_url":"https://api.github.com/repos/huyhoang12/tms_39/tags","blobs_url":"https://api.github.com/repos/huyhoang12/tms_39/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huyhoang12/tms_39/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huyhoang12/tms_39/git/refs{/sha}","trees_url":"https://api.github.com/repos/huyhoang12/tms_39/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huyhoang12/tms_39/statuses/{sha}","languages_url":"https://api.github.com/repos/huyhoang12/tms_39/languages","stargazers_url":"https://api.github.com/repos/huyhoang12/tms_39/stargazers","contributors_url":"https://api.github.com/repos/huyhoang12/tms_39/contributors","subscribers_url":"https://api.github.com/repos/huyhoang12/tms_39/subscribers","subscription_url":"https://api.github.com/repos/huyhoang12/tms_39/subscription","commits_url":"https://api.github.com/repos/huyhoang12/tms_39/commits{/sha}","git_commits_url":"https://api.github.com/repos/huyhoang12/tms_39/git/commits{/sha}","comments_url":"https://api.github.com/repos/huyhoang12/tms_39/comments{/number}","issue_comment_url":"https://api.github.com/repos/huyhoang12/tms_39/issues/comments{/number}","contents_url":"https://api.github.com/repos/huyhoang12/tms_39/contents/{+path}","compare_url":"https://api.github.com/repos/huyhoang12/tms_39/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huyhoang12/tms_39/merges","archive_url":"https://api.github.com/repos/huyhoang12/tms_39/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huyhoang12/tms_39/downloads","issues_url":"https://api.github.com/repos/huyhoang12/tms_39/issues{/number}","pulls_url":"https://api.github.com/repos/huyhoang12/tms_39/pulls{/number}","milestones_url":"https://api.github.com/repos/huyhoang12/tms_39/milestones{/number}","notifications_url":"https://api.github.com/repos/huyhoang12/tms_39/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huyhoang12/tms_39/labels{/name}","releases_url":"https://api.github.com/repos/huyhoang12/tms_39/releases{/id}","created_at":"2015-11-04T07:43:00Z","updated_at":"2015-11-04T02:44:50Z","pushed_at":"2015-11-05T07:13:49Z","git_url":"git://github.com/huyhoang12/tms_39.git","ssh_url":"git@github.com:huyhoang12/tms_39.git","clone_url":"https://github.com/huyhoang12/tms_39.git","svn_url":"https://github.com/huyhoang12/tms_39","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"c38d2b2269760b7ac2ac2886e352e2d31bda121b","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":45510870,"name":"tms_39","full_name":"framgia/tms_39","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/tms_39","description":"Framgia Training Management System (training)","fork":false,"url":"https://api.github.com/repos/framgia/tms_39","forks_url":"https://api.github.com/repos/framgia/tms_39/forks","keys_url":"https://api.github.com/repos/framgia/tms_39/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/tms_39/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/tms_39/teams","hooks_url":"https://api.github.com/repos/framgia/tms_39/hooks","issue_events_url":"https://api.github.com/repos/framgia/tms_39/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/tms_39/events","assignees_url":"https://api.github.com/repos/framgia/tms_39/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/tms_39/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/tms_39/tags","blobs_url":"https://api.github.com/repos/framgia/tms_39/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/tms_39/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/tms_39/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/tms_39/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/tms_39/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/tms_39/languages","stargazers_url":"https://api.github.com/repos/framgia/tms_39/stargazers","contributors_url":"https://api.github.com/repos/framgia/tms_39/contributors","subscribers_url":"https://api.github.com/repos/framgia/tms_39/subscribers","subscription_url":"https://api.github.com/repos/framgia/tms_39/subscription","commits_url":"https://api.github.com/repos/framgia/tms_39/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/tms_39/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/tms_39/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/tms_39/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/tms_39/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/tms_39/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/tms_39/merges","archive_url":"https://api.github.com/repos/framgia/tms_39/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/tms_39/downloads","issues_url":"https://api.github.com/repos/framgia/tms_39/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/tms_39/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/tms_39/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/tms_39/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/tms_39/labels{/name}","releases_url":"https://api.github.com/repos/framgia/tms_39/releases{/id}","created_at":"2015-11-04T02:44:50Z","updated_at":"2015-11-04T02:44:50Z","pushed_at":"2015-11-05T07:13:50Z","git_url":"git://github.com/framgia/tms_39.git","ssh_url":"git@github.com:framgia/tms_39.git","clone_url":"https://github.com/framgia/tms_39.git","svn_url":"https://github.com/framgia/tms_39","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/5"},"html":{"href":"https://github.com/framgia/tms_39/pull/5"},"issue":{"href":"https://api.github.com/repos/framgia/tms_39/issues/5"},"comments":{"href":"https://api.github.com/repos/framgia/tms_39/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/tms_39/statuses/1e05e0c4ae3230af6b7f3e06e095f4ece3366aac"}}}}