ember-auth-source 4.1.4 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/dist/ember-auth.js +752 -438
- metadata +3 -3
data/dist/ember-auth.js
CHANGED
@@ -1,4 +1,406 @@
|
|
1
|
-
|
1
|
+
// Generated by EmberScript 0.0.7
|
2
|
+
var get$ = Ember.get;
|
3
|
+
var set$ = Ember.set;
|
4
|
+
set$(Em, 'Auth', get$(Em, 'Object').extend(get$(Em, 'Evented'), {
|
5
|
+
init: function () {
|
6
|
+
null != get$(this, '_request') || set$(this, '_request', get$(get$(Em, 'Auth'), 'Request').create({ auth: this }));
|
7
|
+
null != get$(this, '_response') || set$(this, '_response', get$(get$(Em, 'Auth'), 'Response').create({ auth: this }));
|
8
|
+
null != get$(this, '_strategy') || set$(this, '_strategy', get$(get$(Em, 'Auth'), 'Strategy').create({ auth: this }));
|
9
|
+
null != get$(this, '_session') || set$(this, '_session', get$(get$(Em, 'Auth'), 'Session').create({ auth: this }));
|
10
|
+
return null != get$(this, '_module') || set$(this, '_module', get$(get$(Em, 'Auth'), 'Module').create({ auth: this }));
|
11
|
+
},
|
12
|
+
requestAdapter: 'jquery',
|
13
|
+
responseAdapter: 'json',
|
14
|
+
strategyAdapter: 'token',
|
15
|
+
sessionAdapter: 'cookie',
|
16
|
+
modules: ['emberData'],
|
17
|
+
signInEndPoint: null,
|
18
|
+
signOutEndPoint: null,
|
19
|
+
baseUrl: null,
|
20
|
+
userModel: null,
|
21
|
+
tokenKey: null,
|
22
|
+
tokenIdKey: null,
|
23
|
+
tokenLocation: 'param',
|
24
|
+
tokenHeaderKey: null,
|
25
|
+
rememberable: {
|
26
|
+
tokenKey: null,
|
27
|
+
period: 14,
|
28
|
+
autoRecall: true
|
29
|
+
},
|
30
|
+
urlAuthenticatable: { paramsKey: null },
|
31
|
+
authRedirectable: { route: null },
|
32
|
+
actionRedirectable: {
|
33
|
+
signInRoute: false,
|
34
|
+
signOutRoute: false,
|
35
|
+
signInSmart: false,
|
36
|
+
signOutSmart: false,
|
37
|
+
signInBlacklist: [],
|
38
|
+
signOutBlacklist: []
|
39
|
+
}
|
40
|
+
}));// Generated by EmberScript 0.0.7
|
41
|
+
var get$ = Ember.get;
|
42
|
+
var set$ = Ember.set;
|
43
|
+
set$(get$(Em, 'Auth'), 'Request', Ember.Object.extend({
|
44
|
+
init: function () {
|
45
|
+
var adapter;
|
46
|
+
if (!(null != get$(this, 'adapter'))) {
|
47
|
+
adapter = get$(Em, 'String').classify(get$(get$(this, 'auth'), 'requestAdapter'));
|
48
|
+
if (null != get$(get$(Em, 'Auth'), 'Request')[adapter]) {
|
49
|
+
set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Request')[adapter].create({ auth: get$(this, 'auth') }));
|
50
|
+
} else {
|
51
|
+
throw 'Adapter not found: Em.Auth.Request.' + adapter;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return this.inject();
|
55
|
+
},
|
56
|
+
signIn: function (opts) {
|
57
|
+
return get$(this, 'adapter').signIn(this.resolveUrl(get$(get$(this, 'auth'), 'signInEndPoint')), opts);
|
58
|
+
},
|
59
|
+
signOut: function (opts) {
|
60
|
+
return get$(this, 'adapter').signOut(this.resolveUrl(get$(get$(this, 'auth'), 'signOutEndPoint')), opts);
|
61
|
+
},
|
62
|
+
send: function (opts) {
|
63
|
+
return get$(this, 'adapter').send(get$(get$(this, 'auth'), '_strategy').serialize(opts));
|
64
|
+
},
|
65
|
+
resolveUrl: function (path) {
|
66
|
+
var base;
|
67
|
+
base = get$(get$(this, 'auth'), 'baseUrl');
|
68
|
+
if (base && base[get$(base, 'length') - 1] === '/')
|
69
|
+
base = base.substr(0, get$(base, 'length') - 1);
|
70
|
+
if ((null != path ? path[0] : void 0) === '/')
|
71
|
+
path = path.substr(1, get$(path, 'length'));
|
72
|
+
return [
|
73
|
+
base,
|
74
|
+
path
|
75
|
+
].join('/');
|
76
|
+
},
|
77
|
+
inject: function () {
|
78
|
+
var this$, this$1, this$2;
|
79
|
+
return get$(this, 'auth').reopen({
|
80
|
+
signIn: (this$ = this, function (opts) {
|
81
|
+
return this$.signIn(opts);
|
82
|
+
}),
|
83
|
+
signOut: (this$1 = this, function (opts) {
|
84
|
+
return this$1.signOut(opts);
|
85
|
+
}),
|
86
|
+
send: (this$2 = this, function (opts) {
|
87
|
+
return this$2.send(opts);
|
88
|
+
})
|
89
|
+
});
|
90
|
+
}
|
91
|
+
}));// Generated by EmberScript 0.0.7
|
92
|
+
var get$ = Ember.get;
|
93
|
+
var set$ = Ember.set;
|
94
|
+
set$(get$(get$(Em, 'Auth'), 'Request'), 'Dummy', Ember.Object.extend({
|
95
|
+
signIn: function (url, opts) {
|
96
|
+
if (null == opts)
|
97
|
+
opts = {};
|
98
|
+
this.send(opts);
|
99
|
+
switch (get$(opts, 'status')) {
|
100
|
+
case 'success':
|
101
|
+
get$(this, 'auth').trigger('signInsuccess');
|
102
|
+
break;
|
103
|
+
case 'error':
|
104
|
+
get$(this, 'auth').trigger('signInError');
|
105
|
+
}
|
106
|
+
return get$(this, 'auth').trigger('signInComplete');
|
107
|
+
},
|
108
|
+
signOut: function (url, opts) {
|
109
|
+
if (null == opts)
|
110
|
+
opts = {};
|
111
|
+
this.send(opts);
|
112
|
+
switch (get$(opts, 'status')) {
|
113
|
+
case 'success':
|
114
|
+
get$(this, 'auth').trigger('signOutsuccess');
|
115
|
+
break;
|
116
|
+
case 'error':
|
117
|
+
get$(this, 'auth').trigger('signOutError');
|
118
|
+
}
|
119
|
+
return get$(this, 'auth').trigger('signOutComplete');
|
120
|
+
},
|
121
|
+
send: function (opts) {
|
122
|
+
if (null == opts)
|
123
|
+
opts = {};
|
124
|
+
return get$(get$(this, 'auth'), '_response').canonicalize(opts);
|
125
|
+
}
|
126
|
+
}));// Generated by EmberScript 0.0.7
|
127
|
+
void function () {
|
128
|
+
var $;
|
129
|
+
var get$ = Ember.get;
|
130
|
+
var set$ = Ember.set;
|
131
|
+
$ = jQuery;
|
132
|
+
set$(get$(get$(Em, 'Auth'), 'Request'), 'Jquery', Ember.Object.extend({
|
133
|
+
init: function () {
|
134
|
+
null != get$(this, 'jqxhr') || set$(this, 'jqxhr', null);
|
135
|
+
return this.inject();
|
136
|
+
},
|
137
|
+
signIn: function (url, opts) {
|
138
|
+
var this$, this$1, this$2;
|
139
|
+
if (null == opts)
|
140
|
+
opts = {};
|
141
|
+
return this.send($.extend(true, {
|
142
|
+
url: url,
|
143
|
+
type: 'POST'
|
144
|
+
}, opts)).done((this$ = this, function () {
|
145
|
+
return get$(this$, 'auth').trigger('signInSuccess');
|
146
|
+
})).fail((this$1 = this, function () {
|
147
|
+
return get$(this$1, 'auth').trigger('signInError');
|
148
|
+
})).always((this$2 = this, function () {
|
149
|
+
return get$(this$2, 'auth').trigger('signInComplete');
|
150
|
+
}));
|
151
|
+
},
|
152
|
+
signOut: function (url, opts) {
|
153
|
+
var this$, this$1, this$2;
|
154
|
+
if (null == opts)
|
155
|
+
opts = {};
|
156
|
+
return this.send($.extend(true, {
|
157
|
+
url: url,
|
158
|
+
type: 'DELETE'
|
159
|
+
}, opts)).done((this$ = this, function () {
|
160
|
+
return get$(this$, 'auth').trigger('signOutSuccess');
|
161
|
+
})).fail((this$1 = this, function () {
|
162
|
+
return get$(this$1, 'auth').trigger('signOutError');
|
163
|
+
})).always((this$2 = this, function () {
|
164
|
+
return get$(this$2, 'auth').trigger('signOutComplete');
|
165
|
+
}));
|
166
|
+
},
|
167
|
+
send: function (settings) {
|
168
|
+
var def, this$, this$1, this$2;
|
169
|
+
if (null == settings)
|
170
|
+
settings = {};
|
171
|
+
def = {};
|
172
|
+
set$(def, 'dataType', 'json');
|
173
|
+
if (get$(settings, 'data') && !(null != get$(settings, 'contentType')))
|
174
|
+
if ((null != get$(settings, 'type') ? get$(settings, 'type').toUpperCase() : void 0) !== 'GET') {
|
175
|
+
set$(def, 'contentType', 'application/json; charset=utf-8');
|
176
|
+
set$(settings, 'data', JSON.stringify(get$(settings, 'data')));
|
177
|
+
}
|
178
|
+
settings = $.extend(def, settings);
|
179
|
+
return $.ajax(settings).done((this$ = this, function (json, status, jqxhr) {
|
180
|
+
get$(get$(this$, 'auth'), '_response').canonicalize(json);
|
181
|
+
return set$(this$, 'jqxhr', jqxhr);
|
182
|
+
})).fail((this$1 = this, function (jqxhr) {
|
183
|
+
get$(get$(this$1, 'auth'), '_response').canonicalize(get$(jqxhr, 'responseText'));
|
184
|
+
return set$(this$1, 'jqxhr', jqxhr);
|
185
|
+
})).always((this$2 = this, function (jqxhr) {
|
186
|
+
return set$(this$2, 'jqxhr', jqxhr);
|
187
|
+
}));
|
188
|
+
},
|
189
|
+
inject: function () {
|
190
|
+
var this$;
|
191
|
+
return get$(this, 'auth').reopen({
|
192
|
+
jqxhr: Em.computed((this$ = this, function () {
|
193
|
+
return get$(this$, 'jqxhr');
|
194
|
+
})).property('_request.adapter.jqxhr')
|
195
|
+
});
|
196
|
+
}
|
197
|
+
}));
|
198
|
+
}.call(this);// Generated by EmberScript 0.0.7
|
199
|
+
var get$ = Ember.get;
|
200
|
+
var set$ = Ember.set;
|
201
|
+
set$(get$(Em, 'Auth'), 'Response', Ember.Object.extend({
|
202
|
+
init: function () {
|
203
|
+
var adapter;
|
204
|
+
null != get$(this, 'response') || set$(this, 'response', {});
|
205
|
+
if (!(null != get$(this, 'adapter'))) {
|
206
|
+
adapter = get$(Em, 'String').classify(get$(get$(this, 'auth'), 'responseAdapter'));
|
207
|
+
if (null != get$(get$(Em, 'Auth'), 'Response')[adapter]) {
|
208
|
+
set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Response')[adapter].create({ auth: get$(this, 'auth') }));
|
209
|
+
} else {
|
210
|
+
throw 'Adapter not found: Em.Auth.Response.' + adapter;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
return this.inject();
|
214
|
+
},
|
215
|
+
canonicalize: function (input) {
|
216
|
+
return set$(this, 'response', get$(this, 'adapter').canonicalize(input));
|
217
|
+
},
|
218
|
+
inject: function () {
|
219
|
+
var this$;
|
220
|
+
return get$(this, 'auth').reopen({
|
221
|
+
response: Em.computed((this$ = this, function () {
|
222
|
+
return get$(this$, 'response');
|
223
|
+
})).property('_response.response')
|
224
|
+
});
|
225
|
+
}
|
226
|
+
}));// Generated by EmberScript 0.0.7
|
227
|
+
var get$ = Ember.get;
|
228
|
+
var set$ = Ember.set;
|
229
|
+
set$(get$(get$(Em, 'Auth'), 'Response'), 'Dummy', Ember.Object.extend({
|
230
|
+
canonicalize: function (input) {
|
231
|
+
return input;
|
232
|
+
}
|
233
|
+
}));// Generated by EmberScript 0.0.7
|
234
|
+
var get$ = Ember.get;
|
235
|
+
var set$ = Ember.set;
|
236
|
+
set$(get$(get$(Em, 'Auth'), 'Response'), 'Json', Ember.Object.extend({
|
237
|
+
canonicalize: function (input) {
|
238
|
+
switch (typeof input) {
|
239
|
+
case 'object':
|
240
|
+
return input;
|
241
|
+
case 'string':
|
242
|
+
return JSON.parse(input);
|
243
|
+
default:
|
244
|
+
throw 'Invalid JSON format';
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}));// Generated by EmberScript 0.0.7
|
248
|
+
var get$ = Ember.get;
|
249
|
+
var set$ = Ember.set;
|
250
|
+
set$(get$(Em, 'Auth'), 'Strategy', Ember.Object.extend({
|
251
|
+
init: function () {
|
252
|
+
var adapter, this$;
|
253
|
+
if (!(null != get$(this, 'adapter'))) {
|
254
|
+
adapter = get$(Em, 'String').classify(get$(get$(this, 'auth'), 'strategyAdapter'));
|
255
|
+
if (null != get$(get$(Em, 'Auth'), 'Strategy')[adapter]) {
|
256
|
+
set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Strategy')[adapter].create({ auth: get$(this, 'auth') }));
|
257
|
+
} else {
|
258
|
+
throw 'Adapter not found: Em.Auth.Strategy.' + adapter;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
return get$(this, 'auth').on('signInSuccess', (this$ = this, function () {
|
262
|
+
return this$.deserialize();
|
263
|
+
}));
|
264
|
+
},
|
265
|
+
serialize: function (opts) {
|
266
|
+
return get$(this, 'adapter').serialize(opts);
|
267
|
+
},
|
268
|
+
deserialize: function () {
|
269
|
+
return get$(this, 'adapter').deserialize(get$(get$(this, 'auth'), 'response'));
|
270
|
+
}
|
271
|
+
}));// Generated by EmberScript 0.0.7
|
272
|
+
var get$ = Ember.get;
|
273
|
+
var set$ = Ember.set;
|
274
|
+
set$(get$(get$(Em, 'Auth'), 'Strategy'), 'Dummy', Ember.Object.extend({
|
275
|
+
serialize: function (opts) {
|
276
|
+
if (null == opts)
|
277
|
+
opts = {};
|
278
|
+
return opts;
|
279
|
+
},
|
280
|
+
deserialize: function (data) {
|
281
|
+
if (null == data)
|
282
|
+
data = {};
|
283
|
+
return function (accum$) {
|
284
|
+
var k, v;
|
285
|
+
for (k in data) {
|
286
|
+
v = data[k];
|
287
|
+
accum$.push(get$(this, 'auth').set(k, v));
|
288
|
+
}
|
289
|
+
return accum$;
|
290
|
+
}.call(this, []);
|
291
|
+
}
|
292
|
+
}));// Generated by EmberScript 0.0.7
|
293
|
+
var get$ = Ember.get;
|
294
|
+
var set$ = Ember.set;
|
295
|
+
set$(get$(get$(Em, 'Auth'), 'Strategy'), 'Token', Ember.Object.extend({
|
296
|
+
init: function () {
|
297
|
+
null != get$(this, 'authToken') || set$(this, 'authToken', null);
|
298
|
+
return this.inject();
|
299
|
+
},
|
300
|
+
serialize: function (opts) {
|
301
|
+
if (null == opts)
|
302
|
+
opts = {};
|
303
|
+
if (!get$(get$(this, 'auth'), 'signedIn'))
|
304
|
+
return opts;
|
305
|
+
switch (get$(get$(this, 'auth'), 'tokenLocation')) {
|
306
|
+
case 'param':
|
307
|
+
opts.data || (opts.data = {});
|
308
|
+
if (FormData && get$(opts, 'data') instanceof FormData) {
|
309
|
+
get$(opts, 'data').append(get$(get$(this, 'auth'), 'tokenKey'), get$(this, 'authToken'));
|
310
|
+
} else {
|
311
|
+
get$(opts, 'data')[get$(get$(this, 'auth'), 'tokenKey')] || (get$(opts, 'data')[get$(get$(this, 'auth'), 'tokenKey')] = get$(this, 'authToken'));
|
312
|
+
}
|
313
|
+
break;
|
314
|
+
case 'authHeader':
|
315
|
+
opts.headers || (opts.headers = {});
|
316
|
+
get$(opts, 'headers').Authorization || (get$(opts, 'headers').Authorization = '' + get$(get$(this, 'auth'), 'tokenHeaderKey') + ' ' + get$(this, 'authToken'));
|
317
|
+
break;
|
318
|
+
case 'customHeader':
|
319
|
+
opts.headers || (opts.headers = {});
|
320
|
+
get$(opts, 'headers')[get$(get$(this, 'auth'), 'tokenHeaderKey')] || (get$(opts, 'headers')[get$(get$(this, 'auth'), 'tokenHeaderKey')] = get$(this, 'authToken'));
|
321
|
+
}
|
322
|
+
return opts;
|
323
|
+
},
|
324
|
+
deserialize: function (data) {
|
325
|
+
if (null == data)
|
326
|
+
data = {};
|
327
|
+
set$(this, 'authToken', data[get$(get$(this, 'auth'), 'tokenKey')]);
|
328
|
+
if (get$(get$(this, 'auth'), 'tokenIdKey'))
|
329
|
+
return set$(get$(get$(this, 'auth'), '_session'), 'userId', data[get$(get$(this, 'auth'), 'tokenIdKey')]);
|
330
|
+
},
|
331
|
+
inject: function () {
|
332
|
+
var this$;
|
333
|
+
return get$(this, 'auth').reopen({
|
334
|
+
authToken: Em.computed((this$ = this, function () {
|
335
|
+
return get$(this$, 'authToken');
|
336
|
+
})).property('_strategy.adapter.authToken')
|
337
|
+
});
|
338
|
+
}
|
339
|
+
}));// Generated by EmberScript 0.0.7
|
340
|
+
var get$ = Ember.get;
|
341
|
+
var set$ = Ember.set;
|
342
|
+
set$(get$(Em, 'Auth'), 'Session', Ember.Object.extend({
|
343
|
+
init: function () {
|
344
|
+
var adapter, this$, this$1, this$2;
|
345
|
+
null != get$(this, 'signedIn') || set$(this, 'signedIn', false);
|
346
|
+
null != get$(this, 'userId') || set$(this, 'userId', null);
|
347
|
+
null != get$(this, 'user') || set$(this, 'user', null);
|
348
|
+
if (!(null != get$(this, 'adapter'))) {
|
349
|
+
adapter = get$(Em, 'String').classify(get$(get$(this, 'auth'), 'sessionAdapter'));
|
350
|
+
if (null != get$(get$(Em, 'Auth'), 'Session')[adapter]) {
|
351
|
+
set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Session')[adapter].create({ auth: get$(this, 'auth') }));
|
352
|
+
} else {
|
353
|
+
throw 'Adapter not found: Em.Auth.Session.' + adapter;
|
354
|
+
}
|
355
|
+
}
|
356
|
+
get$(this, 'auth').on('signInSuccess', (this$ = this, function () {
|
357
|
+
return this$.start();
|
358
|
+
}));
|
359
|
+
get$(this, 'auth').on('signInSuccess', (this$1 = this, function () {
|
360
|
+
return this$1.findUser();
|
361
|
+
}));
|
362
|
+
get$(this, 'auth').on('signOutSuccess', (this$2 = this, function () {
|
363
|
+
return this$2.clear();
|
364
|
+
}));
|
365
|
+
return this.inject();
|
366
|
+
},
|
367
|
+
findUser: function () {
|
368
|
+
var model;
|
369
|
+
if (get$(this, 'userId') && (model = get$(get$(this, 'auth'), 'userModel')))
|
370
|
+
return set$(this, 'user', model.find(get$(this, 'userId')));
|
371
|
+
},
|
372
|
+
start: function () {
|
373
|
+
return set$(this, 'signedIn', true);
|
374
|
+
},
|
375
|
+
clear: function () {
|
376
|
+
set$(this, 'signedIn', false);
|
377
|
+
set$(this, 'userId', null);
|
378
|
+
return set$(this, 'user', null);
|
379
|
+
},
|
380
|
+
retrieve: function (key, opts) {
|
381
|
+
return get$(this, 'adapter').retrieve(key, opts);
|
382
|
+
},
|
383
|
+
store: function (key, value, opts) {
|
384
|
+
return get$(this, 'adapter').store(key, value, opts);
|
385
|
+
},
|
386
|
+
remove: function (key, opts) {
|
387
|
+
return get$(this, 'adapter').remove(key, opts);
|
388
|
+
},
|
389
|
+
inject: function () {
|
390
|
+
var this$, this$1, this$2;
|
391
|
+
return get$(this, 'auth').reopen({
|
392
|
+
signedIn: Em.computed((this$ = this, function () {
|
393
|
+
return get$(this$, 'signedIn');
|
394
|
+
})).property('_session.signedIn'),
|
395
|
+
userId: Em.computed((this$1 = this, function () {
|
396
|
+
return get$(this$1, 'userId');
|
397
|
+
})).property('_session.userId'),
|
398
|
+
user: Em.computed((this$2 = this, function () {
|
399
|
+
return get$(this$2, 'user');
|
400
|
+
})).property('_session.user')
|
401
|
+
});
|
402
|
+
}
|
403
|
+
}));/*!
|
2
404
|
* jQuery Cookie Plugin v1.3.1
|
3
405
|
* https://github.com/carhartl/jquery-cookie
|
4
406
|
*
|
@@ -91,7 +493,308 @@
|
|
91
493
|
};
|
92
494
|
|
93
495
|
}));
|
94
|
-
|
496
|
+
// Generated by EmberScript 0.0.7
|
497
|
+
void function () {
|
498
|
+
var $;
|
499
|
+
var get$ = Ember.get;
|
500
|
+
var set$ = Ember.set;
|
501
|
+
$ = jQuery;
|
502
|
+
set$(get$(get$(Em, 'Auth'), 'Session'), 'Cookie', Ember.Object.extend({
|
503
|
+
retrieve: function (key, opts) {
|
504
|
+
return $.cookie(key);
|
505
|
+
},
|
506
|
+
store: function (key, value, opts) {
|
507
|
+
return $.cookie(key, value, $.extend(true, { path: '/' }, opts));
|
508
|
+
},
|
509
|
+
remove: function (key, opts) {
|
510
|
+
return $.removeCookie(key, $.extend(true, { path: '/' }, opts));
|
511
|
+
}
|
512
|
+
}));
|
513
|
+
}.call(this);// Generated by EmberScript 0.0.7
|
514
|
+
var get$ = Ember.get;
|
515
|
+
var set$ = Ember.set;
|
516
|
+
set$(get$(get$(Em, 'Auth'), 'Session'), 'Dummy', Ember.Object.extend({
|
517
|
+
init: function () {
|
518
|
+
return set$(this, 'session', {});
|
519
|
+
},
|
520
|
+
retrieve: function (key) {
|
521
|
+
return this.get('session.' + key);
|
522
|
+
},
|
523
|
+
store: function (key, value) {
|
524
|
+
return this.set('session.' + key, value);
|
525
|
+
},
|
526
|
+
remove: function (key) {
|
527
|
+
return delete get$(this, 'session')[key];
|
528
|
+
}
|
529
|
+
}));// Generated by EmberScript 0.0.7
|
530
|
+
var get$ = Ember.get;
|
531
|
+
var set$ = Ember.set;
|
532
|
+
set$(get$(get$(Em, 'Auth'), 'Session'), 'LocalStorage', Ember.Object.extend({
|
533
|
+
retrieve: function (key) {
|
534
|
+
return localStorage.getItem(key);
|
535
|
+
},
|
536
|
+
store: function (key, value) {
|
537
|
+
return localStorage.setItem(key, value);
|
538
|
+
},
|
539
|
+
remove: function (key) {
|
540
|
+
return localStorage.removeItem(key);
|
541
|
+
}
|
542
|
+
}));// Generated by EmberScript 0.0.7
|
543
|
+
var get$ = Ember.get;
|
544
|
+
var set$ = Ember.set;
|
545
|
+
set$(get$(Em, 'Auth'), 'Module', Ember.Object.extend({
|
546
|
+
init: function () {
|
547
|
+
var key, module;
|
548
|
+
if (!(null != get$(this, 'module'))) {
|
549
|
+
set$(this, 'module', {});
|
550
|
+
for (var i$ = 0, length$ = get$(get$(this, 'auth'), 'modules').length; i$ < length$; ++i$) {
|
551
|
+
key = get$(get$(this, 'auth'), 'modules')[i$];
|
552
|
+
key = get$(Em, 'String').camelize(key);
|
553
|
+
module = get$(Em, 'String').classify(key);
|
554
|
+
if (null != get$(get$(Em, 'Auth'), 'Module')[module]) {
|
555
|
+
this.set('module.' + key, get$(get$(Em, 'Auth'), 'Module')[module].create({ auth: get$(this, 'auth') }));
|
556
|
+
} else {
|
557
|
+
throw 'Module not found: Em.Auth.Module.' + module;
|
558
|
+
}
|
559
|
+
}
|
560
|
+
}
|
561
|
+
return this.inject();
|
562
|
+
},
|
563
|
+
inject: function () {
|
564
|
+
var this$;
|
565
|
+
return get$(this, 'auth').reopen({
|
566
|
+
module: Em.computed((this$ = this, function () {
|
567
|
+
return get$(this$, 'module');
|
568
|
+
})).property('_module.module')
|
569
|
+
});
|
570
|
+
}
|
571
|
+
}));// Generated by EmberScript 0.0.7
|
572
|
+
void function () {
|
573
|
+
var $;
|
574
|
+
var get$ = Ember.get;
|
575
|
+
var set$ = Ember.set;
|
576
|
+
$ = jQuery;
|
577
|
+
set$(get$(get$(Em, 'Auth'), 'Module'), 'ActionRedirectable', Ember.Object.extend({
|
578
|
+
init: function () {
|
579
|
+
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'actionRedirectable'));
|
580
|
+
null != get$(this, 'initPath') || set$(this, 'initPath', null);
|
581
|
+
null != get$(this, 'isInit') || set$(this, 'isInit', true);
|
582
|
+
null != get$(this, 'signInRedir') || set$(this, 'signInRedir', null);
|
583
|
+
null != get$(this, 'signOutRedir') || set$(this, 'signOutRedir', null);
|
584
|
+
null != get$(this, 'router') || set$(this, 'router', null);
|
585
|
+
return this.patch();
|
586
|
+
},
|
587
|
+
canonicalizeRoute: function (route) {
|
588
|
+
var endsWith;
|
589
|
+
if (!(typeof route === 'string'))
|
590
|
+
return '';
|
591
|
+
endsWith = function (haystack, needle) {
|
592
|
+
var d;
|
593
|
+
d = get$(haystack, 'length') - get$(needle, 'length');
|
594
|
+
return d >= 0 && haystack.lastIndexOf(needle) === d;
|
595
|
+
};
|
596
|
+
if (!endsWith(route, '.index'))
|
597
|
+
return route;
|
598
|
+
return route.substr(0, route.lastIndexOf('.index'));
|
599
|
+
},
|
600
|
+
getBlacklist: function (env) {
|
601
|
+
var blacklist;
|
602
|
+
if (!(blacklist = get$(this, 'config')['' + env + 'Blacklist']))
|
603
|
+
return [];
|
604
|
+
return function (accum$) {
|
605
|
+
var r;
|
606
|
+
for (var i$ = 0, length$ = blacklist.length; i$ < length$; ++i$) {
|
607
|
+
r = blacklist[i$];
|
608
|
+
accum$.push(this.canonicalizeRoute(r));
|
609
|
+
}
|
610
|
+
return accum$;
|
611
|
+
}.call(this, []);
|
612
|
+
},
|
613
|
+
resolveRedirect: function (env) {
|
614
|
+
var fallback, isSmart;
|
615
|
+
if (!(env === 'signIn' || env === 'signOut'))
|
616
|
+
return null;
|
617
|
+
isSmart = get$(this, 'config')['' + env + 'Smart'];
|
618
|
+
fallback = this.canonicalizeRoute(get$(this, 'config')['' + env + 'Route']);
|
619
|
+
if (!fallback)
|
620
|
+
return null;
|
621
|
+
if (!isSmart)
|
622
|
+
return [fallback];
|
623
|
+
return this.get('' + env + 'Redir') || get$(this, 'initPath');
|
624
|
+
},
|
625
|
+
registerInitRedirect: function (routeName) {
|
626
|
+
if (!get$(this, 'isInit'))
|
627
|
+
return;
|
628
|
+
routeName = this.canonicalizeRoute(routeName);
|
629
|
+
return function (accum$) {
|
630
|
+
var env;
|
631
|
+
for (var cache$ = [
|
632
|
+
'signIn',
|
633
|
+
'signOut'
|
634
|
+
], i$ = 0, length$ = cache$.length; i$ < length$; ++i$) {
|
635
|
+
env = cache$[i$];
|
636
|
+
this.set('' + env + 'Redir', null);
|
637
|
+
accum$.push($.inArray(routeName, this.getBlacklist(env)) !== -1 ? this.set('' + env + 'Redir', [get$(this, 'config')['' + env + 'Route']]) : void 0);
|
638
|
+
}
|
639
|
+
return accum$;
|
640
|
+
}.call(this, []);
|
641
|
+
},
|
642
|
+
registerRedirect: function (args) {
|
643
|
+
var routeName;
|
644
|
+
routeName = this.canonicalizeRoute(args[0]);
|
645
|
+
set$(this, 'isInit', false);
|
646
|
+
if ($.inArray(routeName, this.getBlacklist('signIn')) === -1)
|
647
|
+
set$(this, 'signInRedir', args);
|
648
|
+
if ($.inArray(routeName, this.getBlacklist('signOut')) === -1)
|
649
|
+
return set$(this, 'signOutRedir', args);
|
650
|
+
},
|
651
|
+
redirect: Ember.observer(function () {
|
652
|
+
var env, result;
|
653
|
+
env = get$(get$(this, 'auth'), 'signedIn') ? 'signIn' : 'signOut';
|
654
|
+
if (!(result = this.resolveRedirect(env)))
|
655
|
+
return;
|
656
|
+
switch (typeof result) {
|
657
|
+
case 'object':
|
658
|
+
return get$(get$(this, 'router'), 'transitionTo').apply(this, result);
|
659
|
+
case 'string':
|
660
|
+
get$(get$(this, 'router'), 'location').setURL(result);
|
661
|
+
return get$(this, 'router').handleURL(result);
|
662
|
+
}
|
663
|
+
}, 'auth.signedIn'),
|
664
|
+
patch: function () {
|
665
|
+
var self;
|
666
|
+
self = this;
|
667
|
+
get$(Em, 'Route').reopen({
|
668
|
+
activate: function () {
|
669
|
+
self.router || (self.router = get$(this, 'router'));
|
670
|
+
return self.registerInitRedirect(get$(this, 'routeName'));
|
671
|
+
}
|
672
|
+
});
|
673
|
+
return get$(Em, 'Router').reopen({
|
674
|
+
init: function () {
|
675
|
+
this._super.apply(this, arguments);
|
676
|
+
return self.initPath || (self.initPath = get$(this, 'location').getURL());
|
677
|
+
},
|
678
|
+
transitionTo: function () {
|
679
|
+
var args;
|
680
|
+
args = Array.prototype.slice.call(arguments);
|
681
|
+
self.registerRedirect(args);
|
682
|
+
return this._super.apply(this, args);
|
683
|
+
},
|
684
|
+
replaceWith: function () {
|
685
|
+
var args;
|
686
|
+
args = Array.prototype.slice.call(arguments);
|
687
|
+
self.registerRedirect(args);
|
688
|
+
return this._super.apply(this, args);
|
689
|
+
}
|
690
|
+
});
|
691
|
+
}
|
692
|
+
}));
|
693
|
+
}.call(this);// Generated by EmberScript 0.0.7
|
694
|
+
var get$ = Ember.get;
|
695
|
+
var set$ = Ember.set;
|
696
|
+
set$(get$(get$(Em, 'Auth'), 'Module'), 'AuthRedirectable', Ember.Object.extend({
|
697
|
+
init: function () {
|
698
|
+
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'authRedirectable'));
|
699
|
+
return this.patch();
|
700
|
+
},
|
701
|
+
patch: function () {
|
702
|
+
var self;
|
703
|
+
self = this;
|
704
|
+
set$(this, 'AuthRedirectable', Ember.Mixin.create({
|
705
|
+
redirect: function () {
|
706
|
+
if (!get$(get$(self, 'auth'), 'signedIn')) {
|
707
|
+
get$(self, 'auth').trigger('authAccess');
|
708
|
+
return this.transitionTo(get$(get$(self, 'config'), 'route'));
|
709
|
+
}
|
710
|
+
}
|
711
|
+
}));
|
712
|
+
return set$(get$(this, 'auth'), 'AuthRedirectable', get$(this, 'AuthRedirectable'));
|
713
|
+
}
|
714
|
+
}));// Generated by EmberScript 0.0.7
|
715
|
+
var get$ = Ember.get;
|
716
|
+
var set$ = Ember.set;
|
717
|
+
set$(get$(get$(Em, 'Auth'), 'Module'), 'EmberData', Ember.Object.extend({
|
718
|
+
init: function () {
|
719
|
+
return this.patch();
|
720
|
+
},
|
721
|
+
patch: function () {
|
722
|
+
var self;
|
723
|
+
self = this;
|
724
|
+
if ('undefined' !== typeof DS && null != DS && null != get$(DS, 'RESTAdapter'))
|
725
|
+
return get$(DS, 'RESTAdapter').reopen({
|
726
|
+
ajax: function (url, type, settings) {
|
727
|
+
settings || (settings = {});
|
728
|
+
set$(settings, 'url', url);
|
729
|
+
set$(settings, 'type', type);
|
730
|
+
set$(settings, 'context', this);
|
731
|
+
return get$(get$(self, 'auth'), '_request').send(settings);
|
732
|
+
}
|
733
|
+
});
|
734
|
+
}
|
735
|
+
}));// Generated by EmberScript 0.0.7
|
736
|
+
var get$ = Ember.get;
|
737
|
+
var set$ = Ember.set;
|
738
|
+
set$(get$(get$(Em, 'Auth'), 'Module'), 'Rememberable', Ember.Object.extend({
|
739
|
+
init: function () {
|
740
|
+
var this$, this$1, this$2;
|
741
|
+
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'rememberable'));
|
742
|
+
get$(this, 'auth').on('signInSuccess', (this$ = this, function () {
|
743
|
+
return this$.remember();
|
744
|
+
}));
|
745
|
+
get$(this, 'auth').on('signInError', (this$1 = this, function () {
|
746
|
+
return this$1.forget();
|
747
|
+
}));
|
748
|
+
get$(this, 'auth').on('signOutSuccess', (this$2 = this, function () {
|
749
|
+
return this$2.forget();
|
750
|
+
}));
|
751
|
+
return this.patch();
|
752
|
+
},
|
753
|
+
recall: function (opts) {
|
754
|
+
var token;
|
755
|
+
if (null == opts)
|
756
|
+
opts = {};
|
757
|
+
if (!get$(get$(this, 'auth'), 'signedIn') && (token = this.retrieveToken())) {
|
758
|
+
set$(this, 'fromRecall', true);
|
759
|
+
opts.data || (opts.data = {});
|
760
|
+
get$(opts, 'data')[get$(get$(this, 'config'), 'tokenKey')] = token;
|
761
|
+
return get$(this, 'auth').signIn(opts);
|
762
|
+
}
|
763
|
+
},
|
764
|
+
remember: function () {
|
765
|
+
var token;
|
766
|
+
if (token = null != get$(get$(this, 'auth'), 'response') ? get$(get$(this, 'auth'), 'response')[get$(get$(this, 'config'), 'tokenKey')] : void 0) {
|
767
|
+
if (!(token === this.retrieveToken())) {
|
768
|
+
this.storeToken(token);
|
769
|
+
}
|
770
|
+
} else if (!get$(this, 'fromRecall')) {
|
771
|
+
this.forget();
|
772
|
+
}
|
773
|
+
return set$(this, 'fromRecall', false);
|
774
|
+
},
|
775
|
+
forget: function () {
|
776
|
+
return this.removeToken();
|
777
|
+
},
|
778
|
+
retrieveToken: function () {
|
779
|
+
return get$(get$(this, 'auth'), '_session').retrieve('ember-auth-rememberable');
|
780
|
+
},
|
781
|
+
storeToken: function (token) {
|
782
|
+
return get$(get$(this, 'auth'), '_session').store('ember-auth-rememberable', token, { expires: get$(get$(this, 'config'), 'period') });
|
783
|
+
},
|
784
|
+
removeToken: function () {
|
785
|
+
return get$(get$(this, 'auth'), '_session').remove('ember-auth-rememberable');
|
786
|
+
},
|
787
|
+
patch: function () {
|
788
|
+
var self;
|
789
|
+
self = this;
|
790
|
+
return get$(Em, 'Route').reopen({
|
791
|
+
redirect: function () {
|
792
|
+
if (get$(get$(self, 'config'), 'autoRecall') && !get$(get$(self, 'auth'), 'signedIn'))
|
793
|
+
return self.recall({ async: false });
|
794
|
+
}
|
795
|
+
});
|
796
|
+
}
|
797
|
+
}));/*
|
95
798
|
* JQuery URL Parser plugin, v2.2.1
|
96
799
|
* Developed and maintanined by Mark Perkins, mark@allmarkedup.com
|
97
800
|
* Source repository: https://github.com/allmarkedup/jQuery-URL-Parser
|
@@ -363,431 +1066,43 @@
|
|
363
1066
|
|
364
1067
|
});
|
365
1068
|
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
jqxhr: null,
|
378
|
-
prevRoute: null,
|
379
|
-
json: null,
|
380
|
-
signIn: function(data) {
|
381
|
-
var async,
|
382
|
-
_this = this;
|
383
|
-
|
384
|
-
if (data == null) {
|
385
|
-
data = {};
|
386
|
-
}
|
387
|
-
async = data.async != null ? data.async : true;
|
388
|
-
if (data.async != null) {
|
389
|
-
delete data['async'];
|
390
|
-
}
|
391
|
-
return this.ajax({
|
392
|
-
url: this.resolveUrl(Auth.Config.get('tokenCreateUrl')),
|
393
|
-
type: 'POST',
|
394
|
-
data: data,
|
395
|
-
async: async
|
396
|
-
}).done(function(json, status, jqxhr) {
|
397
|
-
var model;
|
398
|
-
|
399
|
-
_this.set('authToken', json[Auth.Config.get('tokenKey')]);
|
400
|
-
_this.set('currentUserId', json[Auth.Config.get('idKey')]);
|
401
|
-
if (model = Auth.Config.get('userModel')) {
|
402
|
-
_this.set('currentUser', model.find(_this.get('currentUserId')));
|
403
|
-
}
|
404
|
-
_this.set('json', json);
|
405
|
-
_this.set('jqxhr', jqxhr);
|
406
|
-
return _this.trigger('signInSuccess');
|
407
|
-
}).fail(function(jqxhr) {
|
408
|
-
_this.set('jqxhr', jqxhr);
|
409
|
-
return _this.trigger('signInError');
|
410
|
-
}).always(function(jqxhr) {
|
411
|
-
_this.set('prevRoute', null);
|
412
|
-
_this.set('jqxhr', jqxhr);
|
413
|
-
return _this.trigger('signInComplete');
|
414
|
-
});
|
415
|
-
},
|
416
|
-
signOut: function(data) {
|
417
|
-
var async,
|
418
|
-
_this = this;
|
419
|
-
|
420
|
-
if (data == null) {
|
421
|
-
data = {};
|
422
|
-
}
|
423
|
-
data[Auth.Config.get('tokenKey')] = this.get('authToken');
|
424
|
-
async = data.async != null ? data.async : true;
|
425
|
-
if (data.async != null) {
|
426
|
-
delete data['async'];
|
427
|
-
}
|
428
|
-
return this.ajax({
|
429
|
-
url: this.resolveUrl(Auth.Config.get('tokenDestroyUrl')),
|
430
|
-
type: 'DELETE',
|
431
|
-
data: data,
|
432
|
-
async: async
|
433
|
-
}).done(function(json, status, jqxhr) {
|
434
|
-
_this.set('authToken', null);
|
435
|
-
_this.set('currentUserId', null);
|
436
|
-
_this.set('currentUser', null);
|
437
|
-
_this.set('jqxhr', jqxhr);
|
438
|
-
_this.set('json', json);
|
439
|
-
return _this.trigger('signOutSuccess');
|
440
|
-
}).fail(function(jqxhr) {
|
441
|
-
_this.set('jqxhr', jqxhr);
|
442
|
-
return _this.trigger('signOutError');
|
443
|
-
}).always(function(jqxhr) {
|
444
|
-
_this.set('prevRoute', null);
|
445
|
-
_this.set('jqxhr', jqxhr);
|
446
|
-
return _this.trigger('signOutComplete');
|
447
|
-
});
|
448
|
-
},
|
449
|
-
resolveUrl: function(path) {
|
450
|
-
var base;
|
451
|
-
|
452
|
-
base = Auth.Config.get('baseUrl');
|
453
|
-
if (base && base[base.length - 1] === '/') {
|
454
|
-
base = base.substr(0, base.length - 1);
|
455
|
-
}
|
456
|
-
if ((path != null ? path[0] : void 0) === '/') {
|
457
|
-
path = path.substr(1, path.length);
|
458
|
-
}
|
459
|
-
return [base, path].join('/');
|
460
|
-
},
|
461
|
-
resolveRedirectRoute: function(type) {
|
462
|
-
var fallback, isSmart, sameRoute, typeClassCase;
|
463
|
-
|
464
|
-
if (type !== 'signIn' && type !== 'signOut') {
|
465
|
-
return null;
|
466
|
-
}
|
467
|
-
typeClassCase = "" + (type[0].toUpperCase()) + (type.slice(1));
|
468
|
-
isSmart = Auth.Config.get("smart" + typeClassCase + "Redirect");
|
469
|
-
fallback = Auth.Config.get("" + type + "RedirectFallbackRoute");
|
470
|
-
sameRoute = Auth.Config.get("" + type + "Route");
|
471
|
-
if (!isSmart) {
|
472
|
-
return fallback;
|
473
|
-
}
|
474
|
-
if ((this.prevRoute == null) || this.prevRoute === sameRoute) {
|
475
|
-
return fallback;
|
476
|
-
} else {
|
477
|
-
return this.prevRoute;
|
478
|
-
}
|
479
|
-
},
|
480
|
-
ajax: function(settings) {
|
481
|
-
var data, def, e, token, _base, _base1, _base2, _name, _name1, _name2;
|
482
|
-
|
483
|
-
if (settings == null) {
|
484
|
-
settings = {};
|
485
|
-
}
|
486
|
-
def = {};
|
487
|
-
def.dataType = 'json';
|
488
|
-
if (settings.data && (settings.contentType == null) && settings.type !== 'GET') {
|
489
|
-
def.contentType = 'application/json; charset=utf-8';
|
490
|
-
settings.data = JSON.stringify(settings.data);
|
491
|
-
}
|
492
|
-
settings = jQuery.extend(def, settings);
|
493
|
-
if (token = this.get('authToken')) {
|
494
|
-
switch (Auth.Config.get('requestTokenLocation')) {
|
495
|
-
case 'param':
|
496
|
-
settings.data || (settings.data = {});
|
497
|
-
switch (typeof settings.data) {
|
498
|
-
case 'object':
|
499
|
-
(_base = settings.data)[_name = Auth.Config.get('tokenKey')] || (_base[_name] = this.get('authToken'));
|
500
|
-
break;
|
501
|
-
case 'string':
|
502
|
-
try {
|
503
|
-
data = JSON.parse(settings.data);
|
504
|
-
data[_name1 = Auth.Config.get('tokenKey')] || (data[_name1] = this.get('authToken'));
|
505
|
-
settings.data = JSON.stringify(data);
|
506
|
-
} catch (_error) {
|
507
|
-
e = _error;
|
508
|
-
}
|
509
|
-
}
|
510
|
-
break;
|
511
|
-
case 'authHeader':
|
512
|
-
settings.headers || (settings.headers = {});
|
513
|
-
(_base1 = settings.headers)['Authorization'] || (_base1['Authorization'] = "" + (Auth.Config.get('requestHeaderKey')) + " " + (this.get('authToken')));
|
514
|
-
break;
|
515
|
-
case 'customHeader':
|
516
|
-
settings.headers || (settings.headers = {});
|
517
|
-
(_base2 = settings.headers)[_name2 = Auth.Config.get('requestHeaderKey')] || (_base2[_name2] = this.get('authToken'));
|
518
|
-
}
|
519
|
-
}
|
520
|
-
return jQuery.ajax(settings);
|
521
|
-
}
|
522
|
-
});
|
523
|
-
|
524
|
-
}).call(this);
|
525
|
-
(function() {
|
526
|
-
Auth.Config = Em.Object.create({
|
527
|
-
tokenCreateUrl: null,
|
528
|
-
tokenDestroyUrl: null,
|
529
|
-
tokenKey: null,
|
530
|
-
idKey: null,
|
531
|
-
userModel: null,
|
532
|
-
baseUrl: null,
|
533
|
-
requestTokenLocation: 'param',
|
534
|
-
requestHeaderKey: null,
|
535
|
-
signInRoute: null,
|
536
|
-
signOutRoute: null,
|
537
|
-
authRedirect: false,
|
538
|
-
smartSignInRedirect: false,
|
539
|
-
smartSignOutRedirect: false,
|
540
|
-
signInRedirectFallbackRoute: 'index',
|
541
|
-
signOutRedirectFallbackRoute: 'index',
|
542
|
-
rememberMe: false,
|
543
|
-
rememberTokenKey: null,
|
544
|
-
rememberPeriod: 14,
|
545
|
-
rememberAutoRecall: true,
|
546
|
-
rememberAutoRecallRouteScope: 'auth',
|
547
|
-
rememberStorage: 'cookie',
|
548
|
-
urlAuthentication: false,
|
549
|
-
urlAuthenticationParamsKey: null,
|
550
|
-
urlAuthenticationRouteScope: 'auth'
|
551
|
-
});
|
552
|
-
|
553
|
-
}).call(this);
|
554
|
-
(function() {
|
555
|
-
Auth.Route = Em.Route.extend(Em.Evented, {
|
556
|
-
redirect: function() {
|
557
|
-
if (Auth.get('authToken')) {
|
558
|
-
return this._super.apply(this, arguments);
|
559
|
-
}
|
560
|
-
if (Auth.Config.get('urlAuthentication')) {
|
561
|
-
Auth.Module.UrlAuthentication.authenticate({
|
562
|
-
async: false
|
563
|
-
});
|
564
|
-
if (Auth.get('authToken')) {
|
565
|
-
return this._super.apply(this, arguments);
|
566
|
-
}
|
567
|
-
}
|
568
|
-
if (Auth.Config.get('rememberMe') && Auth.Config.get('rememberAutoRecall')) {
|
569
|
-
Auth.Module.RememberMe.recall({
|
570
|
-
async: false
|
571
|
-
});
|
572
|
-
if (Auth.get('authToken')) {
|
573
|
-
return this._super.apply(this, arguments);
|
574
|
-
}
|
575
|
-
}
|
576
|
-
this.trigger('authAccess');
|
577
|
-
if (Auth.Config.get('authRedirect')) {
|
578
|
-
Auth.set('prevRoute', this.routeName);
|
579
|
-
this.transitionTo(Auth.Config.get('signInRoute'));
|
580
|
-
}
|
581
|
-
return this._super.apply(this, arguments);
|
582
|
-
}
|
583
|
-
});
|
584
|
-
|
585
|
-
}).call(this);
|
586
|
-
(function() {
|
587
|
-
Em.Route.reopen({
|
588
|
-
redirect: function() {
|
589
|
-
if (Auth.Config.get('urlAuthentication') && Auth.Config.get('urlAuthenticationRouteScope') === 'both') {
|
590
|
-
Auth.Module.UrlAuthentication.authenticate({
|
591
|
-
async: false
|
592
|
-
});
|
593
|
-
if (Auth.get('authToken')) {
|
594
|
-
return this._super.apply(this, arguments);
|
595
|
-
}
|
596
|
-
}
|
597
|
-
if (Auth.Config.get('rememberMe') && Auth.Config.get('rememberAutoRecall') && Auth.Config.get('rememberAutoRecallRouteScope') === 'both') {
|
598
|
-
Auth.Module.RememberMe.recall({
|
599
|
-
async: false
|
600
|
-
});
|
601
|
-
if (Auth.get('authToken')) {
|
602
|
-
return this._super.apply(this, arguments);
|
603
|
-
}
|
604
|
-
}
|
605
|
-
return this._super.apply(this, arguments);
|
606
|
-
}
|
607
|
-
});
|
608
|
-
|
609
|
-
}).call(this);
|
610
|
-
(function() {
|
611
|
-
Auth.SignInController = Em.Mixin.create({
|
612
|
-
registerRedirect: function() {
|
613
|
-
return Auth.addObserver('authToken', this, 'smartSignInRedirect');
|
614
|
-
},
|
615
|
-
smartSignInRedirect: function() {
|
616
|
-
if (Auth.get('authToken')) {
|
617
|
-
this.transitionToRoute(Auth.resolveRedirectRoute('signIn'));
|
618
|
-
return Auth.removeObserver('authToken', this, 'smartSignInRedirect');
|
619
|
-
}
|
620
|
-
}
|
621
|
-
});
|
622
|
-
|
623
|
-
}).call(this);
|
624
|
-
(function() {
|
625
|
-
Auth.SignOutController = Em.Mixin.create({
|
626
|
-
registerRedirect: function() {
|
627
|
-
return Auth.addObserver('authToken', this, 'smartSignOutRedirect');
|
628
|
-
},
|
629
|
-
smartSignOutRedirect: function() {
|
630
|
-
if (!Auth.get('authToken')) {
|
631
|
-
this.transitionToRoute(Auth.resolveRedirectRoute('signOut'));
|
632
|
-
return Auth.removeObserver('authToken', this, 'smartSignOutRedirect');
|
633
|
-
}
|
634
|
-
}
|
635
|
-
});
|
636
|
-
|
637
|
-
}).call(this);
|
638
|
-
(function() {
|
639
|
-
if ((typeof DS !== "undefined" && DS !== null) && (DS.RESTAdapter != null)) {
|
640
|
-
Auth.RESTAdapter = DS.RESTAdapter.extend({
|
641
|
-
ajax: function(url, type, settings) {
|
642
|
-
settings.url = url;
|
643
|
-
settings.type = type;
|
644
|
-
settings.context = this;
|
645
|
-
return Auth.ajax(settings);
|
646
|
-
}
|
647
|
-
});
|
648
|
-
}
|
649
|
-
|
650
|
-
}).call(this);
|
651
|
-
(function() {
|
652
|
-
Auth.Module = Em.Object.create();
|
653
|
-
|
654
|
-
}).call(this);
|
655
|
-
(function() {
|
656
|
-
Auth.Module.RememberMe = Em.Object.create({
|
657
|
-
init: function() {
|
658
|
-
var _this = this;
|
659
|
-
|
660
|
-
Auth.on('signInSuccess', function() {
|
661
|
-
return _this.remember();
|
662
|
-
});
|
663
|
-
Auth.on('signInError', function() {
|
664
|
-
return _this.forget();
|
665
|
-
});
|
666
|
-
return Auth.on('signOutSuccess', function() {
|
667
|
-
return _this.forget();
|
668
|
-
});
|
669
|
-
},
|
670
|
-
recall: function(opts) {
|
671
|
-
var data, token;
|
672
|
-
|
673
|
-
if (opts == null) {
|
674
|
-
opts = {};
|
675
|
-
}
|
676
|
-
if (!Auth.Config.get('rememberMe')) {
|
677
|
-
return;
|
678
|
-
}
|
679
|
-
if (!Auth.get('authToken') && (token = this.retrieveToken())) {
|
680
|
-
this.fromRecall = true;
|
681
|
-
data = {};
|
682
|
-
if (opts.async != null) {
|
683
|
-
data['async'] = opts.async;
|
684
|
-
}
|
685
|
-
data[Auth.Config.get('rememberTokenKey')] = token;
|
686
|
-
return Auth.signIn(data);
|
687
|
-
}
|
1069
|
+
// Generated by EmberScript 0.0.7
|
1070
|
+
void function () {
|
1071
|
+
var $;
|
1072
|
+
var get$ = Ember.get;
|
1073
|
+
var set$ = Ember.set;
|
1074
|
+
$ = jQuery;
|
1075
|
+
set$(get$(get$(Em, 'Auth'), 'Module'), 'UrlAuthenticatable', Ember.Object.extend({
|
1076
|
+
init: function () {
|
1077
|
+
null != get$(this, 'params') || set$(this, 'params', {});
|
1078
|
+
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'urlAuthenticatable'));
|
1079
|
+
return this.patch();
|
688
1080
|
},
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
if (!Auth.Config.get('rememberMe')) {
|
693
|
-
return;
|
694
|
-
}
|
695
|
-
token = Auth.get('json')[Auth.Config.get('rememberTokenKey')];
|
696
|
-
if (token) {
|
697
|
-
if (token !== this.retrieveToken()) {
|
698
|
-
this.storeToken(token);
|
699
|
-
}
|
700
|
-
} else {
|
701
|
-
if (!this.fromRecall) {
|
702
|
-
this.forget();
|
703
|
-
}
|
704
|
-
}
|
705
|
-
return this.fromRecall = false;
|
706
|
-
},
|
707
|
-
forget: function() {
|
708
|
-
if (!Auth.Config.get('rememberMe')) {
|
709
|
-
return;
|
710
|
-
}
|
711
|
-
return this.removeToken();
|
712
|
-
},
|
713
|
-
retrieveToken: function() {
|
714
|
-
switch (Auth.Config.get('rememberStorage')) {
|
715
|
-
case 'localStorage':
|
716
|
-
return localStorage.getItem('ember-auth-remember-me');
|
717
|
-
case 'cookie':
|
718
|
-
return jQuery.cookie('ember-auth-remember-me');
|
719
|
-
}
|
720
|
-
},
|
721
|
-
storeToken: function(token) {
|
722
|
-
switch (Auth.Config.get('rememberStorage')) {
|
723
|
-
case 'localStorage':
|
724
|
-
return localStorage.setItem('ember-auth-remember-me', token);
|
725
|
-
case 'cookie':
|
726
|
-
return jQuery.cookie('ember-auth-remember-me', token, {
|
727
|
-
expires: Auth.Config.get('rememberPeriod'),
|
728
|
-
path: '/'
|
729
|
-
});
|
730
|
-
}
|
731
|
-
},
|
732
|
-
removeToken: function() {
|
733
|
-
switch (Auth.Config.get('rememberStorage')) {
|
734
|
-
case 'localStorage':
|
735
|
-
return localStorage.removeItem('ember-auth-remember-me');
|
736
|
-
case 'cookie':
|
737
|
-
return jQuery.removeCookie('ember-auth-remember-me', {
|
738
|
-
path: '/'
|
739
|
-
});
|
740
|
-
}
|
741
|
-
}
|
742
|
-
});
|
743
|
-
|
744
|
-
}).call(this);
|
745
|
-
(function() {
|
746
|
-
Auth.Module.UrlAuthentication = Em.Object.create({
|
747
|
-
authenticate: function(opts) {
|
748
|
-
var data;
|
749
|
-
|
750
|
-
if (opts == null) {
|
1081
|
+
authenticate: function (opts) {
|
1082
|
+
if (null == opts)
|
751
1083
|
opts = {};
|
752
|
-
|
753
|
-
if (!Auth.Config.get('urlAuthentication')) {
|
754
|
-
return;
|
755
|
-
}
|
756
|
-
if (Auth.get('authToken')) {
|
1084
|
+
if (get$(get$(this, 'auth'), 'signedIn'))
|
757
1085
|
return;
|
758
|
-
}
|
759
1086
|
this.canonicalizeParams();
|
760
|
-
if ($.isEmptyObject(this
|
1087
|
+
if ($.isEmptyObject(get$(this, 'params')))
|
761
1088
|
return;
|
762
|
-
}
|
763
|
-
|
764
|
-
if (opts.async != null) {
|
765
|
-
data['async'] = opts.async;
|
766
|
-
}
|
767
|
-
data = $.extend(data, this.params);
|
768
|
-
return Auth.signIn(data);
|
1089
|
+
set$(opts, 'data', $.extend(true, get$(this, 'params'), get$(opts, 'data') || {}));
|
1090
|
+
return get$(this, 'auth').signIn(opts);
|
769
1091
|
},
|
770
|
-
retrieveParams: function() {
|
771
|
-
|
772
|
-
|
773
|
-
if (!Auth.Config.get('urlAuthentication')) {
|
774
|
-
return;
|
775
|
-
}
|
776
|
-
key = Auth.Config.get('urlAuthenticationParamsKey');
|
777
|
-
return this.params = $.url().param(key);
|
1092
|
+
retrieveParams: function () {
|
1093
|
+
return set$(this, 'params', $.url().param(get$(get$(this, 'config'), 'paramsKey')));
|
778
1094
|
},
|
779
|
-
canonicalizeParams: function(obj) {
|
780
|
-
var canonicalized, k, params, v
|
781
|
-
|
782
|
-
|
783
|
-
obj = this.params;
|
784
|
-
}
|
1095
|
+
canonicalizeParams: function (obj) {
|
1096
|
+
var canonicalized, k, params, v;
|
1097
|
+
if (null == obj)
|
1098
|
+
obj = get$(this, 'params');
|
785
1099
|
params = {};
|
786
|
-
if (
|
1100
|
+
if (!(null != obj)) {
|
787
1101
|
params = {};
|
788
1102
|
} else if ($.isArray(obj)) {
|
789
|
-
for (
|
790
|
-
v = obj[
|
1103
|
+
for (var i$ = 0, length$ = obj.length; i$ < length$; ++i$) {
|
1104
|
+
v = obj[i$];
|
1105
|
+
k = i$;
|
791
1106
|
params[k] = v;
|
792
1107
|
}
|
793
1108
|
} else if (typeof obj !== 'object') {
|
@@ -799,34 +1114,33 @@
|
|
799
1114
|
for (k in params) {
|
800
1115
|
v = params[k];
|
801
1116
|
k = String(k);
|
802
|
-
if (k && k.charAt(k
|
1117
|
+
if (k && k.charAt(get$(k, 'length') - 1) === '/')
|
803
1118
|
k = k.slice(0, -1);
|
804
|
-
}
|
805
1119
|
if (typeof v === 'object') {
|
806
1120
|
canonicalized[k] = this.canonicalizeParams(v);
|
807
1121
|
} else {
|
808
1122
|
v = String(v);
|
809
|
-
if (v && v.charAt(v
|
1123
|
+
if (v && v.charAt(get$(v, 'length') - 1) === '/')
|
810
1124
|
v = v.slice(0, -1);
|
811
|
-
}
|
812
1125
|
canonicalized[k] = v;
|
813
1126
|
}
|
814
1127
|
}
|
815
|
-
return this
|
816
|
-
}
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
1128
|
+
return set$(this, 'params', canonicalized);
|
1129
|
+
},
|
1130
|
+
patch: function () {
|
1131
|
+
var self;
|
1132
|
+
self = this;
|
1133
|
+
get$(Em, 'Route').reopen({
|
1134
|
+
redirect: function () {
|
1135
|
+
return self.authenticate({ async: false });
|
1136
|
+
}
|
1137
|
+
});
|
1138
|
+
return get$(Em, 'Router').reopen({
|
1139
|
+
init: function () {
|
1140
|
+
self.retrieveParams();
|
1141
|
+
return this._super.apply(this, arguments);
|
1142
|
+
}
|
1143
|
+
});
|
825
1144
|
}
|
826
|
-
});
|
827
|
-
|
828
|
-
}).call(this);
|
829
|
-
(function() {
|
830
|
-
|
831
|
-
|
832
|
-
}).call(this);
|
1145
|
+
}));
|
1146
|
+
}.call(this);
|
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:
|
4
|
+
version: 5.0.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-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ember-source
|
@@ -75,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
segments:
|
77
77
|
- 0
|
78
|
-
hash:
|
78
|
+
hash: 11705715
|
79
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
81
81
|
requirements:
|