ember-auth-module-rememberable-source 1.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-module-rememberable.js +86 -0
- data/lib/ember/auth/module/rememberable/source.rb +15 -0
- metadata +74 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: af9a9a46d485f1df6c6852623e08fe5844f9e307
|
4
|
+
data.tar.gz: 37be7de3ab069374bf89525c3a2541075389f133
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 981ed06d081d2100951c3da88899b4aba356ad6ea2a1f8764a391c3e66b8a63a2c48c9f2268359ecadf124ba930e9da24a378cb6173e14c5309f3b2e0dfc336c
|
7
|
+
data.tar.gz: 2a6327f40ceee160959499f2b0b82a6834d29961585414e8f1136bcb8ae4d6f91d4a5ecded130f2131796bade760b525cd339802c4cdd364263f7610d088fb3f
|
@@ -0,0 +1,86 @@
|
|
1
|
+
// Generated by EmberScript 0.0.7
|
2
|
+
var get$ = Ember.get;
|
3
|
+
Em.onLoad('Ember.Application', function (application) {
|
4
|
+
return application.initializer({
|
5
|
+
name: 'ember-auth.module.rememberable',
|
6
|
+
before: 'ember-auth-load',
|
7
|
+
initialize: function (container, app) {
|
8
|
+
return app.register('authModule:rememberable', get$(get$(Em, 'Auth'), 'RememberableAuthModule'));
|
9
|
+
}
|
10
|
+
});
|
11
|
+
});// Generated by EmberScript 0.0.7
|
12
|
+
var get$ = Ember.get;
|
13
|
+
var set$ = Ember.set;
|
14
|
+
set$(get$(Em, 'Auth'), 'RememberableAuthModule', Ember.Object.extend({
|
15
|
+
init: function () {
|
16
|
+
null != get$(this, 'config') || set$(this, 'config', get$(get$(this, 'auth'), 'rememberable'));
|
17
|
+
this.patch();
|
18
|
+
get$(this, 'auth').addHandler('signInSuccess', get$(this, 'remember'));
|
19
|
+
get$(this, 'auth').addHandler('signInError', get$(this, 'forget'));
|
20
|
+
return get$(this, 'auth').addHandler('signOutSuccess', get$(this, 'forget'));
|
21
|
+
},
|
22
|
+
recall: function (opts) {
|
23
|
+
var token;
|
24
|
+
if (null == opts)
|
25
|
+
opts = {};
|
26
|
+
if (!get$(get$(this, 'auth'), 'signedIn') && (token = this.retrieveToken())) {
|
27
|
+
opts.data || (opts.data = {});
|
28
|
+
get$(opts, 'data')[get$(get$(this, 'config'), 'tokenKey')] = token;
|
29
|
+
if (null != get$(get$(this, 'config'), 'endPoint')) {
|
30
|
+
return get$(this, 'auth').signIn(get$(get$(this, 'config'), 'endPoint'), opts);
|
31
|
+
} else {
|
32
|
+
return get$(this, 'auth').signIn(opts);
|
33
|
+
}
|
34
|
+
} else {
|
35
|
+
return new (get$(get$(Em, 'RSVP'), 'resolve'));
|
36
|
+
}
|
37
|
+
},
|
38
|
+
remember: function (data) {
|
39
|
+
var token;
|
40
|
+
this.forget();
|
41
|
+
if (token = data[get$(get$(this, 'config'), 'tokenKey')])
|
42
|
+
if (!(token === this.retrieveToken())) {
|
43
|
+
return this.storeToken(token);
|
44
|
+
}
|
45
|
+
},
|
46
|
+
forget: function () {
|
47
|
+
return this.removeToken();
|
48
|
+
},
|
49
|
+
retrieveToken: function () {
|
50
|
+
return get$(get$(this, 'auth'), '_session').retrieve('ember-auth-rememberable');
|
51
|
+
},
|
52
|
+
storeToken: function (token) {
|
53
|
+
return get$(get$(this, 'auth'), '_session').store('ember-auth-rememberable', token, { expires: get$(get$(this, 'config'), 'period') });
|
54
|
+
},
|
55
|
+
removeToken: function () {
|
56
|
+
return get$(get$(this, 'auth'), '_session').remove('ember-auth-rememberable');
|
57
|
+
},
|
58
|
+
patch: function () {
|
59
|
+
var self;
|
60
|
+
self = this;
|
61
|
+
return get$(Em, 'Route').reopen({
|
62
|
+
beforeModel: function () {
|
63
|
+
var ret;
|
64
|
+
ret = this._super.apply(this, arguments);
|
65
|
+
if (!(get$(get$(self, 'config'), 'autoRecall') && !get$(get$(self, 'auth'), 'signedIn')))
|
66
|
+
return ret;
|
67
|
+
if (typeof get$(ret, 'then') === 'function') {
|
68
|
+
return ret.then(function () {
|
69
|
+
return self.recall();
|
70
|
+
});
|
71
|
+
} else {
|
72
|
+
return self.recall();
|
73
|
+
}
|
74
|
+
}
|
75
|
+
});
|
76
|
+
}
|
77
|
+
}));// Generated by EmberScript 0.0.7
|
78
|
+
var get$ = Ember.get;
|
79
|
+
get$(Em, 'Auth').reopen({
|
80
|
+
rememberable: {
|
81
|
+
tokenKey: null,
|
82
|
+
period: 14,
|
83
|
+
autoRecall: true,
|
84
|
+
endPoint: null
|
85
|
+
}
|
86
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ember
|
2
|
+
module Auth
|
3
|
+
module Module
|
4
|
+
module Rememberable
|
5
|
+
module Source
|
6
|
+
def self.bundled_path
|
7
|
+
path = File.join '..', '..', '..', '..', '..', '..', \
|
8
|
+
'dist', 'ember-auth-module-rememberable.js'
|
9
|
+
File.expand_path path, __FILE__
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ember-auth-module-rememberable-source
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- heartsentwined
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ember-source
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ember-auth-source
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '9.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '9.0'
|
41
|
+
description: Ember-auth rememberable module source code wrapper for ruby libs.
|
42
|
+
email:
|
43
|
+
- heartsentwined.me@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- dist/ember-auth-module-rememberable.js
|
49
|
+
- lib/ember/auth/module/rememberable/source.rb
|
50
|
+
homepage: https://github.com/heartsentwined/ember-auth-module-rememberable
|
51
|
+
licenses:
|
52
|
+
- MIT
|
53
|
+
metadata: {}
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 2.0.3
|
71
|
+
signing_key:
|
72
|
+
specification_version: 4
|
73
|
+
summary: Ember-auth rememberable module source code wrapper
|
74
|
+
test_files: []
|