Login by Auth0 email implemented

This commit is contained in:
Luis Fernando Molina committed 2018-10-03 13:06:33 +02:00
1 parent 8f037f2fc7
commit 98da328b47
4 files changed
+28 -3

No files matched your search

+4 -1
View File
@@ -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 (
<div>
<p><LoggedInUserMenu menuLabel={displayName} /></p>
<p><LoggedInUserMenu menuLabel={displayName} identityProvider={identityProvider} /></p>
</div>
)
} else {
+20 -1
View File
@@ -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 (
<img className={classes.img} src={GithubLogo} alt='Github' />
)
break
case 'auth0':
return (
<img className={classes.img} src={EmailIcon} alt='Auth0' />
)
break
default:
}
}
render () {
const { classes } = this.props
return (
@@ -59,7 +78,7 @@ class LoggedInUserMenu extends Component {
}}
color='inherit'
>
<img className={classes.img} src={GithubLogo} alt='Github' />
{this.displayIdentityProvider()}
{this.props.menuLabel}
</Button>
<Menu id='render-props-menu' anchorEl={anchorEl} open={open} onClose={handleClose}>
Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

+4 -1
View File
@@ -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) }