Merge branch 'develop'

This commit is contained in:
Luis Fernando Molina committed 2018-10-03 14:01:26 +02:00
commit 14bde55009
10 files changed
+85 -40

No files matched your search

+4 -1
View File
@@ -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
+1 -11
View File
@@ -90,17 +90,7 @@ class Home extends Component {
<Typography className={classes.typography} component='p'>
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.
</Typography>
<Typography className={classes.typography} gutterBottom variant='headline' component='h2'>
What is next?
</Typography>
<Typography className={classes.typography} component='p'>
The major features for the 3rd sprint are:
</Typography>
<ul>
<li>1. Managing profile images.</li>
<li>2. Making sure that Auth0 integration server side is working well.</li>
<li>3. Making sure that mutations can not be impersonated.</li>
</ul>
</Grid>
</Grid>
+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}>
+2 -13
View File
@@ -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 })
}
}
+30 -2
View File
@@ -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,6 +241,7 @@ class ProfileSheet extends Component {
componentWillMount () {
if (this.defaultValuesSet === false) {
let authId = localStorage.getItem('authId')
let userData = localStorage.getItem('loggedInUser')
if (userData === 'undefined') { return }
@@ -268,11 +270,37 @@ class ProfileSheet extends Component {
isDeveloper: user.isDeveloper,
isTrader: user.isTrader,
isDataAnalyst: user.isDataAnalyst,
roleId: user.role.id
roleId: user.role.id,
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]
switch (identityProvider) {
case 'github':
return (
<img className={classes.img} src={GithubLogo} alt='Github' />
)
break
case 'auth0':
return (
<img className={classes.img} src={Auth0Logo} alt='Auth0' />
)
break
default:
}
}
}
render () {
const { classes } = this.props
return (
@@ -288,7 +316,7 @@ class ProfileSheet extends Component {
<Grid container justify='center' >
<Grid item>
<img className={classes.img} src={GithubLogo} alt='Github' />
{this.displayIdentityProvider()}
</Grid>
</Grid>
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

+20 -10
View File
@@ -58,7 +58,17 @@ const Footer = ({ classes }) => {
</NavLink>
<NavLink to='/browse' className={classNames(classes.footerLink)}>
<Typography variant='subheading' color='textSecondary'>
Users
Browse
</Typography>
</NavLink>
<NavLink to='/search' className={classNames(classes.footerLink)}>
<Typography variant='subheading' color='textSecondary'>
Search
</Typography>
</NavLink>
<NavLink to='/contact' className={classNames(classes.footerLink)}>
<Typography variant='subheading' color='textSecondary'>
Contact
</Typography>
</NavLink>
<NavLink to='/about' className={classNames(classes.footerLink)}>
@@ -68,15 +78,11 @@ const Footer = ({ classes }) => {
</NavLink>
</Grid>
<Grid item xs>
<a
href='https://t.me/advancedalgoscommunity'
target='_blank>'
className={classNames(classes.footerLink)}
>
<Typography variant='title' color='textPrimary' gutterBottom>
<Typography variant='title' color='textPrimary' gutterBottom>
Support
</Typography>
</a>
<a
href='https://advancedalgos.net/documentation-quick-start.shtml'
target='_blank>'
@@ -86,11 +92,15 @@ const Footer = ({ classes }) => {
Documentation
</Typography>
</a>
<NavLink to='/' className={classNames(classes.footerLink)}>
<a
href='https://t.me/advancedalgoscommunity'
target='_blank>'
className={classNames(classes.footerLink)}
>
<Typography variant='subheading' color='textSecondary'>
Telegram
</Typography>
</NavLink>
</a>
</Grid>
<Grid item xs>
<Typography variant='title' color='textPrimary' gutterBottom>
+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) }