app/assets/javascripts/ember-auth/ember-auth.js in ember-auth-rails-3.5.0 vs app/assets/javascripts/ember-auth/ember-auth.js in ember-auth-rails-3.6.0
- old
+ new
@@ -5,10 +5,11 @@
evented = Em.Object.extend(Em.Evented);
window.Auth = evented.create({
authToken: null,
currentUserId: null,
+ currentUser: null,
jqxhr: null,
prevRoute: null,
signIn: function(data) {
var async,
_this = this;
@@ -21,12 +22,16 @@
}
return this.ajax(this.resolveUrl(Auth.Config.get('tokenCreateUrl')), 'POST', {
data: data,
async: async,
success: function(json, status, jqxhr) {
+ var model;
_this.set('authToken', json[Auth.Config.get('tokenKey')]);
_this.set('currentUserId', json[Auth.Config.get('idKey')]);
+ if (model = Auth.Config.get('userModel')) {
+ _this.set('currentUser', model.find(_this.get('currentUserId')));
+ }
_this.set('jqxhr', jqxhr);
return _this.trigger('signInSuccess');
},
error: function(jqxhr) {
_this.set('jqxhr', jqxhr);
@@ -114,9 +119,10 @@
Auth.Config = Em.Object.create({
tokenCreateUrl: null,
tokenDestroyUrl: null,
tokenKey: null,
idKey: null,
+ userModel: null,
baseUrl: null,
signInRoute: null,
signOutRoute: null,
authRedirect: false,
smartSignInRedirect: false,