ember-auth-source 8.0.1 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/dist/ember-auth.js +313 -1322
- metadata +9 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aa0d657b897d07a3245272b51b92dd9fe539fa33
|
4
|
+
data.tar.gz: 329b95d52e39770cd88213795864539492e120b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f6adaf7861efc0b894f7b6ed98e5f29bfdba669d4b2dea3c911a4390421a2d7003b079b5f5da2e6836431810c7e2a2a54ba277ffa3959bfd5b204e0f532ca66a
|
7
|
+
data.tar.gz: d6175f28f0cad7e44087018fd031861352127ff8029cc5c70ccfa79e1ef29df6c516332994c91dd81a4dd30f2be85ba07fa3ffa3efa41492ee1c80013b0dab3b
|
data/dist/ember-auth.js
CHANGED
@@ -1,1371 +1,362 @@
|
|
1
1
|
// Generated by EmberScript 0.0.7
|
2
2
|
var get$ = Ember.get;
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
return get$(get$(this, '_module'), 'syncEvent').apply(get$(this, '_module'), arguments);
|
22
|
-
},
|
23
|
-
ensurePromise: function (callback) {
|
24
|
-
var cache$, ret;
|
25
|
-
if (null != (null != (cache$ = ret = callback()) ? get$(cache$, 'then') : void 0)) {
|
26
|
-
return ret;
|
27
|
-
} else {
|
28
|
-
return new (get$(get$(Em, 'RSVP'), 'Promise'))(function (resolve) {
|
29
|
-
return resolve();
|
30
|
-
});
|
31
|
-
}
|
32
|
-
},
|
33
|
-
followPromise: function (ret, callback) {
|
34
|
-
if (null != (null != ret ? get$(ret, 'then') : void 0)) {
|
35
|
-
return ret.then(function () {
|
36
|
-
return callback();
|
37
|
-
});
|
38
|
-
} else {
|
39
|
-
return this.ensurePromise(function () {
|
40
|
-
return callback();
|
41
|
-
});
|
42
|
-
}
|
43
|
-
},
|
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;
|
54
|
-
},
|
55
|
-
requestAdapter: 'jquery',
|
56
|
-
responseAdapter: 'json',
|
57
|
-
strategyAdapter: 'token',
|
58
|
-
sessionAdapter: 'cookie',
|
59
|
-
modules: ['emberData'],
|
60
|
-
signInEndPoint: null,
|
61
|
-
signOutEndPoint: null,
|
62
|
-
baseUrl: null,
|
63
|
-
userModel: null,
|
64
|
-
tokenKey: null,
|
65
|
-
tokenIdKey: null,
|
66
|
-
tokenLocation: 'param',
|
67
|
-
tokenHeaderKey: null,
|
68
|
-
actionRedirectable: {
|
69
|
-
signInRoute: false,
|
70
|
-
signOutRoute: false,
|
71
|
-
signInSmart: false,
|
72
|
-
signOutSmart: false,
|
73
|
-
signInBlacklist: [],
|
74
|
-
signOutBlacklist: []
|
75
|
-
},
|
76
|
-
authRedirectable: { route: null },
|
77
|
-
rememberable: {
|
78
|
-
tokenKey: null,
|
79
|
-
period: 14,
|
80
|
-
autoRecall: true,
|
81
|
-
endPoint: null
|
82
|
-
},
|
83
|
-
timeoutable: {
|
84
|
-
period: 20,
|
85
|
-
callback: null
|
86
|
-
},
|
87
|
-
urlAuthenticatable: {
|
88
|
-
paramsKey: null,
|
89
|
-
endPoint: null
|
90
|
-
}
|
91
|
-
}));// Generated by EmberScript 0.0.7
|
3
|
+
Em.onLoad('Ember.Application', function (application) {
|
4
|
+
application.initializer({
|
5
|
+
name: 'ember-auth',
|
6
|
+
initialize: function (container, app) {
|
7
|
+
app.register('auth:main', get$(app, 'Auth') || get$(Em, 'Auth'));
|
8
|
+
app.inject('route', 'auth', 'auth:main');
|
9
|
+
app.inject('controller', 'auth', 'auth:main');
|
10
|
+
return app.inject('view', 'auth', 'auth:main');
|
11
|
+
}
|
12
|
+
});
|
13
|
+
return application.initializer({
|
14
|
+
name: 'ember-auth-load',
|
15
|
+
after: 'ember-auth',
|
16
|
+
initialize: function (container, app) {
|
17
|
+
return container.lookup('auth:main');
|
18
|
+
}
|
19
|
+
});
|
20
|
+
});// Generated by EmberScript 0.0.7
|
92
21
|
var get$ = Ember.get;
|
93
22
|
var set$ = Ember.set;
|
94
|
-
set$(
|
23
|
+
set$(Em, 'Auth', Ember.Object.extend({
|
95
24
|
init: function () {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
},
|
107
|
-
|
108
|
-
|
109
|
-
|
25
|
+
this._initializeAdapters();
|
26
|
+
return this._initializeModules();
|
27
|
+
},
|
28
|
+
_handlers: {
|
29
|
+
signInSuccess: [],
|
30
|
+
signInError: [],
|
31
|
+
signOutSuccess: [],
|
32
|
+
signOutError: [],
|
33
|
+
sendSuccess: [],
|
34
|
+
sendError: []
|
35
|
+
},
|
36
|
+
module: {},
|
37
|
+
_initializeAdapters: function () {
|
38
|
+
var adapter, baseKlass, config, containerKey, containerType, klass, msg, type;
|
39
|
+
for (var cache$ = [
|
40
|
+
'request',
|
41
|
+
'response',
|
42
|
+
'strategy',
|
43
|
+
'session'
|
44
|
+
], i$ = 0, length$ = cache$.length; i$ < length$; ++i$) {
|
45
|
+
type = cache$[i$];
|
46
|
+
msg = 'The `' + type + '` config should be a string';
|
47
|
+
config = this.get(type);
|
48
|
+
Em.assert(msg, typeof config === 'string');
|
49
|
+
containerType = 'auth' + get$(Em, 'String').classify(type);
|
50
|
+
containerKey = '' + containerType + ':' + config;
|
51
|
+
adapter = get$(this, 'container').lookupFactory(containerKey);
|
52
|
+
baseKlass = get$(Em, 'String').classify(containerType);
|
53
|
+
klass = '' + get$(Em, 'String').classify(config) + baseKlass;
|
54
|
+
msg = 'The requested `' + config + '` ' + type + 'Adapter cannot be found. Either name it (YourApp).' + klass + ', or register it in the container under `' + containerKey + '`.';
|
55
|
+
Em.assert(msg, adapter);
|
56
|
+
msg = 'The requested `' + config + '` ' + type + 'Adapter must extend from Ember.Auth.' + baseKlass;
|
57
|
+
Em.assert(msg, get$(Em, 'Auth')[baseKlass].detect(adapter));
|
58
|
+
this.set('_' + type, adapter.create({ auth: this }));
|
59
|
+
}
|
60
|
+
return null;
|
61
|
+
},
|
62
|
+
_initializeModules: function () {
|
63
|
+
var containerKey, klass, module, moduleName, msg;
|
64
|
+
for (var i$ = 0, length$ = get$(this, 'modules').length; i$ < length$; ++i$) {
|
65
|
+
moduleName = get$(this, 'modules')[i$];
|
66
|
+
containerKey = 'authModule:' + moduleName;
|
67
|
+
klass = '' + get$(Em, 'String').classify(moduleName) + 'AuthModule';
|
68
|
+
module = get$(this, 'container').lookupFactory(containerKey);
|
69
|
+
msg = 'The requested `' + moduleName + '` module cannot be found. Either name it (YourApp).' + klass + ', or register it in the container under `' + containerKey + '`.';
|
70
|
+
Em.assert(msg, module);
|
71
|
+
this.set('module.' + moduleName, module.create({ auth: this }));
|
72
|
+
}
|
73
|
+
return null;
|
110
74
|
},
|
111
75
|
signIn: function (url, opts) {
|
112
76
|
var this$;
|
113
77
|
if (typeof opts === 'undefined') {
|
114
78
|
opts = url;
|
115
|
-
url =
|
116
|
-
}
|
117
|
-
|
118
|
-
|
79
|
+
url = get$(this, '_request').resolveUrl(get$(this, 'signInEndPoint'));
|
80
|
+
} else {
|
81
|
+
url = get$(this, '_request').resolveUrl(url);
|
82
|
+
}
|
83
|
+
opts || (opts = {});
|
84
|
+
return new (get$(get$(Em, 'RSVP'), 'Promise'))((this$ = this, function (resolve, reject) {
|
85
|
+
var this$1, this$2;
|
86
|
+
return get$(this$, '_request').signIn(url, get$(this$, '_strategy').serialize(opts)).then((this$1 = this$, function (response) {
|
87
|
+
var data, handler, promises;
|
88
|
+
data = get$(this$1, '_response').canonicalize(response);
|
89
|
+
promises = [];
|
90
|
+
promises.push(get$(this$1, '_strategy').deserialize(data));
|
91
|
+
promises.push(get$(this$1, '_session').start(data));
|
92
|
+
for (var i$ = 0, length$ = get$(get$(this$1, '_handlers'), 'signInSuccess').length; i$ < length$; ++i$) {
|
93
|
+
handler = get$(get$(this$1, '_handlers'), 'signInSuccess')[i$];
|
94
|
+
promises.push(handler(data));
|
95
|
+
}
|
96
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
97
|
+
return resolve(data);
|
98
|
+
}).fail(function () {
|
99
|
+
return reject(data);
|
100
|
+
});
|
101
|
+
})).fail((this$2 = this$, function (response) {
|
102
|
+
var data, handler, promises;
|
103
|
+
data = get$(this$2, '_response').canonicalize(response);
|
104
|
+
promises = [];
|
105
|
+
promises.push(get$(this$2, '_strategy').deserialize(data));
|
106
|
+
promises.push(get$(this$2, '_session').end(data));
|
107
|
+
for (var i$ = 0, length$ = get$(get$(this$2, '_handlers'), 'signInError').length; i$ < length$; ++i$) {
|
108
|
+
handler = get$(get$(this$2, '_handlers'), 'signInError')[i$];
|
109
|
+
promises.push(handler(data));
|
110
|
+
}
|
111
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
112
|
+
return reject(data);
|
113
|
+
}).fail(function () {
|
114
|
+
return reject(data);
|
115
|
+
});
|
116
|
+
}));
|
119
117
|
}));
|
120
118
|
},
|
121
119
|
signOut: function (url, opts) {
|
122
120
|
var this$;
|
123
121
|
if (typeof opts === 'undefined') {
|
124
122
|
opts = url;
|
125
|
-
url =
|
126
|
-
}
|
127
|
-
|
128
|
-
|
123
|
+
url = get$(this, '_request').resolveUrl(get$(this, 'signOutEndPoint'));
|
124
|
+
} else {
|
125
|
+
url = get$(this, '_request').resolveUrl(url);
|
126
|
+
}
|
127
|
+
opts || (opts = {});
|
128
|
+
return new (get$(get$(Em, 'RSVP'), 'Promise'))((this$ = this, function (resolve, reject) {
|
129
|
+
var this$1, this$2;
|
130
|
+
return get$(this$, '_request').signOut(url, get$(this$, '_strategy').serialize(opts)).then((this$1 = this$, function (response) {
|
131
|
+
var data, handler, promises;
|
132
|
+
data = get$(this$1, '_response').canonicalize(response);
|
133
|
+
promises = [];
|
134
|
+
promises.push(get$(this$1, '_strategy').deserialize(data));
|
135
|
+
promises.push(get$(this$1, '_session').end(data));
|
136
|
+
for (var i$ = 0, length$ = get$(get$(this$1, '_handlers'), 'signOutSuccess').length; i$ < length$; ++i$) {
|
137
|
+
handler = get$(get$(this$1, '_handlers'), 'signOutSuccess')[i$];
|
138
|
+
promises.push(handler(data));
|
139
|
+
}
|
140
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
141
|
+
return resolve(data);
|
142
|
+
}).fail(function () {
|
143
|
+
return reject(data);
|
144
|
+
});
|
145
|
+
})).fail((this$2 = this$, function (response) {
|
146
|
+
var data, handler, promises;
|
147
|
+
data = get$(this$2, '_response').canonicalize(response);
|
148
|
+
promises = [];
|
149
|
+
for (var i$ = 0, length$ = get$(get$(this$2, '_handlers'), 'signOutError').length; i$ < length$; ++i$) {
|
150
|
+
handler = get$(get$(this$2, '_handlers'), 'signOutError')[i$];
|
151
|
+
promises.push(handler(data));
|
152
|
+
}
|
153
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
154
|
+
return reject(data);
|
155
|
+
}).fail(function () {
|
156
|
+
return reject(data);
|
157
|
+
});
|
158
|
+
}));
|
129
159
|
}));
|
130
160
|
},
|
131
|
-
send: function (opts) {
|
161
|
+
send: function (url, opts) {
|
132
162
|
var this$;
|
133
|
-
|
134
|
-
|
163
|
+
if (typeof opts === 'undefined') {
|
164
|
+
opts = url;
|
165
|
+
url = get$(this, '_request').resolveUrl('');
|
166
|
+
} else {
|
167
|
+
url = get$(this, '_request').resolveUrl(url);
|
168
|
+
}
|
169
|
+
opts || (opts = {});
|
170
|
+
return new (get$(get$(Em, 'RSVP'), 'Promise'))((this$ = this, function (resolve, reject) {
|
171
|
+
var this$1, this$2;
|
172
|
+
return get$(this$, '_request').send(url, get$(this$, '_strategy').serialize(opts)).then((this$1 = this$, function (response) {
|
173
|
+
var handler, promises;
|
174
|
+
promises = [];
|
175
|
+
for (var i$ = 0, length$ = get$(get$(this$1, '_handlers'), 'sendSuccess').length; i$ < length$; ++i$) {
|
176
|
+
handler = get$(get$(this$1, '_handlers'), 'sendSuccess')[i$];
|
177
|
+
promises.push(handler(response));
|
178
|
+
}
|
179
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
180
|
+
return resolve(data);
|
181
|
+
}).fail(function () {
|
182
|
+
return reject(data);
|
183
|
+
});
|
184
|
+
})).fail((this$2 = this$, function (response) {
|
185
|
+
var handler, promises;
|
186
|
+
promises = [];
|
187
|
+
for (var i$ = 0, length$ = get$(get$(this$2, '_handlers'), 'sendError').length; i$ < length$; ++i$) {
|
188
|
+
handler = get$(get$(this$2, '_handlers'), 'sendError')[i$];
|
189
|
+
promises.push(handler(response));
|
190
|
+
}
|
191
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
192
|
+
return reject(data);
|
193
|
+
}).fail(function () {
|
194
|
+
return reject(data);
|
195
|
+
});
|
196
|
+
}));
|
135
197
|
}));
|
136
198
|
},
|
137
|
-
|
138
|
-
var
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
inject: function () {
|
150
|
-
var this$, this$1, this$2;
|
151
|
-
return get$(this, 'auth').reopen({
|
152
|
-
signIn: (this$ = this, function (opts) {
|
153
|
-
return this$.signIn(opts);
|
154
|
-
}),
|
155
|
-
signOut: (this$1 = this, function (opts) {
|
156
|
-
return this$1.signOut(opts);
|
157
|
-
}),
|
158
|
-
send: (this$2 = this, function (opts) {
|
159
|
-
return this$2.send(opts);
|
160
|
-
})
|
161
|
-
});
|
162
|
-
}
|
163
|
-
}));// Generated by EmberScript 0.0.7
|
164
|
-
var get$ = Ember.get;
|
165
|
-
var set$ = Ember.set;
|
166
|
-
set$(get$(get$(Em, 'Auth'), 'Request'), 'Dummy', Ember.Object.extend({
|
167
|
-
signIn: function (url, opts) {
|
168
|
-
if (null == opts)
|
169
|
-
opts = {};
|
170
|
-
this.send(opts);
|
171
|
-
switch (get$(opts, 'status')) {
|
172
|
-
case 'success':
|
173
|
-
get$(this, 'auth').trigger('signInSuccess');
|
174
|
-
break;
|
175
|
-
case 'error':
|
176
|
-
get$(this, 'auth').trigger('signInError');
|
177
|
-
}
|
178
|
-
return get$(this, 'auth').trigger('signInComplete');
|
179
|
-
},
|
180
|
-
signOut: function (url, opts) {
|
181
|
-
if (null == opts)
|
182
|
-
opts = {};
|
183
|
-
this.send(opts);
|
184
|
-
switch (get$(opts, 'status')) {
|
185
|
-
case 'success':
|
186
|
-
get$(this, 'auth').trigger('signOutSuccess');
|
187
|
-
break;
|
188
|
-
case 'error':
|
189
|
-
get$(this, 'auth').trigger('signOutError');
|
190
|
-
}
|
191
|
-
return get$(this, 'auth').trigger('signOutComplete');
|
192
|
-
},
|
193
|
-
send: function (opts) {
|
194
|
-
if (null == opts)
|
195
|
-
opts = {};
|
196
|
-
return get$(get$(this, 'auth'), '_response').canonicalize(opts);
|
197
|
-
}
|
198
|
-
}));// Generated by EmberScript 0.0.7
|
199
|
-
void function () {
|
200
|
-
var $;
|
201
|
-
var get$ = Ember.get;
|
202
|
-
var set$ = Ember.set;
|
203
|
-
$ = jQuery;
|
204
|
-
set$(get$(get$(Em, 'Auth'), 'Request'), 'Jquery', Ember.Object.extend({
|
205
|
-
init: function () {
|
206
|
-
null != get$(this, 'jqxhr') || set$(this, 'jqxhr', null);
|
207
|
-
return this.inject();
|
208
|
-
},
|
209
|
-
signIn: function (url, opts) {
|
210
|
-
var this$, this$1, this$2;
|
211
|
-
if (null == opts)
|
212
|
-
opts = {};
|
213
|
-
return this.send($.extend(true, {
|
214
|
-
url: url,
|
215
|
-
type: 'POST'
|
216
|
-
}, opts)).done((this$ = this, function () {
|
217
|
-
return get$(this$, 'auth').trigger('signInSuccess');
|
218
|
-
})).fail((this$1 = this, function () {
|
219
|
-
return get$(this$1, 'auth').trigger('signInError');
|
220
|
-
})).always((this$2 = this, function () {
|
221
|
-
return get$(this$2, 'auth').trigger('signInComplete');
|
222
|
-
}));
|
223
|
-
},
|
224
|
-
signOut: function (url, opts) {
|
225
|
-
var this$, this$1, this$2;
|
226
|
-
if (null == opts)
|
227
|
-
opts = {};
|
228
|
-
return this.send($.extend(true, {
|
229
|
-
url: url,
|
230
|
-
type: 'DELETE'
|
231
|
-
}, opts)).done((this$ = this, function () {
|
232
|
-
return get$(this$, 'auth').trigger('signOutSuccess');
|
233
|
-
})).fail((this$1 = this, function () {
|
234
|
-
return get$(this$1, 'auth').trigger('signOutError');
|
235
|
-
})).always((this$2 = this, function () {
|
236
|
-
return get$(this$2, 'auth').trigger('signOutComplete');
|
237
|
-
}));
|
238
|
-
},
|
239
|
-
send: function (settings) {
|
240
|
-
var def, this$, this$1, this$2;
|
241
|
-
if (null == settings)
|
242
|
-
settings = {};
|
243
|
-
def = {};
|
244
|
-
set$(def, 'dataType', 'json');
|
245
|
-
if (get$(settings, 'data') && !(null != get$(settings, 'contentType'))) {
|
246
|
-
if (null != get$(settings, 'type') && get$(settings, 'type').toUpperCase() !== 'GET')
|
247
|
-
set$(settings, 'data', JSON.stringify(get$(settings, 'data')));
|
248
|
-
if ((null != get$(settings, 'type') ? get$(settings, 'type').toUpperCase() : void 0) !== 'GET')
|
249
|
-
set$(def, 'contentType', 'application/json; charset=utf-8');
|
199
|
+
createSession: function (data) {
|
200
|
+
var this$;
|
201
|
+
return new (get$(get$(Em, 'RSVP'), 'Promise'))((this$ = this, function (resolve, reject) {
|
202
|
+
var handler, promises;
|
203
|
+
if (typeof data === 'string')
|
204
|
+
data = get$(this$, '_response').canonicalize(data);
|
205
|
+
promises = [];
|
206
|
+
promises.push(get$(this$, '_strategy').deserialize(data));
|
207
|
+
promises.push(get$(this$, '_session').start(data));
|
208
|
+
for (var i$ = 0, length$ = get$(get$(this$, '_handlers'), 'signInSuccess').length; i$ < length$; ++i$) {
|
209
|
+
handler = get$(get$(this$, '_handlers'), 'signInSuccess')[i$];
|
210
|
+
promises.push(handler(data));
|
250
211
|
}
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
return
|
255
|
-
})).fail((this$1 = this, function (jqxhr) {
|
256
|
-
get$(get$(this$1, 'auth'), '_response').canonicalize(get$(jqxhr, 'responseText'));
|
257
|
-
return set$(this$1, 'jqxhr', jqxhr);
|
258
|
-
})).always((this$2 = this, function (jqxhr) {
|
259
|
-
return set$(this$2, 'jqxhr', jqxhr);
|
260
|
-
}));
|
261
|
-
},
|
262
|
-
inject: function () {
|
263
|
-
var this$;
|
264
|
-
return get$(this, 'auth').reopen({
|
265
|
-
jqxhr: Em.computed((this$ = this, function () {
|
266
|
-
return get$(this$, 'jqxhr');
|
267
|
-
})).property('_request.adapter.jqxhr')
|
212
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
213
|
+
return resolve(data);
|
214
|
+
}).fail(function () {
|
215
|
+
return reject(data);
|
268
216
|
});
|
269
|
-
}
|
270
|
-
}));
|
271
|
-
}.call(this);// Generated by EmberScript 0.0.7
|
272
|
-
var get$ = Ember.get;
|
273
|
-
var set$ = Ember.set;
|
274
|
-
set$(get$(Em, 'Auth'), 'Response', Ember.Object.extend({
|
275
|
-
init: function () {
|
276
|
-
var adapter;
|
277
|
-
null != get$(this, 'response') || set$(this, 'response', {});
|
278
|
-
if (!(null != get$(this, 'adapter'))) {
|
279
|
-
adapter = get$(Em, 'String').capitalize(get$(Em, 'String').camelize(get$(get$(this, 'auth'), 'responseAdapter')));
|
280
|
-
if (null != get$(get$(Em, 'Auth'), 'Response')[adapter]) {
|
281
|
-
set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Response')[adapter].create({ auth: get$(this, 'auth') }));
|
282
|
-
} else {
|
283
|
-
throw 'Adapter not found: Em.Auth.Response.' + adapter;
|
284
|
-
}
|
285
|
-
}
|
286
|
-
return this.inject();
|
287
|
-
},
|
288
|
-
syncEvent: function () {
|
289
|
-
if (null != get$(get$(this, 'adapter'), 'syncEvent'))
|
290
|
-
return get$(get$(this, 'adapter'), 'syncEvent').apply(get$(this, 'adapter'), arguments);
|
291
|
-
},
|
292
|
-
canonicalize: function (input) {
|
293
|
-
return set$(this, 'response', get$(this, 'adapter').canonicalize(input));
|
217
|
+
}));
|
294
218
|
},
|
295
|
-
|
219
|
+
destroySession: function (data) {
|
296
220
|
var this$;
|
297
|
-
return get$(
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
var
|
305
|
-
|
306
|
-
|
307
|
-
canonicalize: function (input) {
|
308
|
-
return input;
|
309
|
-
}
|
310
|
-
}));// Generated by EmberScript 0.0.7
|
311
|
-
var get$ = Ember.get;
|
312
|
-
var set$ = Ember.set;
|
313
|
-
set$(get$(get$(Em, 'Auth'), 'Response'), 'Json', Ember.Object.extend({
|
314
|
-
canonicalize: function (input) {
|
315
|
-
var error;
|
316
|
-
if (!input)
|
317
|
-
return {};
|
318
|
-
switch (typeof input) {
|
319
|
-
case 'object':
|
320
|
-
return input;
|
321
|
-
case 'string':
|
322
|
-
try {
|
323
|
-
return JSON.parse(input);
|
324
|
-
} catch (e$) {
|
325
|
-
error = e$;
|
326
|
-
throw 'Invalid JSON format';
|
221
|
+
return new (get$(get$(Em, 'RSVP'), 'Promise'))((this$ = this, function (resolve, reject) {
|
222
|
+
var handler, promises;
|
223
|
+
if (typeof data === 'string')
|
224
|
+
data = get$(this$, '_response').canonicalize(data);
|
225
|
+
promises = [];
|
226
|
+
promises.push(get$(this$, '_strategy').deserialize(data));
|
227
|
+
promises.push(get$(this$, '_session').end(data));
|
228
|
+
for (var i$ = 0, length$ = get$(get$(this$, '_handlers'), 'signOutSuccess').length; i$ < length$; ++i$) {
|
229
|
+
handler = get$(get$(this$, '_handlers'), 'signOutSuccess')[i$];
|
230
|
+
promises.push(handler(data));
|
327
231
|
}
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
})
|
333
|
-
|
334
|
-
var set$ = Ember.set;
|
335
|
-
set$(get$(Em, 'Auth'), 'Strategy', Ember.Object.extend({
|
336
|
-
init: function () {
|
337
|
-
var adapter;
|
338
|
-
if (!(null != get$(this, 'adapter'))) {
|
339
|
-
adapter = get$(Em, 'String').capitalize(get$(Em, 'String').camelize(get$(get$(this, 'auth'), 'strategyAdapter')));
|
340
|
-
if (null != get$(get$(Em, 'Auth'), 'Strategy')[adapter]) {
|
341
|
-
return set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Strategy')[adapter].create({ auth: get$(this, 'auth') }));
|
342
|
-
} else {
|
343
|
-
throw 'Adapter not found: Em.Auth.Strategy.' + adapter;
|
344
|
-
}
|
345
|
-
}
|
346
|
-
},
|
347
|
-
syncEvent: function (name, args) {
|
348
|
-
args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
|
349
|
-
switch (name) {
|
350
|
-
case 'signInSuccess':
|
351
|
-
this.deserialize();
|
352
|
-
}
|
353
|
-
if (null != get$(get$(this, 'adapter'), 'syncEvent'))
|
354
|
-
return get$(get$(this, 'adapter'), 'syncEvent').apply(get$(this, 'adapter'), arguments);
|
355
|
-
},
|
356
|
-
serialize: function (opts) {
|
357
|
-
return get$(this, 'adapter').serialize(opts);
|
358
|
-
},
|
359
|
-
deserialize: function () {
|
360
|
-
return get$(this, 'adapter').deserialize(get$(get$(this, 'auth'), 'response'));
|
361
|
-
}
|
362
|
-
}));// Generated by EmberScript 0.0.7
|
363
|
-
var get$ = Ember.get;
|
364
|
-
var set$ = Ember.set;
|
365
|
-
set$(get$(get$(Em, 'Auth'), 'Strategy'), 'Dummy', Ember.Object.extend({
|
366
|
-
serialize: function (opts) {
|
367
|
-
if (null == opts)
|
368
|
-
opts = {};
|
369
|
-
return opts;
|
370
|
-
},
|
371
|
-
deserialize: function (data) {
|
372
|
-
if (null == data)
|
373
|
-
data = {};
|
374
|
-
return function (accum$) {
|
375
|
-
var k, v;
|
376
|
-
for (k in data) {
|
377
|
-
v = data[k];
|
378
|
-
accum$.push(get$(this, 'auth').set(k, v));
|
379
|
-
}
|
380
|
-
return accum$;
|
381
|
-
}.call(this, []);
|
382
|
-
}
|
383
|
-
}));// Generated by EmberScript 0.0.7
|
384
|
-
var get$ = Ember.get;
|
385
|
-
var set$ = Ember.set;
|
386
|
-
set$(get$(get$(Em, 'Auth'), 'Strategy'), 'Token', Ember.Object.extend({
|
387
|
-
init: function () {
|
388
|
-
null != get$(this, 'authToken') || set$(this, 'authToken', null);
|
389
|
-
return this.inject();
|
232
|
+
return get$(Em, 'RSVP').all(promises).then(function () {
|
233
|
+
return resolve(data);
|
234
|
+
}).fail(function () {
|
235
|
+
return reject(data);
|
236
|
+
});
|
237
|
+
}));
|
390
238
|
},
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
case 'customHeader':
|
410
|
-
opts.headers || (opts.headers = {});
|
411
|
-
get$(opts, 'headers')[get$(get$(this, 'auth'), 'tokenHeaderKey')] || (get$(opts, 'headers')[get$(get$(this, 'auth'), 'tokenHeaderKey')] = get$(this, 'authToken'));
|
239
|
+
addHandler: function (type, handler) {
|
240
|
+
var msg;
|
241
|
+
msg = 'Handler type unrecognized; you passed in `' + type + '`';
|
242
|
+
Em.assert(msg, null != get$(this, '_handlers')[type]);
|
243
|
+
msg = 'Handler must be a function';
|
244
|
+
Em.assert(msg, typeof handler === 'function');
|
245
|
+
return get$(this, '_handlers')[type].pushObject(handler);
|
246
|
+
},
|
247
|
+
removeHandler: function (type, handler) {
|
248
|
+
var msg;
|
249
|
+
msg = 'Handler type unrecognized; you passed in `' + type + '`';
|
250
|
+
Em.assert(msg, null != get$(this, '_handlers')[type]);
|
251
|
+
msg = 'Handler must be a function or omitted for removing all handlers';
|
252
|
+
Em.assert(msg, typeof handler === 'function' || typeof handler === 'undefined');
|
253
|
+
if (null != handler) {
|
254
|
+
return get$(this, '_handlers')[type].removeObject(handler);
|
255
|
+
} else {
|
256
|
+
return get$(this, '_handlers')[type] = [];
|
412
257
|
}
|
413
|
-
return opts;
|
414
|
-
},
|
415
|
-
deserialize: function (data) {
|
416
|
-
if (null == data)
|
417
|
-
data = {};
|
418
|
-
set$(this, 'authToken', data[get$(get$(this, 'auth'), 'tokenKey')]);
|
419
|
-
if (get$(get$(this, 'auth'), 'tokenIdKey'))
|
420
|
-
return set$(get$(get$(this, 'auth'), '_session'), 'userId', data[get$(get$(this, 'auth'), 'tokenIdKey')]);
|
421
|
-
},
|
422
|
-
inject: function () {
|
423
|
-
var this$;
|
424
|
-
return get$(this, 'auth').reopen({
|
425
|
-
authToken: Em.computed((this$ = this, function () {
|
426
|
-
return get$(this$, 'authToken');
|
427
|
-
})).property('_strategy.adapter.authToken')
|
428
|
-
});
|
429
258
|
}
|
430
259
|
}));// Generated by EmberScript 0.0.7
|
431
|
-
var get$ = Ember.get;
|
432
|
-
var set$ = Ember.set;
|
433
|
-
set$(get$(Em, 'Auth'), 'Session', Ember.Object.extend({
|
434
|
-
init: function () {
|
435
|
-
var adapter, this$, this$1;
|
436
|
-
null != get$(this, 'signedIn') || set$(this, 'signedIn', false);
|
437
|
-
null != get$(this, 'userId') || set$(this, 'userId', null);
|
438
|
-
null != get$(this, 'user') || set$(this, 'user', null);
|
439
|
-
if (!(null != get$(this, 'adapter'))) {
|
440
|
-
adapter = get$(Em, 'String').capitalize(get$(Em, 'String').camelize(get$(get$(this, 'auth'), 'sessionAdapter')));
|
441
|
-
if (null != get$(get$(Em, 'Auth'), 'Session')[adapter]) {
|
442
|
-
set$(this, 'adapter', get$(get$(Em, 'Auth'), 'Session')[adapter].create({ auth: get$(this, 'auth') }));
|
443
|
-
} else {
|
444
|
-
throw 'Adapter not found: Em.Auth.Session.' + adapter;
|
445
|
-
}
|
446
|
-
}
|
447
|
-
get$(this, 'auth').on('signInSuccess', (this$ = this, function () {
|
448
|
-
return this$.start();
|
449
|
-
}));
|
450
|
-
get$(this, 'auth').on('signOutSuccess', (this$1 = this, function () {
|
451
|
-
return this$1.clear();
|
452
|
-
}));
|
453
|
-
return this.inject();
|
454
|
-
},
|
455
|
-
syncEvent: function (name, args) {
|
456
|
-
args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
|
457
|
-
if (null != get$(get$(this, 'adapter'), 'syncEvent'))
|
458
|
-
return get$(get$(this, 'adapter'), 'syncEvent').apply(get$(this, 'adapter'), arguments);
|
459
|
-
},
|
460
|
-
findUser: function () {
|
461
|
-
var cache$, model, modelKey, this$;
|
462
|
-
if (get$(this, 'userId') && (modelKey = get$(get$(this, 'auth'), 'userModel')) && (model = Ember.get(modelKey)))
|
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
|
-
}
|
468
|
-
},
|
469
|
-
start: function () {
|
470
|
-
set$(this, 'signedIn', true);
|
471
|
-
set$(this, 'startTime', new Date);
|
472
|
-
set$(this, 'endTime', null);
|
473
|
-
return this.findUser();
|
474
|
-
},
|
475
|
-
clear: function () {
|
476
|
-
set$(this, 'signedIn', false);
|
477
|
-
set$(this, 'userId', null);
|
478
|
-
set$(this, 'user', null);
|
479
|
-
set$(this, 'startTime', null);
|
480
|
-
return set$(this, 'endTime', new Date);
|
481
|
-
},
|
482
|
-
retrieve: function (key, opts) {
|
483
|
-
return get$(this, 'adapter').retrieve(key, opts);
|
484
|
-
},
|
485
|
-
store: function (key, value, opts) {
|
486
|
-
return get$(this, 'adapter').store(key, value, opts);
|
487
|
-
},
|
488
|
-
remove: function (key, opts) {
|
489
|
-
return get$(this, 'adapter').remove(key, opts);
|
490
|
-
},
|
491
|
-
create: function (input) {
|
492
|
-
get$(get$(this, 'auth'), '_response').canonicalize(input);
|
493
|
-
return get$(this, 'auth').trigger('signInSuccess');
|
494
|
-
},
|
495
|
-
destroy: function () {
|
496
|
-
get$(get$(this, 'auth'), '_response').canonicalize('');
|
497
|
-
return get$(this, 'auth').trigger('signOutSuccess');
|
498
|
-
},
|
499
|
-
inject: function () {
|
500
|
-
var this$, this$1, this$2, this$3, this$4, this$5, this$6;
|
501
|
-
return get$(this, 'auth').reopen({
|
502
|
-
signedIn: Em.computed((this$ = this, function () {
|
503
|
-
return get$(this$, 'signedIn');
|
504
|
-
})).property('_session.signedIn'),
|
505
|
-
userId: Em.computed((this$1 = this, function () {
|
506
|
-
return get$(this$1, 'userId');
|
507
|
-
})).property('_session.userId'),
|
508
|
-
user: Em.computed((this$2 = this, function () {
|
509
|
-
return get$(this$2, 'user');
|
510
|
-
})).property('_session.user'),
|
511
|
-
startTime: Em.computed((this$3 = this, function () {
|
512
|
-
return get$(this$3, 'startTime');
|
513
|
-
})).property('_session.startTime'),
|
514
|
-
endTime: Em.computed((this$4 = this, function () {
|
515
|
-
return get$(this$4, 'endTime');
|
516
|
-
})).property('_session.endTime'),
|
517
|
-
createSession: (this$5 = this, function (input) {
|
518
|
-
return this$5.create(input);
|
519
|
-
}),
|
520
|
-
destroySession: (this$6 = this, function () {
|
521
|
-
return this$6.destroy();
|
522
|
-
})
|
523
|
-
});
|
524
|
-
}
|
525
|
-
}));/*!
|
526
|
-
* jQuery Cookie Plugin v1.3.1
|
527
|
-
* https://github.com/carhartl/jquery-cookie
|
528
|
-
*
|
529
|
-
* Copyright 2013 Klaus Hartl
|
530
|
-
* Released under the MIT license
|
531
|
-
*/
|
532
|
-
|
533
|
-
(function (factory) {
|
534
|
-
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
|
535
|
-
// AMD. Register as anonymous module.
|
536
|
-
define(['jquery'], factory);
|
537
|
-
} else {
|
538
|
-
// Browser globals.
|
539
|
-
factory(jQuery);
|
540
|
-
}
|
541
|
-
}(function ($) {
|
542
|
-
|
543
|
-
var pluses = /\+/g;
|
544
|
-
|
545
|
-
function raw(s) {
|
546
|
-
return s;
|
547
|
-
}
|
548
|
-
|
549
|
-
function decoded(s) {
|
550
|
-
return decodeURIComponent(s.replace(pluses, ' '));
|
551
|
-
}
|
552
|
-
|
553
|
-
function converted(s) {
|
554
|
-
if (s.indexOf('"') === 0) {
|
555
|
-
// This is a quoted cookie as according to RFC2068, unescape
|
556
|
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
557
|
-
}
|
558
|
-
try {
|
559
|
-
return config.json ? JSON.parse(s) : s;
|
560
|
-
} catch(er) {}
|
561
|
-
}
|
562
|
-
|
563
|
-
var config = $.cookie = function (key, value, options) {
|
564
|
-
|
565
|
-
// write
|
566
|
-
if (value !== undefined) {
|
567
|
-
options = $.extend({}, config.defaults, options);
|
568
|
-
|
569
|
-
if (typeof options.expires === 'number') {
|
570
|
-
var days = options.expires, t = options.expires = new Date();
|
571
|
-
t.setDate(t.getDate() + days);
|
572
|
-
}
|
573
|
-
|
574
|
-
value = config.json ? JSON.stringify(value) : String(value);
|
575
|
-
|
576
|
-
return (document.cookie = [
|
577
|
-
encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
|
578
|
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
579
|
-
options.path ? '; path=' + options.path : '',
|
580
|
-
options.domain ? '; domain=' + options.domain : '',
|
581
|
-
options.secure ? '; secure' : ''
|
582
|
-
].join(''));
|
583
|
-
}
|
584
|
-
|
585
|
-
// read
|
586
|
-
var decode = config.raw ? raw : decoded;
|
587
|
-
var cookies = document.cookie.split('; ');
|
588
|
-
var result = key ? undefined : {};
|
589
|
-
for (var i = 0, l = cookies.length; i < l; i++) {
|
590
|
-
var parts = cookies[i].split('=');
|
591
|
-
var name = decode(parts.shift());
|
592
|
-
var cookie = decode(parts.join('='));
|
593
|
-
|
594
|
-
if (key && key === name) {
|
595
|
-
result = converted(cookie);
|
596
|
-
break;
|
597
|
-
}
|
598
|
-
|
599
|
-
if (!key) {
|
600
|
-
result[name] = converted(cookie);
|
601
|
-
}
|
602
|
-
}
|
603
|
-
|
604
|
-
return result;
|
605
|
-
};
|
606
|
-
|
607
|
-
config.defaults = {};
|
608
|
-
|
609
|
-
$.removeCookie = function (key, options) {
|
610
|
-
if ($.cookie(key) !== undefined) {
|
611
|
-
$.cookie(key, '', $.extend(options, { expires: -1 }));
|
612
|
-
return true;
|
613
|
-
}
|
614
|
-
return false;
|
615
|
-
};
|
616
|
-
|
617
|
-
}));
|
618
|
-
// Generated by EmberScript 0.0.7
|
619
260
|
void function () {
|
620
|
-
var
|
261
|
+
var mustImplement;
|
621
262
|
var get$ = Ember.get;
|
622
263
|
var set$ = Ember.set;
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
264
|
+
mustImplement = function (method) {
|
265
|
+
return function () {
|
266
|
+
throw new (get$(Em, 'Error'))('Your request adapter ' + this.toString() + ' must implement the required method `' + method + '`');
|
267
|
+
};
|
268
|
+
};
|
269
|
+
set$(get$(Em, 'Auth'), 'AuthRequest', Ember.Object.extend({
|
270
|
+
signIn: mustImplement('signIn'),
|
271
|
+
signOut: mustImplement('signOut'),
|
272
|
+
send: mustImplement('send'),
|
273
|
+
resolveUrl: function (path) {
|
274
|
+
var base;
|
275
|
+
base = get$(get$(this, 'auth'), 'baseUrl');
|
276
|
+
if (base && base[get$(base, 'length') - 1] === '/')
|
277
|
+
base = base.substr(0, get$(base, 'length') - 1);
|
278
|
+
if ((null != path ? path[0] : void 0) === '/')
|
279
|
+
path = path.substr(1, get$(path, 'length'));
|
280
|
+
return [
|
281
|
+
base,
|
282
|
+
path
|
283
|
+
].join('/');
|
633
284
|
}
|
634
285
|
}));
|
635
286
|
}.call(this);// Generated by EmberScript 0.0.7
|
636
|
-
var get$ = Ember.get;
|
637
|
-
var set$ = Ember.set;
|
638
|
-
set$(get$(get$(Em, 'Auth'), 'Session'), 'Dummy', Ember.Object.extend({
|
639
|
-
init: function () {
|
640
|
-
return set$(this, 'session', {});
|
641
|
-
},
|
642
|
-
retrieve: function (key) {
|
643
|
-
return this.get('session.' + key);
|
644
|
-
},
|
645
|
-
store: function (key, value) {
|
646
|
-
return this.set('session.' + key, value);
|
647
|
-
},
|
648
|
-
remove: function (key) {
|
649
|
-
return delete get$(this, 'session')[key];
|
650
|
-
}
|
651
|
-
}));// Generated by EmberScript 0.0.7
|
652
|
-
var get$ = Ember.get;
|
653
|
-
var set$ = Ember.set;
|
654
|
-
set$(get$(get$(Em, 'Auth'), 'Session'), 'LocalStorage', Ember.Object.extend({
|
655
|
-
retrieve: function (key) {
|
656
|
-
return localStorage.getItem(key);
|
657
|
-
},
|
658
|
-
store: function (key, value) {
|
659
|
-
return localStorage.setItem(key, value);
|
660
|
-
},
|
661
|
-
remove: function (key) {
|
662
|
-
return localStorage.removeItem(key);
|
663
|
-
}
|
664
|
-
}));// Generated by EmberScript 0.0.7
|
665
|
-
var get$ = Ember.get;
|
666
|
-
var set$ = Ember.set;
|
667
|
-
set$(get$(Em, 'Auth'), 'Module', Ember.Object.extend({
|
668
|
-
init: function () {
|
669
|
-
var key, module;
|
670
|
-
if (!(null != get$(this, 'module'))) {
|
671
|
-
set$(this, 'module', {});
|
672
|
-
for (var i$ = 0, length$ = get$(get$(this, 'auth'), 'modules').length; i$ < length$; ++i$) {
|
673
|
-
key = get$(get$(this, 'auth'), 'modules')[i$];
|
674
|
-
key = get$(Em, 'String').camelize(key);
|
675
|
-
module = get$(Em, 'String').capitalize(get$(Em, 'String').camelize(key));
|
676
|
-
if (null != get$(get$(Em, 'Auth'), 'Module')[module]) {
|
677
|
-
this.set('module.' + key, get$(get$(Em, 'Auth'), 'Module')[module].create({ auth: get$(this, 'auth') }));
|
678
|
-
} else {
|
679
|
-
throw 'Module not found: Em.Auth.Module.' + module;
|
680
|
-
}
|
681
|
-
}
|
682
|
-
}
|
683
|
-
return this.inject();
|
684
|
-
},
|
685
|
-
syncEvent: function () {
|
686
|
-
var args;
|
687
|
-
args = arguments;
|
688
|
-
return function (accum$) {
|
689
|
-
var _, module;
|
690
|
-
for (_ in get$(this, 'module')) {
|
691
|
-
module = get$(this, 'module')[_];
|
692
|
-
accum$.push(null != get$(module, 'syncEvent') ? get$(module, 'syncEvent').apply(module, args) : void 0);
|
693
|
-
}
|
694
|
-
return accum$;
|
695
|
-
}.call(this, []);
|
696
|
-
},
|
697
|
-
inject: function () {
|
698
|
-
var this$;
|
699
|
-
return get$(this, 'auth').reopen({
|
700
|
-
module: Em.computed((this$ = this, function () {
|
701
|
-
return get$(this$, 'module');
|
702
|
-
})).property('_module.module')
|
703
|
-
});
|
704
|
-
}
|
705
|
-
}));// Generated by EmberScript 0.0.7
|
706
287
|
void function () {
|
707
|
-
var
|
288
|
+
var mustImplement;
|
708
289
|
var get$ = Ember.get;
|
709
290
|
var set$ = Ember.set;
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
null != get$(this, 'router') || set$(this, 'router', null);
|
717
|
-
return this.patch();
|
718
|
-
},
|
719
|
-
canonicalizeRoute: function (route) {
|
720
|
-
var endsWith;
|
721
|
-
if (!(typeof route === 'string'))
|
722
|
-
return '';
|
723
|
-
endsWith = function (haystack, needle) {
|
724
|
-
var d;
|
725
|
-
d = get$(haystack, 'length') - get$(needle, 'length');
|
726
|
-
return d >= 0 && haystack.lastIndexOf(needle) === d;
|
727
|
-
};
|
728
|
-
if (!endsWith(route, '.index'))
|
729
|
-
return route;
|
730
|
-
return route.substr(0, route.lastIndexOf('.index'));
|
731
|
-
},
|
732
|
-
getBlacklist: function (env) {
|
733
|
-
var blacklist;
|
734
|
-
if (!(blacklist = get$(this, 'config')['' + env + 'Blacklist']))
|
735
|
-
return [];
|
736
|
-
return function (accum$) {
|
737
|
-
var r;
|
738
|
-
for (var i$ = 0, length$ = blacklist.length; i$ < length$; ++i$) {
|
739
|
-
r = blacklist[i$];
|
740
|
-
accum$.push(this.canonicalizeRoute(r));
|
741
|
-
}
|
742
|
-
return accum$;
|
743
|
-
}.call(this, []);
|
744
|
-
},
|
745
|
-
resolveRedirect: function (env) {
|
746
|
-
var fallback, isSmart;
|
747
|
-
if (!(env === 'signIn' || env === 'signOut'))
|
748
|
-
return null;
|
749
|
-
isSmart = get$(this, 'config')['' + env + 'Smart'];
|
750
|
-
fallback = this.canonicalizeRoute(get$(this, 'config')['' + env + 'Route']);
|
751
|
-
if (!fallback)
|
752
|
-
return null;
|
753
|
-
if (!isSmart)
|
754
|
-
return fallback;
|
755
|
-
return this.get('' + env + 'Redir') || fallback;
|
756
|
-
},
|
757
|
-
registerRedirect: function (transition) {
|
758
|
-
var routeName;
|
759
|
-
routeName = this.canonicalizeRoute(get$(transition, 'targetName'));
|
760
|
-
if ($.inArray(routeName, this.getBlacklist('signIn')) === -1)
|
761
|
-
set$(this, 'signInRedir', transition);
|
762
|
-
if ($.inArray(routeName, this.getBlacklist('signOut')) === -1)
|
763
|
-
return set$(this, 'signOutRedir', transition);
|
764
|
-
},
|
765
|
-
redirect: Ember.observer(function () {
|
766
|
-
var env, result;
|
767
|
-
env = get$(get$(this, 'auth'), 'signedIn') ? 'signIn' : 'signOut';
|
768
|
-
if (!(result = this.resolveRedirect(env)))
|
769
|
-
return;
|
770
|
-
switch (typeof result) {
|
771
|
-
case 'object':
|
772
|
-
return result.retry();
|
773
|
-
case 'string':
|
774
|
-
return get$(this, 'router').transitionTo(result);
|
775
|
-
}
|
776
|
-
}, 'auth.signedIn'),
|
777
|
-
patch: function () {
|
778
|
-
var self;
|
779
|
-
self = this;
|
780
|
-
return get$(Em, 'Route').reopen({
|
781
|
-
init: function () {
|
782
|
-
self.router || (self.router = get$(this, 'router'));
|
783
|
-
return this._super.apply(this, arguments);
|
784
|
-
},
|
785
|
-
beforeModel: function (transition) {
|
786
|
-
return get$(self, 'auth').followPromise(this._super.apply(this, arguments), function () {
|
787
|
-
self.registerRedirect(transition);
|
788
|
-
return null;
|
789
|
-
});
|
790
|
-
}
|
791
|
-
});
|
792
|
-
}
|
793
|
-
}));
|
291
|
+
mustImplement = function (method) {
|
292
|
+
return function () {
|
293
|
+
throw new (get$(Em, 'Error'))('Your response adapter ' + this.toString() + ' must implement the required method `' + method + '`');
|
294
|
+
};
|
295
|
+
};
|
296
|
+
set$(get$(Em, 'Auth'), 'AuthResponse', Ember.Object.extend({ canonicalize: mustImplement('canonicalize') }));
|
794
297
|
}.call(this);// Generated by EmberScript 0.0.7
|
795
|
-
|
796
|
-
var
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
return
|
801
|
-
|
802
|
-
patch: function () {
|
803
|
-
var self;
|
804
|
-
self = this;
|
805
|
-
set$(this, 'AuthRedirectable', Ember.Mixin.create({
|
806
|
-
beforeModel: function () {
|
807
|
-
var this$;
|
808
|
-
return get$(self, 'auth').followPromise(this._super.apply(this, arguments), (this$ = this, function () {
|
809
|
-
if (get$(get$(self, 'auth'), 'signedIn'))
|
810
|
-
return;
|
811
|
-
get$(self, 'auth').trigger('authAccess');
|
812
|
-
return this$.transitionTo(get$(get$(self, 'config'), 'route'));
|
813
|
-
}));
|
814
|
-
}
|
815
|
-
}));
|
816
|
-
return set$(get$(this, 'auth'), 'AuthRedirectable', get$(this, 'AuthRedirectable'));
|
817
|
-
}
|
818
|
-
}));// Generated by EmberScript 0.0.7
|
819
|
-
var get$ = Ember.get;
|
820
|
-
var set$ = Ember.set;
|
821
|
-
set$(get$(get$(Em, 'Auth'), 'Module'), 'EmberData', Ember.Object.extend({
|
822
|
-
init: function () {
|
823
|
-
return this.patch();
|
824
|
-
},
|
825
|
-
patch: function () {
|
826
|
-
var self;
|
827
|
-
self = this;
|
828
|
-
if ('undefined' !== typeof DS && null != DS && null != get$(DS, 'RESTAdapter'))
|
829
|
-
return get$(DS, 'RESTAdapter').reopen({
|
830
|
-
ajax: function (url, type, settings) {
|
831
|
-
return this._super(url, type, get$(get$(self, 'auth'), '_strategy').serialize(settings || {}));
|
832
|
-
}
|
833
|
-
});
|
834
|
-
}
|
835
|
-
}));// Generated by EmberScript 0.0.7
|
836
|
-
var get$ = Ember.get;
|
837
|
-
var set$ = Ember.set;
|
838
|
-
set$(get$(get$(Em, 'Auth'), 'Module'), 'EmberModel', Ember.Object.extend({
|
839
|
-
init: function () {
|
840
|
-
return this.patch();
|
841
|
-
},
|
842
|
-
patch: function () {
|
843
|
-
var self;
|
844
|
-
self = this;
|
845
|
-
if (null != Ember.RESTAdapter)
|
846
|
-
return Ember.RESTAdapter.reopen({
|
847
|
-
_ajax: function (url, params, method) {
|
848
|
-
var settings;
|
849
|
-
settings = this.ajaxSettings(url, method);
|
850
|
-
return new (get$(Ember.RSVP, 'Promise'))(function (resolve, reject) {
|
851
|
-
if (params)
|
852
|
-
set$(settings, 'data', params);
|
853
|
-
set$(settings, 'success', function (json) {
|
854
|
-
return Ember.run(null, resolve, json);
|
855
|
-
});
|
856
|
-
set$(settings, 'error', function (jqxhr) {
|
857
|
-
return Ember.run(null, reject, jqxhr);
|
858
|
-
});
|
859
|
-
return get$(get$(self, 'auth'), '_request').send(settings);
|
860
|
-
});
|
861
|
-
}
|
862
|
-
});
|
863
|
-
}
|
864
|
-
}));// Generated by EmberScript 0.0.7
|
865
|
-
var get$ = Ember.get;
|
866
|
-
var set$ = Ember.set;
|
867
|
-
set$(get$(get$(Em, 'Auth'), 'Module'), 'Epf', Ember.Object.extend({
|
868
|
-
init: function () {
|
869
|
-
return this.patch();
|
870
|
-
},
|
871
|
-
patch: function () {
|
872
|
-
var self;
|
873
|
-
self = this;
|
874
|
-
if ('undefined' !== typeof Ep && null != Ep && null != get$(Ep, 'RestAdapter'))
|
875
|
-
return get$(Ep, 'RestAdapter').reopen({
|
876
|
-
ajax: function (url, type, settings) {
|
877
|
-
return this._super(url, type, get$(get$(self, 'auth'), '_strategy').serialize(settings || {}));
|
878
|
-
}
|
879
|
-
});
|
880
|
-
}
|
881
|
-
}));// Generated by EmberScript 0.0.7
|
882
|
-
var get$ = Ember.get;
|
883
|
-
var set$ = Ember.set;
|
884
|
-
set$(get$(get$(Em, 'Auth'), 'Module'), 'Rememberable', Ember.Object.extend({
|
885
|
-
init: function () {
|
886
|
-
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'rememberable'));
|
887
|
-
return this.patch();
|
888
|
-
},
|
889
|
-
syncEvent: function (name, args) {
|
890
|
-
args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
|
891
|
-
switch (name) {
|
892
|
-
case 'signInSuccess':
|
893
|
-
return this.remember();
|
894
|
-
case 'signInError':
|
895
|
-
return this.forget();
|
896
|
-
case 'signOutSuccess':
|
897
|
-
return this.forget();
|
898
|
-
}
|
899
|
-
},
|
900
|
-
recall: function (opts) {
|
901
|
-
var this$;
|
902
|
-
if (null == opts)
|
903
|
-
opts = {};
|
904
|
-
return get$(this, 'auth').wrapPromise((this$ = this, function (resolve, reject) {
|
905
|
-
var token;
|
906
|
-
if (!get$(get$(this$, 'auth'), 'signedIn') && (token = this$.retrieveToken())) {
|
907
|
-
set$(this$, 'fromRecall', true);
|
908
|
-
opts.data || (opts.data = {});
|
909
|
-
get$(opts, 'data')[get$(get$(this$, 'config'), 'tokenKey')] = token;
|
910
|
-
if (null != get$(get$(this$, 'config'), 'endPoint')) {
|
911
|
-
return get$(this$, 'auth').signIn(get$(get$(this$, 'config'), 'endPoint'), opts).then(function () {
|
912
|
-
return resolve();
|
913
|
-
}, function () {
|
914
|
-
return resolve();
|
915
|
-
});
|
916
|
-
} else {
|
917
|
-
return get$(this$, 'auth').signIn(opts).then(function () {
|
918
|
-
return resolve();
|
919
|
-
}, function () {
|
920
|
-
return resolve();
|
921
|
-
});
|
922
|
-
}
|
923
|
-
} else {
|
924
|
-
return resolve();
|
925
|
-
}
|
926
|
-
}));
|
927
|
-
},
|
928
|
-
remember: function () {
|
929
|
-
var token;
|
930
|
-
if (token = null != get$(get$(this, 'auth'), 'response') ? get$(get$(this, 'auth'), 'response')[get$(get$(this, 'config'), 'tokenKey')] : void 0) {
|
931
|
-
if (!(token === this.retrieveToken())) {
|
932
|
-
this.storeToken(token);
|
933
|
-
}
|
934
|
-
} else if (!get$(this, 'fromRecall')) {
|
935
|
-
this.forget();
|
936
|
-
}
|
937
|
-
return set$(this, 'fromRecall', false);
|
938
|
-
},
|
939
|
-
forget: function () {
|
940
|
-
return this.removeToken();
|
941
|
-
},
|
942
|
-
retrieveToken: function () {
|
943
|
-
return get$(get$(this, 'auth'), '_session').retrieve('ember-auth-rememberable');
|
944
|
-
},
|
945
|
-
storeToken: function (token) {
|
946
|
-
return get$(get$(this, 'auth'), '_session').store('ember-auth-rememberable', token, { expires: get$(get$(this, 'config'), 'period') });
|
947
|
-
},
|
948
|
-
removeToken: function () {
|
949
|
-
return get$(get$(this, 'auth'), '_session').remove('ember-auth-rememberable');
|
950
|
-
},
|
951
|
-
patch: function () {
|
952
|
-
var self;
|
953
|
-
self = this;
|
954
|
-
return get$(Em, 'Route').reopen({
|
955
|
-
beforeModel: function () {
|
956
|
-
return get$(self, 'auth').followPromise(this._super.apply(this, arguments), function () {
|
957
|
-
if (get$(get$(self, 'config'), 'autoRecall') && !get$(get$(self, 'auth'), 'signedIn'))
|
958
|
-
return self.recall();
|
959
|
-
});
|
960
|
-
}
|
961
|
-
});
|
962
|
-
}
|
963
|
-
}));// Generated by EmberScript 0.0.7
|
964
|
-
var get$ = Ember.get;
|
965
|
-
var set$ = Ember.set;
|
966
|
-
set$(get$(get$(Em, 'Auth'), 'Module'), 'Timeoutable', Ember.Object.extend({
|
967
|
-
init: function () {
|
968
|
-
var this$;
|
969
|
-
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'timeoutable'));
|
970
|
-
return null != get$(get$(this, 'config'), 'callback') || set$(get$(this, 'config'), 'callback', (this$ = this, function () {
|
971
|
-
return get$(this$, 'auth').signOut();
|
972
|
-
}));
|
973
|
-
},
|
974
|
-
syncEvent: function (name, args) {
|
975
|
-
args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
|
976
|
-
switch (name) {
|
977
|
-
case 'signInSuccess':
|
978
|
-
return this.register();
|
979
|
-
case 'signInError':
|
980
|
-
return this.clear();
|
981
|
-
case 'signOutSuccess':
|
982
|
-
return this.clear();
|
983
|
-
}
|
984
|
-
},
|
985
|
-
timeout: function () {
|
986
|
-
var period;
|
987
|
-
if (get$(this, 'startTime') === null)
|
988
|
-
return;
|
989
|
-
period = get$(get$(this, 'config'), 'period') * 60 * 1e3;
|
990
|
-
if (get$(this, 'startTime') - new Date < period)
|
991
|
-
return;
|
992
|
-
return get$(this, 'config').callback();
|
993
|
-
},
|
994
|
-
register: function () {
|
995
|
-
var period, this$;
|
996
|
-
set$(this, 'startTime', get$(get$(get$(this, 'auth'), '_session'), 'startTime'));
|
997
|
-
period = get$(get$(this, 'config'), 'period') * 60 * 1e3;
|
998
|
-
return setTimeout((this$ = this, function () {
|
999
|
-
return this$.timeout();
|
1000
|
-
}), period);
|
1001
|
-
},
|
1002
|
-
reset: function () {
|
1003
|
-
this.register();
|
1004
|
-
return set$(this, 'startTime', new Date);
|
1005
|
-
},
|
1006
|
-
clear: function () {
|
1007
|
-
return set$(this, 'startTime', null);
|
1008
|
-
}
|
1009
|
-
}));/*
|
1010
|
-
* Purl (A JavaScript URL parser) v2.3.1
|
1011
|
-
* Developed and maintanined by Mark Perkins, mark@allmarkedup.com
|
1012
|
-
* Source repository: https://github.com/allmarkedup/jQuery-URL-Parser
|
1013
|
-
* Licensed under an MIT-style license. See https://github.com/allmarkedup/jQuery-URL-Parser/blob/master/LICENSE for details.
|
1014
|
-
*/
|
1015
|
-
|
1016
|
-
|
1017
|
-
;(function(factory) {
|
1018
|
-
if (typeof define === 'function' && define.amd) {
|
1019
|
-
define(factory);
|
1020
|
-
} else {
|
1021
|
-
window.purl = factory();
|
1022
|
-
}
|
1023
|
-
})(function() {
|
1024
|
-
|
1025
|
-
var tag2attr = {
|
1026
|
-
a : 'href',
|
1027
|
-
img : 'src',
|
1028
|
-
form : 'action',
|
1029
|
-
base : 'href',
|
1030
|
-
script : 'src',
|
1031
|
-
iframe : 'src',
|
1032
|
-
link : 'href',
|
1033
|
-
embed : 'src',
|
1034
|
-
object : 'data'
|
1035
|
-
},
|
1036
|
-
|
1037
|
-
key = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment'], // keys available to query
|
1038
|
-
|
1039
|
-
aliases = { 'anchor' : 'fragment' }, // aliases for backwards compatability
|
1040
|
-
|
1041
|
-
parser = {
|
1042
|
-
strict : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs
|
1043
|
-
loose : /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
|
1044
|
-
},
|
1045
|
-
|
1046
|
-
isint = /^[0-9]+$/;
|
1047
|
-
|
1048
|
-
function parseUri( url, strictMode ) {
|
1049
|
-
var str = decodeURI( url ),
|
1050
|
-
res = parser[ strictMode || false ? 'strict' : 'loose' ].exec( str ),
|
1051
|
-
uri = { attr : {}, param : {}, seg : {} },
|
1052
|
-
i = 14;
|
1053
|
-
|
1054
|
-
while ( i-- ) {
|
1055
|
-
uri.attr[ key[i] ] = res[i] || '';
|
1056
|
-
}
|
1057
|
-
|
1058
|
-
// build query and fragment parameters
|
1059
|
-
uri.param['query'] = parseString(uri.attr['query']);
|
1060
|
-
uri.param['fragment'] = parseString(uri.attr['fragment']);
|
1061
|
-
|
1062
|
-
// split path and fragement into segments
|
1063
|
-
uri.seg['path'] = uri.attr.path.replace(/^\/+|\/+$/g,'').split('/');
|
1064
|
-
uri.seg['fragment'] = uri.attr.fragment.replace(/^\/+|\/+$/g,'').split('/');
|
1065
|
-
|
1066
|
-
// compile a 'base' domain attribute
|
1067
|
-
uri.attr['base'] = uri.attr.host ? (uri.attr.protocol ? uri.attr.protocol+'://'+uri.attr.host : uri.attr.host) + (uri.attr.port ? ':'+uri.attr.port : '') : '';
|
1068
|
-
|
1069
|
-
return uri;
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
function getAttrName( elm ) {
|
1073
|
-
var tn = elm.tagName;
|
1074
|
-
if ( typeof tn !== 'undefined' ) return tag2attr[tn.toLowerCase()];
|
1075
|
-
return tn;
|
1076
|
-
}
|
1077
|
-
|
1078
|
-
function promote(parent, key) {
|
1079
|
-
if (parent[key].length === 0) return parent[key] = {};
|
1080
|
-
var t = {};
|
1081
|
-
for (var i in parent[key]) t[i] = parent[key][i];
|
1082
|
-
parent[key] = t;
|
1083
|
-
return t;
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
function parse(parts, parent, key, val) {
|
1087
|
-
var part = parts.shift();
|
1088
|
-
if (!part) {
|
1089
|
-
if (isArray(parent[key])) {
|
1090
|
-
parent[key].push(val);
|
1091
|
-
} else if ('object' == typeof parent[key]) {
|
1092
|
-
parent[key] = val;
|
1093
|
-
} else if ('undefined' == typeof parent[key]) {
|
1094
|
-
parent[key] = val;
|
1095
|
-
} else {
|
1096
|
-
parent[key] = [parent[key], val];
|
1097
|
-
}
|
1098
|
-
} else {
|
1099
|
-
var obj = parent[key] = parent[key] || [];
|
1100
|
-
if (']' == part) {
|
1101
|
-
if (isArray(obj)) {
|
1102
|
-
if ('' !== val) obj.push(val);
|
1103
|
-
} else if ('object' == typeof obj) {
|
1104
|
-
obj[keys(obj).length] = val;
|
1105
|
-
} else {
|
1106
|
-
obj = parent[key] = [parent[key], val];
|
1107
|
-
}
|
1108
|
-
} else if (~part.indexOf(']')) {
|
1109
|
-
part = part.substr(0, part.length - 1);
|
1110
|
-
if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
|
1111
|
-
parse(parts, obj, part, val);
|
1112
|
-
// key
|
1113
|
-
} else {
|
1114
|
-
if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
|
1115
|
-
parse(parts, obj, part, val);
|
1116
|
-
}
|
1117
|
-
}
|
1118
|
-
}
|
1119
|
-
|
1120
|
-
function merge(parent, key, val) {
|
1121
|
-
if (~key.indexOf(']')) {
|
1122
|
-
var parts = key.split('[');
|
1123
|
-
parse(parts, parent, 'base', val);
|
1124
|
-
} else {
|
1125
|
-
if (!isint.test(key) && isArray(parent.base)) {
|
1126
|
-
var t = {};
|
1127
|
-
for (var k in parent.base) t[k] = parent.base[k];
|
1128
|
-
parent.base = t;
|
1129
|
-
}
|
1130
|
-
if (key !== '') {
|
1131
|
-
set(parent.base, key, val);
|
1132
|
-
}
|
1133
|
-
}
|
1134
|
-
return parent;
|
1135
|
-
}
|
1136
|
-
|
1137
|
-
function parseString(str) {
|
1138
|
-
return reduce(String(str).split(/&|;/), function(ret, pair) {
|
1139
|
-
try {
|
1140
|
-
pair = decodeURIComponent(pair.replace(/\+/g, ' '));
|
1141
|
-
} catch(e) {
|
1142
|
-
// ignore
|
1143
|
-
}
|
1144
|
-
var eql = pair.indexOf('='),
|
1145
|
-
brace = lastBraceInKey(pair),
|
1146
|
-
key = pair.substr(0, brace || eql),
|
1147
|
-
val = pair.substr(brace || eql, pair.length);
|
1148
|
-
|
1149
|
-
val = val.substr(val.indexOf('=') + 1, val.length);
|
1150
|
-
|
1151
|
-
if (key === '') {
|
1152
|
-
key = pair;
|
1153
|
-
val = '';
|
1154
|
-
}
|
1155
|
-
|
1156
|
-
return merge(ret, key, val);
|
1157
|
-
}, { base: {} }).base;
|
1158
|
-
}
|
1159
|
-
|
1160
|
-
function set(obj, key, val) {
|
1161
|
-
var v = obj[key];
|
1162
|
-
if (typeof v === 'undefined') {
|
1163
|
-
obj[key] = val;
|
1164
|
-
} else if (isArray(v)) {
|
1165
|
-
v.push(val);
|
1166
|
-
} else {
|
1167
|
-
obj[key] = [v, val];
|
1168
|
-
}
|
1169
|
-
}
|
1170
|
-
|
1171
|
-
function lastBraceInKey(str) {
|
1172
|
-
var len = str.length,
|
1173
|
-
brace,
|
1174
|
-
c;
|
1175
|
-
for (var i = 0; i < len; ++i) {
|
1176
|
-
c = str[i];
|
1177
|
-
if (']' == c) brace = false;
|
1178
|
-
if ('[' == c) brace = true;
|
1179
|
-
if ('=' == c && !brace) return i;
|
1180
|
-
}
|
1181
|
-
}
|
1182
|
-
|
1183
|
-
function reduce(obj, accumulator){
|
1184
|
-
var i = 0,
|
1185
|
-
l = obj.length >> 0,
|
1186
|
-
curr = arguments[2];
|
1187
|
-
while (i < l) {
|
1188
|
-
if (i in obj) curr = accumulator.call(undefined, curr, obj[i], i, obj);
|
1189
|
-
++i;
|
1190
|
-
}
|
1191
|
-
return curr;
|
1192
|
-
}
|
1193
|
-
|
1194
|
-
function isArray(vArg) {
|
1195
|
-
return Object.prototype.toString.call(vArg) === "[object Array]";
|
1196
|
-
}
|
1197
|
-
|
1198
|
-
function keys(obj) {
|
1199
|
-
var key_array = [];
|
1200
|
-
for ( var prop in obj ) {
|
1201
|
-
if ( obj.hasOwnProperty(prop) ) key_array.push(prop);
|
1202
|
-
}
|
1203
|
-
return key_array;
|
1204
|
-
}
|
1205
|
-
|
1206
|
-
function purl( url, strictMode ) {
|
1207
|
-
if ( arguments.length === 1 && url === true ) {
|
1208
|
-
strictMode = true;
|
1209
|
-
url = undefined;
|
1210
|
-
}
|
1211
|
-
strictMode = strictMode || false;
|
1212
|
-
url = url || window.location.toString();
|
1213
|
-
|
1214
|
-
return {
|
1215
|
-
|
1216
|
-
data : parseUri(url, strictMode),
|
1217
|
-
|
1218
|
-
// get various attributes from the URI
|
1219
|
-
attr : function( attr ) {
|
1220
|
-
attr = aliases[attr] || attr;
|
1221
|
-
return typeof attr !== 'undefined' ? this.data.attr[attr] : this.data.attr;
|
1222
|
-
},
|
1223
|
-
|
1224
|
-
// return query string parameters
|
1225
|
-
param : function( param ) {
|
1226
|
-
return typeof param !== 'undefined' ? this.data.param.query[param] : this.data.param.query;
|
1227
|
-
},
|
1228
|
-
|
1229
|
-
// return fragment parameters
|
1230
|
-
fparam : function( param ) {
|
1231
|
-
return typeof param !== 'undefined' ? this.data.param.fragment[param] : this.data.param.fragment;
|
1232
|
-
},
|
1233
|
-
|
1234
|
-
// return path segments
|
1235
|
-
segment : function( seg ) {
|
1236
|
-
if ( typeof seg === 'undefined' ) {
|
1237
|
-
return this.data.seg.path;
|
1238
|
-
} else {
|
1239
|
-
seg = seg < 0 ? this.data.seg.path.length + seg : seg - 1; // negative segments count from the end
|
1240
|
-
return this.data.seg.path[seg];
|
1241
|
-
}
|
1242
|
-
},
|
1243
|
-
|
1244
|
-
// return fragment segments
|
1245
|
-
fsegment : function( seg ) {
|
1246
|
-
if ( typeof seg === 'undefined' ) {
|
1247
|
-
return this.data.seg.fragment;
|
1248
|
-
} else {
|
1249
|
-
seg = seg < 0 ? this.data.seg.fragment.length + seg : seg - 1; // negative segments count from the end
|
1250
|
-
return this.data.seg.fragment[seg];
|
1251
|
-
}
|
1252
|
-
}
|
1253
|
-
|
1254
|
-
};
|
1255
|
-
|
1256
|
-
}
|
1257
|
-
|
1258
|
-
purl.jQuery = function($){
|
1259
|
-
if ($ != null) {
|
1260
|
-
$.fn.url = function( strictMode ) {
|
1261
|
-
var url = '';
|
1262
|
-
if ( this.length ) {
|
1263
|
-
url = $(this).attr( getAttrName(this[0]) ) || '';
|
1264
|
-
}
|
1265
|
-
return purl( url, strictMode );
|
1266
|
-
};
|
1267
|
-
|
1268
|
-
$.url = purl;
|
1269
|
-
}
|
298
|
+
void function () {
|
299
|
+
var mustImplement;
|
300
|
+
var get$ = Ember.get;
|
301
|
+
var set$ = Ember.set;
|
302
|
+
mustImplement = function (method) {
|
303
|
+
return function () {
|
304
|
+
throw new (get$(Em, 'Error'))('Your strategy adapter ' + this.toString() + ' must implement the required method `' + method + '`');
|
1270
305
|
};
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
})
|
1277
|
-
// Generated by EmberScript 0.0.7
|
306
|
+
};
|
307
|
+
set$(get$(Em, 'Auth'), 'AuthStrategy', Ember.Object.extend({
|
308
|
+
serialize: mustImplement('serialize'),
|
309
|
+
deserialize: mustImplement('deserialize')
|
310
|
+
}));
|
311
|
+
}.call(this);// Generated by EmberScript 0.0.7
|
1278
312
|
void function () {
|
1279
|
-
var
|
313
|
+
var mustImplement;
|
1280
314
|
var get$ = Ember.get;
|
1281
315
|
var set$ = Ember.set;
|
1282
|
-
|
1283
|
-
|
316
|
+
mustImplement = function (method) {
|
317
|
+
return function () {
|
318
|
+
throw new (get$(Em, 'Error'))('Your session adapter ' + this.toString() + ' must implement the required method `' + method + '`');
|
319
|
+
};
|
320
|
+
};
|
321
|
+
set$(get$(Em, 'Auth'), 'AuthSession', Ember.Object.extend({
|
1284
322
|
init: function () {
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
return get$(this, 'auth').wrapPromise((this$ = this, function (resolve, reject) {
|
1294
|
-
if (get$(get$(this$, 'auth'), 'signedIn'))
|
1295
|
-
return resolve();
|
1296
|
-
this$.canonicalizeParams();
|
1297
|
-
if ($.isEmptyObject(get$(this$, 'params')))
|
1298
|
-
return resolve();
|
1299
|
-
set$(opts, 'data', $.extend(true, get$(this$, 'params'), get$(opts, 'data') || {}));
|
1300
|
-
if (null != get$(get$(this$, 'config'), 'endPoint')) {
|
1301
|
-
return get$(this$, 'auth').signIn(get$(get$(this$, 'config'), 'endPoint'), opts).then(function () {
|
1302
|
-
return resolve();
|
1303
|
-
}, function () {
|
1304
|
-
return resolve();
|
1305
|
-
});
|
1306
|
-
} else {
|
1307
|
-
return get$(this$, 'auth').signIn(opts).then(function () {
|
1308
|
-
return resolve();
|
1309
|
-
}, function () {
|
1310
|
-
return resolve();
|
1311
|
-
});
|
1312
|
-
}
|
1313
|
-
}));
|
323
|
+
get$(this, 'auth').reopen({
|
324
|
+
signedIn: get$(Em, 'computed').alias('_session.signedIn'),
|
325
|
+
userId: get$(Em, 'computed').alias('_session.userId'),
|
326
|
+
startTime: get$(Em, 'computed').alias('_session.startTime'),
|
327
|
+
endTime: get$(Em, 'computed').alias('_session.endTime')
|
328
|
+
});
|
329
|
+
get$(this, 'auth').addHandler('signInSuccess', get$(this, 'start'));
|
330
|
+
return get$(this, 'auth').addHandler('signOutSuccess', get$(this, 'end'));
|
1314
331
|
},
|
1315
|
-
|
1316
|
-
|
332
|
+
signedIn: false,
|
333
|
+
userId: null,
|
334
|
+
startTime: null,
|
335
|
+
endTime: null,
|
336
|
+
start: function () {
|
337
|
+
set$(this, 'signedIn', true);
|
338
|
+
set$(this, 'startTime', new Date);
|
339
|
+
return set$(this, 'endTime', null);
|
1317
340
|
},
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
if (!(null != obj)) {
|
1324
|
-
params = {};
|
1325
|
-
} else if ($.isArray(obj)) {
|
1326
|
-
for (var i$ = 0, length$ = obj.length; i$ < length$; ++i$) {
|
1327
|
-
v = obj[i$];
|
1328
|
-
k = i$;
|
1329
|
-
params[k] = v;
|
1330
|
-
}
|
1331
|
-
} else if (typeof obj !== 'object') {
|
1332
|
-
params[String(obj)] = String(obj);
|
1333
|
-
} else {
|
1334
|
-
params = obj;
|
1335
|
-
}
|
1336
|
-
canonicalized = {};
|
1337
|
-
for (k in params) {
|
1338
|
-
v = params[k];
|
1339
|
-
k = String(k);
|
1340
|
-
if (k && k.charAt(get$(k, 'length') - 1) === '/')
|
1341
|
-
k = k.slice(0, -1);
|
1342
|
-
if (typeof v === 'object') {
|
1343
|
-
canonicalized[k] = this.canonicalizeParams(v);
|
1344
|
-
} else {
|
1345
|
-
v = String(v);
|
1346
|
-
if (v && v.charAt(get$(v, 'length') - 1) === '/')
|
1347
|
-
v = v.slice(0, -1);
|
1348
|
-
canonicalized[k] = v;
|
1349
|
-
}
|
1350
|
-
}
|
1351
|
-
return set$(this, 'params', canonicalized);
|
341
|
+
end: function () {
|
342
|
+
set$(this, 'signedIn', false);
|
343
|
+
set$(this, 'userId', null);
|
344
|
+
set$(this, 'startTime', null);
|
345
|
+
return set$(this, 'endTime', new Date);
|
1352
346
|
},
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
get$(Em, 'Route').reopen({
|
1357
|
-
beforeModel: function () {
|
1358
|
-
return get$(self, 'auth').followPromise(this._super.apply(this, arguments), function () {
|
1359
|
-
return self.authenticate();
|
1360
|
-
});
|
1361
|
-
}
|
1362
|
-
});
|
1363
|
-
return get$(Em, 'Router').reopen({
|
1364
|
-
init: function () {
|
1365
|
-
self.retrieveParams();
|
1366
|
-
return this._super.apply(this, arguments);
|
1367
|
-
}
|
1368
|
-
});
|
1369
|
-
}
|
347
|
+
retrieve: mustImplement('retrieve'),
|
348
|
+
store: mustImplement('store'),
|
349
|
+
remove: mustImplement('remove')
|
1370
350
|
}));
|
1371
|
-
}.call(this)
|
351
|
+
}.call(this);// Generated by EmberScript 0.0.7
|
352
|
+
var get$ = Ember.get;
|
353
|
+
get$(Em, 'Auth').reopen({
|
354
|
+
request: 'jquery',
|
355
|
+
response: 'json',
|
356
|
+
strategy: 'token',
|
357
|
+
session: 'cookie',
|
358
|
+
modules: [],
|
359
|
+
signInEndPoint: null,
|
360
|
+
signOutEndPoint: null,
|
361
|
+
baseUrl: null
|
362
|
+
});
|