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 000000000..ba4c72724 Binary files /dev/null and b/client/src/img/auth0-logo.png differ