User for auth.user at local storage.

This commit is contained in:
Luis Fernando Molina committed 2018-09-11 08:51:03 +02:00
1 parent 42e95a3ee6
commit 8cb108161a
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -102,7 +102,7 @@ class Auth {
this.signinOrCreateAccount({ ...data })
this.cb(data)
console.log(authResult.idTokenPayload)
setItem('user', JSON.stringify(authResult.idTokenPayload))
setItem('auth.user', JSON.stringify(authResult.idTokenPayload))
if (window.location.href.includes(`callback`)) {
window.location.href = '/'
}
@@ -126,7 +126,7 @@ class Auth {
})
console.log('signinOrCreateAccount auth: ', await data)
setItem('user', JSON.stringify(data.data.authenticate))
setItem('auth.user', JSON.stringify(data.data.authenticate))
if (window.location.href.includes(`callback`)) {
window.location.href = '/'
} else {
@@ -143,7 +143,7 @@ class Auth {
removeItem('access_token')
removeItem('id_token')
removeItem('expires_at')
removeItem('user')
removeItem('auth.user')
removeItem('auth0.ssodata')
window.localStorage.clear()
deleteCookie('ajs_anonymous_id')
@@ -156,7 +156,7 @@ class Auth {
async isAuthenticated () {
// check session and run Auth0 SS0
const getUser = await getItem('user')
const getUser = await getItem('auth.user')
let user = JSON.parse(getUser)
if (validObject(user, 'exp') && new Date().getTime() < (user.exp * 1000)) {
@@ -168,7 +168,7 @@ class Auth {
const checkSSO = await this.checkSession()
.then(result => {
console.log('handleAuth.checksessions: ', result)
setItem('user', result.idTokenPayload.sub)
setItem('auth.user', result.idTokenPayload.sub)
// user confirmed, log into client
this.setSession(result)
return result.idTokenPayload
+1 -1
View File
@@ -50,7 +50,7 @@ class NavBar extends Component {
componentDidMount() {
const userStored = localStorage.getItem('user');
const userStored = localStorage.getItem('auth.user');
if (userStored !== null && userStored !== undefined && userStored !== 'undefined') {
const user = JSON.parse(userStored);