Tweak custom session

This commit is contained in:
Matthew Dillon 2015-10-13 10:31:47 -07:00
parent 1de25effb5
commit 45eca0227c
2 changed files with 14 additions and 16 deletions

12
app/sessions/custom.js Normal file
View file

@ -0,0 +1,12 @@
import Session from 'simple-auth/session';
import parseBase64 from '../utils/parse-base64';
export default Session.extend({
currentUser: function() {
let token = this.get('secure.token');
if (token && this.get('isAuthenticated')) {
let t = parseBase64(token);
return this._store.findRecord('user', t['sub']);
}
}.property('secure.token', 'isAuthenticated')
});