From db67d0b9eaf2d43664bf3becb8e7c85bd74ddf7f Mon Sep 17 00:00:00 2001 From: Segun Ola Date: Tue, 3 Oct 2017 19:26:36 +0100 Subject: [PATCH 1/6] chore(conflict): resolve conflicts --- client/actions/api.js | 2 +- server/bin/www.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/actions/api.js b/client/actions/api.js index 26f6329..6c0bcdb 100644 --- a/client/actions/api.js +++ b/client/actions/api.js @@ -1,7 +1,7 @@ let api = '/api/v1'; if (process.env.NODE_ENV === 'development') { - api = 'http://localhost:5000/api/v1'; + api = 'http://localhost:4000/api/v1'; } const API = api; diff --git a/server/bin/www.js b/server/bin/www.js index c7eb7a1..e936be2 100644 --- a/server/bin/www.js +++ b/server/bin/www.js @@ -2,7 +2,7 @@ import http from 'http'; import app from '../app'; -const port = parseInt(process.env.PORT, 10) || 5000; +const port = parseInt(process.env.PORT, 10) || 4000; const server = http.createServer(app); From b7dcda64a9692a0824534c0c3d79ceae3213b81f Mon Sep 17 00:00:00 2001 From: Segun Ola Date: Wed, 4 Oct 2017 09:00:49 +0100 Subject: [PATCH 2/6] add profile update component --- client/components/dashboard/UpdateProfile.js | 109 +++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 client/components/dashboard/UpdateProfile.js diff --git a/client/components/dashboard/UpdateProfile.js b/client/components/dashboard/UpdateProfile.js new file mode 100644 index 0000000..4a4a1e9 --- /dev/null +++ b/client/components/dashboard/UpdateProfile.js @@ -0,0 +1,109 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import { Col, Row } from 'react-materialize'; + +import Header from '../header/Header'; + +/** + * Component to update user profile + * @type {Object} + */ +class UpdateProfile extends Component { + /** + * constructs instance of Component + * @return {Object} JSX component + */ + constructor() { + super(); + this.handleSubmit = this.handleSubmit.bind(this); + } + /** + * handles form submission + * @param {Object} event DOM onSubmit event + * @return {mixed} sends a network request + */ + handleSubmit(event) { + event.preventDefault(); + } + + /** + * class method that renders a component to the DOM + * @return {Object} JSX element + */ + render() { + return ( +
+
+
+ + +
+
+
+ Update your profile information +
+
+ +
+
First Name:
+ +
+
+
Last Name:
+ +
+
+ Leave the password fields empty unless you actually want + to change your password +
+
+
Current Password:
+ +
+
+
New Password:
+ +
+
+ +
+
+ +
+
+
+ ); + } +} + +UpdateProfile.propTypes = { + user: PropTypes.object.isRequired, +}; + +const mapStateToProps = ({ authReducer }) => ({ + user: authReducer.user, +}); + +export default connect(mapStateToProps)(UpdateProfile); From 8a0b64bcb8050a2797503e621d7f9636a9f726ea Mon Sep 17 00:00:00 2001 From: Segun Ola Date: Wed, 4 Oct 2017 09:00:49 +0100 Subject: [PATCH 3/6] feature(profile): add profile update component --- client/components/dashboard/ProfileInfo.js | 8 +- client/components/dashboard/UpdateProfile.js | 109 +++++++++++++++++++ 2 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 client/components/dashboard/UpdateProfile.js diff --git a/client/components/dashboard/ProfileInfo.js b/client/components/dashboard/ProfileInfo.js index 9626485..64ef3a1 100644 --- a/client/components/dashboard/ProfileInfo.js +++ b/client/components/dashboard/ProfileInfo.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { Link } from 'react-router-dom'; import { Col, Icon } from 'react-materialize'; import imageFallback from '../../static/profile_image.png'; @@ -16,13 +17,12 @@ const ProfileInfo = props => ( - edit Edit Profile - + ); diff --git a/client/components/dashboard/UpdateProfile.js b/client/components/dashboard/UpdateProfile.js new file mode 100644 index 0000000..4a4a1e9 --- /dev/null +++ b/client/components/dashboard/UpdateProfile.js @@ -0,0 +1,109 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import { Col, Row } from 'react-materialize'; + +import Header from '../header/Header'; + +/** + * Component to update user profile + * @type {Object} + */ +class UpdateProfile extends Component { + /** + * constructs instance of Component + * @return {Object} JSX component + */ + constructor() { + super(); + this.handleSubmit = this.handleSubmit.bind(this); + } + /** + * handles form submission + * @param {Object} event DOM onSubmit event + * @return {mixed} sends a network request + */ + handleSubmit(event) { + event.preventDefault(); + } + + /** + * class method that renders a component to the DOM + * @return {Object} JSX element + */ + render() { + return ( +
+
+
+ + +
+
+
+ Update your profile information +
+
+ +
+
First Name:
+ +
+
+
Last Name:
+ +
+
+ Leave the password fields empty unless you actually want + to change your password +
+
+
Current Password:
+ +
+
+
New Password:
+ +
+
+ +
+
+ +
+
+
+ ); + } +} + +UpdateProfile.propTypes = { + user: PropTypes.object.isRequired, +}; + +const mapStateToProps = ({ authReducer }) => ({ + user: authReducer.user, +}); + +export default connect(mapStateToProps)(UpdateProfile); From dfedd135183945d193a3fcfc1f9ebdbe570ca9d8 Mon Sep 17 00:00:00 2001 From: Segun Ola Date: Wed, 4 Oct 2017 16:00:37 +0100 Subject: [PATCH 4/6] bug(google): temporarily disable react-google-login --- client/components/auth/Login.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/components/auth/Login.js b/client/components/auth/Login.js index 816fe1c..e3a489c 100644 --- a/client/components/auth/Login.js +++ b/client/components/auth/Login.js @@ -127,7 +127,7 @@ class Login extends Component { />
- Login with Google - + */}

Don't have an account? From 8c4d6604aa1a70a9b077f9175117921c4524f4d1 Mon Sep 17 00:00:00 2001 From: Segun Ola Date: Wed, 4 Oct 2017 16:00:37 +0100 Subject: [PATCH 5/6] bug(google): temporarily disable react-google-login --- client/components/auth/Login.js | 4 ++-- webpack.prod.config.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/components/auth/Login.js b/client/components/auth/Login.js index 816fe1c..e3a489c 100644 --- a/client/components/auth/Login.js +++ b/client/components/auth/Login.js @@ -127,7 +127,7 @@ class Login extends Component { />

- Login with Google - + */}

Don't have an account? diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 8bf84b0..13ee1e7 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -63,12 +63,12 @@ module.exports = { warnings: false } }), - new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify('production') - }, - GOOGLE_CLIENT_SECRET: JSON.stringify('VenazYqo1V-41a8pAocf7a9H'), - GOOGLE_CLIENT_ID: JSON.stringify('701806023399-vgqondt26qh10vcuei77r7nsbcd8oa8k.apps.googleusercontent.com') - }) + // new webpack.DefinePlugin({ + // 'process.env': { + // NODE_ENV: JSON.stringify('production') + // }, + // GOOGLE_CLIENT_SECRET: JSON.stringify('VenazYqo1V-41a8pAocf7a9H'), + // GOOGLE_CLIENT_ID: JSON.stringify('701806023399-vgqondt26qh10vcuei77r7nsbcd8oa8k.apps.googleusercontent.com') + // }) ], }; From d217a263e160b9b96f7d88ff5a407a14b89f3ecc Mon Sep 17 00:00:00 2001 From: Segun Ola Date: Thu, 19 Oct 2017 09:30:29 +0100 Subject: [PATCH 6/6] bug(authentication): fix issue with Authorization request header --- server/middleware/authentication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/authentication.js b/server/middleware/authentication.js index 37e50a2..aaf6079 100644 --- a/server/middleware/authentication.js +++ b/server/middleware/authentication.js @@ -11,7 +11,7 @@ dotenv.config(); */ const getToken = (req) => { const token = req.body.token || req.headers['x-access-token'] || - req.headers.Authorization.slice(7); + (req.headers.Authorization && req.headers.Authorization.slice(7)); return token; };