{"action":"created","comment":{"url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/comments/232286876","pull_request_review_id":173453759,"id":232286876,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjI4Njg3Ng==","diff_hunk":"@@ -0,0 +1,148 @@\n+import React, { Component } from 'react';\n+import { connect } from 'react-redux';\n+import { Redirect, Link } from 'react-router-dom';\n+import PropTypes from 'prop-types';\n+import validateInput from './validations';\n+import './login.scss';\n+import SocialButton from '../signup/social';\n+import Alert from '../notification/alert';\n+import { userLoginRequest } from '../../redux/actions/auth/login';\n+\n+export class LoginModal extends Component {\n+  constructor(props) {\n+    super(props);\n+    this.state = {\n+      email: '',\n+      password: '',\n+      errors: {},\n+      redirect: false,\n+      isAuthenticated: false\n+    };\n+    this.onChange = this.onChange.bind(this);\n+    this.onSubmit = this.onSubmit.bind(this);\n+  }\n+\n+  onSubmit(e) {\n+    e.preventDefault();\n+    const { errors } = validateInput(this.state);\n+    const { email, password } = this.state;\n+    if (errors.email || errors.password) {\n+      this.setState(() => ({\n+        errors\n+      }));\n+    } else {\n+      this.props.userLoginRequest({\n+        email,\n+        password\n+      });\n+      this.setState(() => ({\n+        isAuthenticated: true,\n+        redirect: true,\n+        errors: {},\n+      }));\n+    }\n+  }\n+\n+  onChange(e) {\n+    this.setState({ [e.target.name]: e.target.value });\n+  }\n+\n+  render() {","path":"src/components/login/LoginModal.jsx","position":50,"original_position":50,"commit_id":"70736f923a54669f81ecc92a23493d6becc2e022","original_commit_id":"70736f923a54669f81ecc92a23493d6becc2e022","user":{"login":"codeclimate[bot]","id":36754821,"node_id":"MDM6Qm90MzY3NTQ4MjE=","avatar_url":"https://avatars0.githubusercontent.com/in/9403?v=4","gravatar_id":"","url":"https://api.github.com/users/codeclimate%5Bbot%5D","html_url":"https://github.com/apps/codeclimate","followers_url":"https://api.github.com/users/codeclimate%5Bbot%5D/followers","following_url":"https://api.github.com/users/codeclimate%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/codeclimate%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/codeclimate%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeclimate%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/codeclimate%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/codeclimate%5Bbot%5D/repos","events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"Function `render` has 81 lines of code (exceeds 25 allowed). Consider refactoring.","created_at":"2018-11-09T15:15:06Z","updated_at":"2018-11-09T15:15:06Z","html_url":"https://github.com/andela/odin-ah-frontend/pull/9#discussion_r232286876","pull_request_url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/comments/232286876"},"html":{"href":"https://github.com/andela/odin-ah-frontend/pull/9#discussion_r232286876"},"pull_request":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9","id":227926928,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3OTI2OTI4","html_url":"https://github.com/andela/odin-ah-frontend/pull/9","diff_url":"https://github.com/andela/odin-ah-frontend/pull/9.diff","patch_url":"https://github.com/andela/odin-ah-frontend/pull/9.patch","issue_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues/9","number":9,"state":"open","locked":false,"title":"#160452435: Create login page","user":{"login":"uchemukolo","id":30410066,"node_id":"MDQ6VXNlcjMwNDEwMDY2","avatar_url":"https://avatars0.githubusercontent.com/u/30410066?v=4","gravatar_id":"","url":"https://api.github.com/users/uchemukolo","html_url":"https://github.com/uchemukolo","followers_url":"https://api.github.com/users/uchemukolo/followers","following_url":"https://api.github.com/users/uchemukolo/following{/other_user}","gists_url":"https://api.github.com/users/uchemukolo/gists{/gist_id}","starred_url":"https://api.github.com/users/uchemukolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uchemukolo/subscriptions","organizations_url":"https://api.github.com/users/uchemukolo/orgs","repos_url":"https://api.github.com/users/uchemukolo/repos","events_url":"https://api.github.com/users/uchemukolo/events{/privacy}","received_events_url":"https://api.github.com/users/uchemukolo/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\n- Display login modal\r\n- Added validations on the Login form\r\n- Consumed backend API for login an existing user\r\n\r\n#### Description of Task to be completed?\r\n- Add unit tests for the components created\r\n- Display alert to the user when an error during login\r\n- Close the modal box on successful login.\r\n- Redirect to Homepage after successful login\r\n- implement log out functionality\r\n\r\n\r\n#### How should this be manually tested?\r\n- Fetch and checkout to the branch\r\n```$xslt\r\n> git fetch\r\n> git checkout ft-160452435-user-login\r\n> npm install \r\n```\r\n- Rename the `.env.sample` file on the root directory of the cloned repo to `.env`. Uncomment and supply the following variable: `REACT_APP_HOST` which is the link to the frontend application; `REACT_APP_BASE_API_URL` which is the base URL for the backend api. For example, `https://odin-ah-backend-staging.herokuapp.com/api/v1`.\r\n- To run the test first start the frontend server.\r\n\r\n```$xslt \r\n> npm start\r\n```\r\nthen run\r\n```$xslt \r\n> npm run test\r\n```\r\n- Open http://localhost:3000 in your browser and click on the `Login `\r\n**Note**: Ensure to start the backend api server if `REACT_APP_BASE_API_URL` is pointing to your local machine.\r\n#### Any background context you want to provide?\r\n- N/A\r\n#### What are the relevant pivotal tracker stories?\r\n- [#160452435](https://www.pivotaltracker.com/story/show/160452435)\r\n#### Screenshots (if appropriate)\r\n![image](https://user-images.githubusercontent.com/30410066/47916330-1a2e9d00-dea6-11e8-950e-bd666f60e2f2.png)\r\n\r\n#### Questions:","created_at":"2018-11-02T12:49:39Z","updated_at":"2018-11-09T15:15:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3280a1bac21d25e9050bbc00446c8c0a88dff7e6","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hnobi","id":29021978,"node_id":"MDQ6VXNlcjI5MDIxOTc4","avatar_url":"https://avatars0.githubusercontent.com/u/29021978?v=4","gravatar_id":"","url":"https://api.github.com/users/hnobi","html_url":"https://github.com/hnobi","followers_url":"https://api.github.com/users/hnobi/followers","following_url":"https://api.github.com/users/hnobi/following{/other_user}","gists_url":"https://api.github.com/users/hnobi/gists{/gist_id}","starred_url":"https://api.github.com/users/hnobi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hnobi/subscriptions","organizations_url":"https://api.github.com/users/hnobi/orgs","repos_url":"https://api.github.com/users/hnobi/repos","events_url":"https://api.github.com/users/hnobi/events{/privacy}","received_events_url":"https://api.github.com/users/hnobi/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9/commits","review_comments_url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9/comments","review_comment_url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues/9/comments","statuses_url":"https://api.github.com/repos/andela/odin-ah-frontend/statuses/70736f923a54669f81ecc92a23493d6becc2e022","head":{"label":"andela:ft-160452435-user-login","ref":"ft-160452435-user-login","sha":"70736f923a54669f81ecc92a23493d6becc2e022","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":154684566,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ2ODQ1NjY=","name":"odin-ah-frontend","full_name":"andela/odin-ah-frontend","private":false,"owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/andela/odin-ah-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/andela/odin-ah-frontend","forks_url":"https://api.github.com/repos/andela/odin-ah-frontend/forks","keys_url":"https://api.github.com/repos/andela/odin-ah-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/odin-ah-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/odin-ah-frontend/teams","hooks_url":"https://api.github.com/repos/andela/odin-ah-frontend/hooks","issue_events_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/andela/odin-ah-frontend/events","assignees_url":"https://api.github.com/repos/andela/odin-ah-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/andela/odin-ah-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/andela/odin-ah-frontend/tags","blobs_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/odin-ah-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/odin-ah-frontend/languages","stargazers_url":"https://api.github.com/repos/andela/odin-ah-frontend/stargazers","contributors_url":"https://api.github.com/repos/andela/odin-ah-frontend/contributors","subscribers_url":"https://api.github.com/repos/andela/odin-ah-frontend/subscribers","subscription_url":"https://api.github.com/repos/andela/odin-ah-frontend/subscription","commits_url":"https://api.github.com/repos/andela/odin-ah-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/odin-ah-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/odin-ah-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/andela/odin-ah-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/odin-ah-frontend/merges","archive_url":"https://api.github.com/repos/andela/odin-ah-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/odin-ah-frontend/downloads","issues_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/odin-ah-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/odin-ah-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/odin-ah-frontend/labels{/name}","releases_url":"https://api.github.com/repos/andela/odin-ah-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/andela/odin-ah-frontend/deployments","created_at":"2018-10-25T14:22:59Z","updated_at":"2018-11-09T10:14:17Z","pushed_at":"2018-11-09T15:11:45Z","git_url":"git://github.com/andela/odin-ah-frontend.git","ssh_url":"git@github.com:andela/odin-ah-frontend.git","clone_url":"https://github.com/andela/odin-ah-frontend.git","svn_url":"https://github.com/andela/odin-ah-frontend","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"staging"}},"base":{"label":"andela:staging","ref":"staging","sha":"8945ebaf62388364e776bc68c5d4e9390c6e2220","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":154684566,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ2ODQ1NjY=","name":"odin-ah-frontend","full_name":"andela/odin-ah-frontend","private":false,"owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/andela/odin-ah-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/andela/odin-ah-frontend","forks_url":"https://api.github.com/repos/andela/odin-ah-frontend/forks","keys_url":"https://api.github.com/repos/andela/odin-ah-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/odin-ah-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/odin-ah-frontend/teams","hooks_url":"https://api.github.com/repos/andela/odin-ah-frontend/hooks","issue_events_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/andela/odin-ah-frontend/events","assignees_url":"https://api.github.com/repos/andela/odin-ah-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/andela/odin-ah-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/andela/odin-ah-frontend/tags","blobs_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/odin-ah-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/odin-ah-frontend/languages","stargazers_url":"https://api.github.com/repos/andela/odin-ah-frontend/stargazers","contributors_url":"https://api.github.com/repos/andela/odin-ah-frontend/contributors","subscribers_url":"https://api.github.com/repos/andela/odin-ah-frontend/subscribers","subscription_url":"https://api.github.com/repos/andela/odin-ah-frontend/subscription","commits_url":"https://api.github.com/repos/andela/odin-ah-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/odin-ah-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/odin-ah-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/odin-ah-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/andela/odin-ah-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/odin-ah-frontend/merges","archive_url":"https://api.github.com/repos/andela/odin-ah-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/odin-ah-frontend/downloads","issues_url":"https://api.github.com/repos/andela/odin-ah-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/andela/odin-ah-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/odin-ah-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/odin-ah-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/odin-ah-frontend/labels{/name}","releases_url":"https://api.github.com/repos/andela/odin-ah-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/andela/odin-ah-frontend/deployments","created_at":"2018-10-25T14:22:59Z","updated_at":"2018-11-09T10:14:17Z","pushed_at":"2018-11-09T15:11:45Z","git_url":"git://github.com/andela/odin-ah-frontend.git","ssh_url":"git@github.com:andela/odin-ah-frontend.git","clone_url":"https://github.com/andela/odin-ah-frontend.git","svn_url":"https://github.com/andela/odin-ah-frontend","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9"},"html":{"href":"https://github.com/andela/odin-ah-frontend/pull/9"},"issue":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/issues/9"},"comments":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/andela/odin-ah-frontend/statuses/70736f923a54669f81ecc92a23493d6becc2e022"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"codeclimate"}}