ember-auth-source 7.1.3 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/dist/ember-auth.js +85 -37
  2. metadata +3 -3
data/dist/ember-auth.js CHANGED
@@ -21,13 +21,13 @@ set$(Em, 'Auth', get$(Em, 'Object').extend(get$(Em, 'Evented'), {
21
21
  return get$(get$(this, '_module'), 'syncEvent').apply(get$(this, '_module'), arguments);
22
22
  },
23
23
  ensurePromise: function (callback) {
24
- var cache$, deferred, ret;
24
+ var cache$, ret;
25
25
  if (null != (null != (cache$ = ret = callback()) ? get$(cache$, 'then') : void 0)) {
26
26
  return ret;
27
27
  } else {
28
- deferred = get$(Em, 'Deferred').create();
29
- deferred.resolve(deferred);
30
- return deferred;
28
+ return new (get$(get$(Em, 'RSVP'), 'Promise'))(function (resolve) {
29
+ return resolve();
30
+ });
31
31
  }
32
32
  },
33
33
  followPromise: function (ret, callback) {
@@ -41,17 +41,16 @@ set$(Em, 'Auth', get$(Em, 'Object').extend(get$(Em, 'Evented'), {
41
41
  });
42
42
  }
43
43
  },
44
- wrapDeferred: function (callback) {
45
- var deferred, reject, resolve;
46
- deferred = get$(Em, 'Deferred').create();
47
- resolve = function () {
48
- return deferred.resolve(deferred);
49
- };
50
- reject = function () {
51
- return deferred.reject(deferred);
52
- };
53
- callback(resolve, reject);
54
- return deferred;
44
+ wrapPromise: function (callback) {
45
+ var promise, rej, res;
46
+ res = null;
47
+ rej = null;
48
+ promise = new (get$(get$(Em, 'RSVP'), 'Promise'))(function (resolve, reject) {
49
+ res = resolve;
50
+ return rej = reject;
51
+ });
52
+ callback(res, rej);
53
+ return promise;
55
54
  },
56
55
  requestAdapter: 'jquery',
57
56
  responseAdapter: 'json',
@@ -78,13 +77,17 @@ set$(Em, 'Auth', get$(Em, 'Object').extend(get$(Em, 'Evented'), {
78
77
  rememberable: {
79
78
  tokenKey: null,
80
79
  period: 14,
81
- autoRecall: true
80
+ autoRecall: true,
81
+ endPoint: null
82
82
  },
83
83
  timeoutable: {
84
84
  period: 20,
85
85
  callback: null
86
86
  },
87
- urlAuthenticatable: { paramsKey: null }
87
+ urlAuthenticatable: {
88
+ paramsKey: null,
89
+ endPoint: null
90
+ }
88
91
  }));// Generated by EmberScript 0.0.7
89
92
  var get$ = Ember.get;
90
93
  var set$ = Ember.set;
@@ -105,19 +108,23 @@ set$(get$(Em, 'Auth'), 'Request', Ember.Object.extend({
105
108
  if (null != get$(get$(this, 'adapter'), 'syncEvent'))
106
109
  return get$(get$(this, 'adapter'), 'syncEvent').apply(get$(this, 'adapter'), arguments);
107
110
  },
108
- signIn: function (opts) {
111
+ signIn: function (url, opts) {
109
112
  var this$;
113
+ if (typeof opts === 'undefined') {
114
+ opts = url;
115
+ url = this.resolveUrl(get$(get$(this, 'auth'), 'signInEndPoint'));
116
+ }
110
117
  return get$(this, 'auth').ensurePromise((this$ = this, function () {
111
- var url;
112
- url = this$.resolveUrl(get$(get$(this$, 'auth'), 'signInEndPoint'));
113
118
  return get$(this$, 'adapter').signIn(url, get$(get$(this$, 'auth'), '_strategy').serialize(opts));
114
119
  }));
115
120
  },
116
- signOut: function (opts) {
121
+ signOut: function (url, opts) {
117
122
  var this$;
123
+ if (typeof opts === 'undefined') {
124
+ opts = url;
125
+ url = this.resolveUrl(get$(get$(this, 'auth'), 'signOutEndPoint'));
126
+ }
118
127
  return get$(this, 'auth').ensurePromise((this$ = this, function () {
119
- var url;
120
- url = this$.resolveUrl(get$(get$(this$, 'auth'), 'signOutEndPoint'));
121
128
  return get$(this$, 'adapter').signOut(url, get$(get$(this$, 'auth'), '_strategy').serialize(opts));
122
129
  }));
123
130
  },
@@ -451,9 +458,13 @@ set$(get$(Em, 'Auth'), 'Session', Ember.Object.extend({
451
458
  return get$(get$(this, 'adapter'), 'syncEvent').apply(get$(this, 'adapter'), arguments);
452
459
  },
453
460
  findUser: function () {
454
- var model, modelKey;
461
+ var cache$, model, modelKey, this$;
455
462
  if (get$(this, 'userId') && (modelKey = get$(get$(this, 'auth'), 'userModel')) && (model = Ember.get(modelKey)))
456
- return set$(this, 'user', model.find(get$(this, 'userId')));
463
+ if (null != (null != (cache$ = set$(this, 'user', model.find(get$(this, 'userId')))) ? get$(cache$, 'then') : void 0)) {
464
+ return model.find(get$(this, 'userId')).then((this$ = this, function (m) {
465
+ return set$(this$, 'user', m);
466
+ }));
467
+ }
457
468
  },
458
469
  start: function () {
459
470
  set$(this, 'signedIn', true);
@@ -857,6 +868,27 @@ set$(get$(get$(Em, 'Auth'), 'Module'), 'EmberModel', Ember.Object.extend({
857
868
  }));// Generated by EmberScript 0.0.7
858
869
  var get$ = Ember.get;
859
870
  var set$ = Ember.set;
871
+ set$(get$(get$(Em, 'Auth'), 'Module'), 'Epf', Ember.Object.extend({
872
+ init: function () {
873
+ return this.patch();
874
+ },
875
+ patch: function () {
876
+ var self;
877
+ self = this;
878
+ if ('undefined' !== typeof Ep && null != Ep && null != get$(Ep, 'RestAdapter'))
879
+ return get$(Ep, 'RestAdapter').reopen({
880
+ ajax: function (url, type, settings) {
881
+ settings || (settings = {});
882
+ set$(settings, 'url', url);
883
+ set$(settings, 'type', type);
884
+ set$(settings, 'context', this);
885
+ return get$(get$(self, 'auth'), '_request').send(settings);
886
+ }
887
+ });
888
+ }
889
+ }));// Generated by EmberScript 0.0.7
890
+ var get$ = Ember.get;
891
+ var set$ = Ember.set;
860
892
  set$(get$(get$(Em, 'Auth'), 'Module'), 'Rememberable', Ember.Object.extend({
861
893
  init: function () {
862
894
  null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'rememberable'));
@@ -877,17 +909,25 @@ set$(get$(get$(Em, 'Auth'), 'Module'), 'Rememberable', Ember.Object.extend({
877
909
  var this$;
878
910
  if (null == opts)
879
911
  opts = {};
880
- return get$(this, 'auth').wrapDeferred((this$ = this, function (resolve, reject) {
912
+ return get$(this, 'auth').wrapPromise((this$ = this, function (resolve, reject) {
881
913
  var token;
882
914
  if (!get$(get$(this$, 'auth'), 'signedIn') && (token = this$.retrieveToken())) {
883
915
  set$(this$, 'fromRecall', true);
884
916
  opts.data || (opts.data = {});
885
917
  get$(opts, 'data')[get$(get$(this$, 'config'), 'tokenKey')] = token;
886
- return get$(this$, 'auth').signIn(opts).then(function () {
887
- return resolve();
888
- }, function () {
889
- return resolve();
890
- });
918
+ if (null != get$(get$(this$, 'config'), 'endPoint')) {
919
+ return get$(this$, 'auth').signIn(get$(get$(this$, 'config'), 'endPoint'), opts).then(function () {
920
+ return resolve();
921
+ }, function () {
922
+ return resolve();
923
+ });
924
+ } else {
925
+ return get$(this$, 'auth').signIn(opts).then(function () {
926
+ return resolve();
927
+ }, function () {
928
+ return resolve();
929
+ });
930
+ }
891
931
  } else {
892
932
  return resolve();
893
933
  }
@@ -1258,18 +1298,26 @@ void function () {
1258
1298
  var this$;
1259
1299
  if (null == opts)
1260
1300
  opts = {};
1261
- return get$(this, 'auth').wrapDeferred((this$ = this, function (resolve, reject) {
1301
+ return get$(this, 'auth').wrapPromise((this$ = this, function (resolve, reject) {
1262
1302
  if (get$(get$(this$, 'auth'), 'signedIn'))
1263
1303
  return resolve();
1264
1304
  this$.canonicalizeParams();
1265
1305
  if ($.isEmptyObject(get$(this$, 'params')))
1266
1306
  return resolve();
1267
1307
  set$(opts, 'data', $.extend(true, get$(this$, 'params'), get$(opts, 'data') || {}));
1268
- return get$(this$, 'auth').signIn(opts).then(function () {
1269
- return resolve();
1270
- }, function () {
1271
- return resolve();
1272
- });
1308
+ if (null != get$(get$(this$, 'config'), 'endPoint')) {
1309
+ return get$(this$, 'auth').signIn(get$(get$(this$, 'config'), 'endPoint'), opts).then(function () {
1310
+ return resolve();
1311
+ }, function () {
1312
+ return resolve();
1313
+ });
1314
+ } else {
1315
+ return get$(this$, 'auth').signIn(opts).then(function () {
1316
+ return resolve();
1317
+ }, function () {
1318
+ return resolve();
1319
+ });
1320
+ }
1273
1321
  }));
1274
1322
  },
1275
1323
  retrieveParams: function () {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-auth-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.3
4
+ version: 7.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-28 00:00:00.000000000 Z
12
+ date: 2013-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ember-source
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  segments:
53
53
  - 0
54
- hash: -85182207
54
+ hash: 802230493
55
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements: