From 98da328b4752af6abbb06fe8cf2aacbe60c8aedb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 3 Oct 2018 13:06:33 +0200 Subject: [PATCH] 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) }