From 98da328b4752af6abbb06fe8cf2aacbe60c8aedb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 3 Oct 2018 13:06:33 +0200 Subject: [PATCH 1/3] Login by Auth0 email implemented --- client/src/components/LoggedInUser.js | 5 ++++- client/src/components/LoggedInUserMenu.js | 21 ++++++++++++++++++++- client/src/img/email.png | Bin 0 -> 472 bytes server/schema/schema.js | 5 ++++- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 client/src/img/email.png diff --git a/client/src/components/LoggedInUser.js b/client/src/components/LoggedInUser.js index 8c06db481..656b66927 100644 --- a/client/src/components/LoggedInUser.js +++ b/client/src/components/LoggedInUser.js @@ -30,9 +30,12 @@ class LoggedInUser extends Component { user.lastName !== '' ) { displayName = user.firstName + ' ' + user.lastName } + let authArray = this.props.authId.split('|') + let identityProvider = authArray[0] + return (
-

+

) } else { diff --git a/client/src/components/LoggedInUserMenu.js b/client/src/components/LoggedInUserMenu.js index 0f5032229..692af39ff 100644 --- a/client/src/components/LoggedInUserMenu.js +++ b/client/src/components/LoggedInUserMenu.js @@ -13,6 +13,7 @@ import MenuItem from '@material-ui/core/MenuItem' // Images import GithubLogo from '../img/github-head-negative.png' +import EmailIcon from '../img/email.png' import ProfileIcon from '@material-ui/icons/Person' import LogoutIcon from '@material-ui/icons/DirectionsWalk' @@ -39,6 +40,24 @@ class LoggedInUserMenu extends Component { } } + displayIdentityProvider () { + const { classes } = this.props + switch (this.props.identityProvider) { + case 'github': + return ( + Github + ) + break + case 'auth0': + return ( + Auth0 + ) + break + default: + + } + } + render () { const { classes } = this.props return ( @@ -59,7 +78,7 @@ class LoggedInUserMenu extends Component { }} color='inherit' > - Github + {this.displayIdentityProvider()} {this.props.menuLabel} diff --git a/client/src/img/email.png b/client/src/img/email.png new file mode 100644 index 0000000000000000000000000000000000000000..93b2edf0c9a4514dc08a87c9479df944e63f57da GIT binary patch literal 472 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8JTQDqT?Ea~4hLa$s}7S8+4*Lu22@77hk5t%xkR-b*V*&V*@++H;GUd02ENZ$_T z2?Ea3rp{1xmX>5W+ad6%h4XgMiMH%24nafi=0A;}na}JgQRM#;xa+I;rA1#`S2w(L zyfEFk_<8;MU~!fSMw|A{xZ$;Uuk1B8Mw{9GEju1)7IevJESdZH@bZX;PXa5e3dNlY zUH4B8;r=pt&i|f2L9#FS9U`-xo;AxwH!qtezOlsFEjU%>XU+A$ZvPZt2n*_N`LOTw zEN5VFsg}4#l%yn*gQu&X%Q~loCIGF^vP1v? literal 0 HcmV?d00001 diff --git a/server/schema/schema.js b/server/schema/schema.js index b85a5b5a6..1ef24b2ae 100644 --- a/server/schema/schema.js +++ b/server/schema/schema.js @@ -425,7 +425,10 @@ function authenticate (encodedToken, callBackFunction) { let authArray = authId.split('|') let socialAccountProvider = authArray[0] - if (socialAccountProvider !== 'github') { + if ( + socialAccountProvider !== 'github' && + socialAccountProvider !== 'auth0' + ) { if (global.ERROR_LOG === true) { console.log('[ERROR] ' + MODULE_NAME + ' -> authenticate -> onValidated -> onUserFound -> Social Account Provider not Supoorted. ') } if (global.ERROR_LOG === true) { console.log('[ERROR] ' + MODULE_NAME + ' -> authenticate -> onValidated -> onUserFound -> socialAccountProvider = ' + socialAccountProvider) } From c0a4ead100cda608f2c68e9ee8d951c1ed9c38b4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 3 Oct 2018 13:24:34 +0200 Subject: [PATCH 2/3] Auth0 Provider integrated at profile sheet --- client/src/components/ProfileSheet.js | 33 +++++++++++++++++++++++--- client/src/img/auth0-logo.png | Bin 0 -> 7493 bytes 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 client/src/img/auth0-logo.png diff --git a/client/src/components/ProfileSheet.js b/client/src/components/ProfileSheet.js index 20510a91b..f0f42299a 100644 --- a/client/src/components/ProfileSheet.js +++ b/client/src/components/ProfileSheet.js @@ -22,6 +22,7 @@ import Typography from '@material-ui/core/Typography' // Images import GithubLogo from '../img/github-logo.png' +import Auth0Logo from '../img/auth0-logo.png' import AALogo from '../img/aa-logo.png' const styles = theme => ({ @@ -240,13 +241,16 @@ class ProfileSheet extends Component { componentWillMount () { if (this.defaultValuesSet === false) { + let authUserData = localStorage.getItem('authUser') let userData = localStorage.getItem('loggedInUser') - if (userData === 'undefined') { return } + if (userData === 'undefined' || authUserData === 'undefined') { return } let user = JSON.parse(userData) this.defaultValuesSet = true + let authUser = JSON.parse(authUserData) + /* To avoid console warning, we need to take care of the fields that are null. */ if (user.firstName === null) { user.firstName = '' } @@ -268,11 +272,34 @@ class ProfileSheet extends Component { isDeveloper: user.isDeveloper, isTrader: user.isTrader, isDataAnalyst: user.isDataAnalyst, - roleId: user.role.id + roleId: user.role.id, + authId: authUser.authId }) } } + displayIdentityProvider () { + const { classes } = this.props + + let authArray = this.state.authId.split('|') + let identityProvider = authArray[0] + + switch (identityProvider) { + case 'github': + return ( + Github + ) + break + case 'auth0': + return ( + Auth0 + ) + break + default: + + } + } + render () { const { classes } = this.props return ( @@ -288,7 +315,7 @@ class ProfileSheet extends Component { - Github + {this.displayIdentityProvider()} diff --git a/client/src/img/auth0-logo.png b/client/src/img/auth0-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ba4c727240894f69ff5b506f7065e0b2520a1609 GIT binary patch literal 7493 zcmZ{Jby$?o_x7^nvb3;Bch}On$gZ$}N+Z(JCEX26Bi$)24IiYN1*J=3K~PFoL6DFX zQ262ZzxR*#n(LYKTr<~w=AJV%=XuVVcx_EpQet{y002O$uBNOD0N@DTzdI8V+}9s< zQyT6Cfz?x0Wx(CPQqotIao+-RS2OaumumlekmIiu0RYBGb!E7||LVb;fI>#wywQO* z@h)zVC`ujpFc(Vkk%CnT_(8eL)W=7e$+pkUd)fNAjhUGN=U!mLSCDxpZ^RcO0v%-~ z5Gx{_6;F*dwICJ5$%)OkvAamwFv;_iGjn_HcVEblE>FjKGBo|BO)ze-^DkN`;@v%G z!iV5L%rd3vvrD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p?N$FQY^skeV`DoyYgCU#_vvy+)DrI|3@b9r z&(~MIHj|@0%Uj&O`D-z6aX(M+!7u-ccr056jISWP7-z@wbxGg-E?M(8KadC~VW)-tHvSYIYp3Z4VgpYKM&~RN9j4vG9iqPbnC#puHF8aU30B0Yv&?Ok z{Wz5D1U${QCN-w+kCR0n0$y;K`M0Jo7emI%ZP^cFuV01adJ|}HT7vk!`}3Vg-2)Vu z3G+1GYFHjx(En6^!@FaZ|0C$$ZrGe>qYfskOIy5br%8)$f9B-$KmK{}jKNx@UZE&B zqXr#;gLp-je=9T+IjfhV>9aj3wa(K%`G zT=VFHI~Hj%2yl5tzE00q(~!uSx9kL}3_TiD&RD_J+;B9)A~Fo)0!x zBmL?2CCBKs23q)^y+?SK@AcASubr@|#ao6qQk$OG|BQ*v>rVU$z@%(V7UAs}f?ynf z=^$T8vt;)00fKga__tpq!t_WB{D*^*z@)8f;KyXf{SMaAYncCN_oz6pqYMfk_jUD4 zoM0x&m4bvLg1uiPPPZ&rvCgowQ}q1(y(E{nilMiSrMIn|wWsa90Ej_FWrRebLQrvi wsFa)-R8B%d2r4NDg?=xpDgA!{E^aoCb^-r?K+bzgrh5QDT}4y55n&PWfBTgQAOHXW literal 0 HcmV?d00001 From 8b2dc0b52e945373dc16e2f8c4c6af21b962682d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 3 Oct 2018 14:01:02 +0200 Subject: [PATCH 3/3] Login BUG fixed, both Github and Auth0 logins working well. --- client/src/auth/Auth.js | 5 +++- client/src/components/Home.js | 12 +------- client/src/components/NavBar.js | 15 ++-------- client/src/components/ProfileSheet.js | 41 ++++++++++++++------------- client/src/views/footer/index.js | 30 +++++++++++++------- 5 files changed, 48 insertions(+), 55 deletions(-) diff --git a/client/src/auth/Auth.js b/client/src/auth/Auth.js index 44488c4ef..4a62b8251 100644 --- a/client/src/auth/Auth.js +++ b/client/src/auth/Auth.js @@ -101,8 +101,9 @@ class Auth { this.signinOrCreateAccount({ ...data }) this.cb(data) - console.log(authResult.idTokenPayload) + console.log('idTokenPayload', authResult.idTokenPayload) setItem('authUser', JSON.stringify(authResult.idTokenPayload)) + setItem('authId', authResult.idTokenPayload.sub) if (window.location.href.includes(`callback`)) { window.location.href = '/' } @@ -127,6 +128,7 @@ class Auth { console.log('signinOrCreateAccount auth: ', await data) setItem('authUser', JSON.stringify(data.data.authenticate)) + setItem('authId', data.data.authenticate.authId) if (window.location.href.includes(`callback`)) { window.location.href = '/' } else { @@ -169,6 +171,7 @@ class Auth { .then(result => { console.log('handleAuth.checksessions: ', result) setItem('authUser', result.idTokenPayload.sub) + setItem('authId', result.idTokenPayload.sub) // user confirmed, log into client this.setSession(result) return result.idTokenPayload diff --git a/client/src/components/Home.js b/client/src/components/Home.js index 71dfc717b..9d3e35e6e 100644 --- a/client/src/components/Home.js +++ b/client/src/components/Home.js @@ -90,17 +90,7 @@ class Home extends Component { Currently you can use the Browse section to list all registered users. At the Search page you can searh for users by name. Clicking on View Profile you can see some more info about that user. You can signup with your Github account and manage your profile information while logged in. While loggedin, you can edit your profile info, define your referrer and view your descendants. You will find all features under develpment with a dialog indicating it is not ready. - - What is next? - - - The major features for the 3rd sprint are: - -
    -
  • 1. Managing profile images.
  • -
  • 2. Making sure that Auth0 integration server side is working well.
  • -
  • 3. Making sure that mutations can not be impersonated.
  • -
+ diff --git a/client/src/components/NavBar.js b/client/src/components/NavBar.js index 1853c20c2..ebd5ae5dd 100644 --- a/client/src/components/NavBar.js +++ b/client/src/components/NavBar.js @@ -56,20 +56,9 @@ class NavBar extends Component { } componentDidMount () { - const userStored = localStorage.getItem('authUser') - - if (userStored !== null && userStored !== undefined && userStored !== 'undefined') { - const user = JSON.parse(userStored) - - /* For some reason, the result of GraphQL some times varies, that is why I had to do the following hack. */ - - let authId - if (user.authId === undefined) { - authId = user.sub - } else { - authId = user.authId - } + const authId = localStorage.getItem('authId') + if (authId !== null && authId !== undefined && authId !== 'undefined') { this.setState({ authId: authId }) } } diff --git a/client/src/components/ProfileSheet.js b/client/src/components/ProfileSheet.js index f0f42299a..3e4b99539 100644 --- a/client/src/components/ProfileSheet.js +++ b/client/src/components/ProfileSheet.js @@ -241,16 +241,14 @@ class ProfileSheet extends Component { componentWillMount () { if (this.defaultValuesSet === false) { - let authUserData = localStorage.getItem('authUser') + let authId = localStorage.getItem('authId') let userData = localStorage.getItem('loggedInUser') - if (userData === 'undefined' || authUserData === 'undefined') { return } + if (userData === 'undefined') { return } let user = JSON.parse(userData) this.defaultValuesSet = true - let authUser = JSON.parse(authUserData) - /* To avoid console warning, we need to take care of the fields that are null. */ if (user.firstName === null) { user.firstName = '' } @@ -273,30 +271,33 @@ class ProfileSheet extends Component { isTrader: user.isTrader, isDataAnalyst: user.isDataAnalyst, roleId: user.role.id, - authId: authUser.authId + authId: authId }) } } displayIdentityProvider () { const { classes } = this.props + let authId = this.state.authId + console.log('state', this.state) + if (authId !== undefined) { + let authArray = this.state.authId.split('|') + let identityProvider = authArray[0] - let authArray = this.state.authId.split('|') - let identityProvider = authArray[0] - - switch (identityProvider) { - case 'github': - return ( - Github - ) - break - case 'auth0': - return ( - Auth0 - ) - break - default: + switch (identityProvider) { + case 'github': + return ( + Github + ) + break + case 'auth0': + return ( + Auth0 + ) + break + default: + } } } diff --git a/client/src/views/footer/index.js b/client/src/views/footer/index.js index 94fb59e20..dc9fd728f 100644 --- a/client/src/views/footer/index.js +++ b/client/src/views/footer/index.js @@ -58,7 +58,17 @@ const Footer = ({ classes }) => { - Users + Browse + + + + + Search + + + + + Contact @@ -68,15 +78,11 @@ const Footer = ({ classes }) => { - - + + Support - + { Documentation - + Telegram - +