Skip to content

Instantly share code, notes, and snippets.

@colinhoernig
Created May 20, 2015 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colinhoernig/59a0ff34539ea0cfc118 to your computer and use it in GitHub Desktop.
Save colinhoernig/59a0ff34539ea0cfc118 to your computer and use it in GitHub Desktop.
Custom Session Init for ember-simple-auth
import Ember from 'ember';
import Session from 'simple-auth/session';
var sessionWithUser = Session.extend({
user: function() {
var userId = this.get('user_id');
if (!Ember.isEmpty(userId)) {
return this.container.lookup('store:main').find('user', userId);
}
}.property('user_id')
});
export
default {
name: 'customize-session',
before: 'simple-auth',
initialize: function(container) {
container.register('session:custom', sessionWithUser);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment