diff --git a/app/ux/Auth0.js b/app/ux/Auth0.js index 786e5589..8a1d61d2 100644 --- a/app/ux/Auth0.js +++ b/app/ux/Auth0.js @@ -55,7 +55,7 @@ Ext.define('Rambox.ux.Auth0', { localStorage.setItem('profile', JSON.stringify(profile)); localStorage.setItem('id_token', authResult.idToken); - if ( !Ext.isEmpty(profile.user_metadata.services) ) { + if ( !Ext.isEmpty(profile.user_metadata) && !Ext.isEmpty(profile.user_metadata.services) ) { Ext.each(profile.user_metadata.services, function(s) { var service = Ext.create('Rambox.model.Service', s); service.save(); diff --git a/app/view/main/MainModel.js b/app/view/main/MainModel.js index 93dedde9..32350ee6 100644 --- a/app/view/main/MainModel.js +++ b/app/view/main/MainModel.js @@ -8,6 +8,6 @@ Ext.define('Rambox.view.main.MainModel', { name: 'Rambox' ,username: localStorage.getItem('profile') ? JSON.parse(localStorage.getItem('profile')).name : '' ,avatar: localStorage.getItem('profile') ? JSON.parse(localStorage.getItem('profile')).picture : '' - ,last_sync: localStorage.getItem('profile') && JSON.parse(localStorage.getItem('profile')).user_metadata.services_lastupdate ? new Date(JSON.parse(localStorage.getItem('profile')).user_metadata.services_lastupdate).toUTCString() : '' + ,last_sync: localStorage.getItem('profile') && JSON.parse(localStorage.getItem('profile')).user_metadata && JSON.parse(localStorage.getItem('profile')).user_metadata.services_lastupdate ? new Date(JSON.parse(localStorage.getItem('profile')).user_metadata.services_lastupdate).toUTCString() : '' } });