card 1.16.12 → 1.16.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/card.gemspec +1 -1
- data/db/migrate_core_cards/20130823192433_add_style_cards.rb +39 -24
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +6 -11
- data/db/migrate_core_cards/20151120180631_add_token_expiration.rb +7 -0
- data/db/seed/new/card_actions.yml +396 -388
- data/db/seed/new/card_acts.yml +1 -595
- data/db/seed/new/card_changes.yml +8154 -23619
- data/db/seed/new/card_references.yml +1009 -988
- data/db/seed/new/cards.yml +1445 -1423
- data/db/seed/test/fixtures/card_actions.yml +1375 -1399
- data/db/seed/test/fixtures/card_acts.yml +445 -1063
- data/db/seed/test/fixtures/card_changes.yml +11440 -26881
- data/db/seed/test/fixtures/card_references.yml +1523 -1502
- data/db/seed/test/fixtures/cards.yml +2736 -2715
- data/db/seed/test/seed.rb +7 -10
- data/db/version_core_cards.txt +1 -1
- data/lib/card/auth.rb +65 -19
- data/lib/card/cache.rb +18 -18
- data/lib/card/env.rb +10 -10
- data/lib/card/format.rb +41 -30
- data/lib/card/location.rb +3 -5
- data/lib/card/subcards.rb +0 -3
- data/lib/card/success.rb +14 -11
- data/mod/01_core/set/all/subcards.rb +4 -2
- data/mod/01_core/set/all/trash.rb +4 -1
- data/mod/02_basic_types/set/type/pointer.rb +5 -2
- data/mod/05_email/set/all/notify.rb +85 -73
- data/mod/05_email/spec/set/all/notify_spec.rb +74 -55
- data/mod/05_standard/set/all/comment.rb +18 -12
- data/mod/05_standard/set/all/error.rb +5 -1
- data/mod/05_standard/set/right/account.rb +50 -73
- data/mod/05_standard/set/right/token.rb +49 -2
- data/mod/05_standard/set/self/signin.rb +14 -12
- data/mod/05_standard/set/type/signup.rb +17 -21
- data/mod/05_standard/spec/set/all/account_spec.rb +1 -1
- data/mod/05_standard/spec/set/right/account_spec.rb +76 -52
- data/mod/05_standard/spec/set/right/password_spec.rb +10 -11
- data/mod/05_standard/spec/set/right/token_spec.rb +19 -1
- data/mod/05_standard/spec/set/type/signup_spec.rb +3 -4
- data/spec/lib/card/auth_spec.rb +46 -5
- metadata +5 -4
@@ -3,27 +3,26 @@
|
|
3
3
|
describe Card::Set::Right::Password do
|
4
4
|
|
5
5
|
before :each do
|
6
|
-
@
|
6
|
+
@account = Card::Auth[ 'joe@user.com' ]
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '#update_attributes' do
|
10
|
-
|
11
10
|
it 'should encrypt password' do
|
12
|
-
@
|
13
|
-
expect(@
|
14
|
-
|
11
|
+
@account.password_card.update_attributes! content: 'new password'
|
12
|
+
expect(@account.password).not_to eq('new password')
|
13
|
+
authenticated = Card::Auth.authenticate 'joe@user.com', 'new password'
|
14
|
+
assert_equal @account, authenticated
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should validate password' do
|
18
|
-
password_card = @
|
18
|
+
password_card = @account.password_card
|
19
19
|
password_card.update_attributes content: '2b'
|
20
20
|
expect(password_card.errors[:password]).not_to be_empty
|
21
|
-
|
22
21
|
end
|
23
22
|
|
24
23
|
context 'blank password' do
|
25
24
|
it "shouldn't change the password" do
|
26
|
-
acct = @
|
25
|
+
acct = @account
|
27
26
|
original_pw = acct.password
|
28
27
|
expect(original_pw.size).to be > 10
|
29
28
|
pw_card = acct.password_card
|
@@ -33,9 +32,9 @@ describe Card::Set::Right::Password do
|
|
33
32
|
end
|
34
33
|
|
35
34
|
it "shouldn't break email editing" do
|
36
|
-
@
|
37
|
-
expect(@
|
38
|
-
expect(@
|
35
|
+
@account.update_attributes! subcards: {'+*password'=>'', '+*email'=>'joe2@user.com'}
|
36
|
+
expect(@account.email).to eq('joe2@user.com')
|
37
|
+
expect(@account.password).not_to be_empty
|
39
38
|
end
|
40
39
|
end
|
41
40
|
end
|
@@ -1,5 +1,23 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::Right::Token do
|
4
|
-
|
4
|
+
before do
|
5
|
+
@token = Card['Anonymous+*account'].fetch trait: :token, new: {}
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should get expiration from configuration by default' do
|
9
|
+
expect(@token.term).to eq(Card.config.token_expiry)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should get expiration from card if it exists' do
|
13
|
+
@token.expiration = '3 days'
|
14
|
+
expect(@token.term).to eq(3.days)
|
15
|
+
expect(@token.permanent?).to be false
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should be permanent if expiration is "none"' do
|
19
|
+
@token.expiration = 'none'
|
20
|
+
expect(@token.term).to eq('permanent')
|
21
|
+
expect(@token.permanent?).to be true
|
22
|
+
end
|
5
23
|
end
|
@@ -52,8 +52,8 @@ describe Card::Set::Type::Signup do
|
|
52
52
|
|
53
53
|
it 'creates an authenticable token' do
|
54
54
|
expect(@account.token).to eq(@token)
|
55
|
-
expect(@account.
|
56
|
-
expect(@account.
|
55
|
+
expect(@account.validate_token!(@token)).to be_truthy
|
56
|
+
expect(@account.errors).to be_empty
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'notifies someone' do
|
@@ -83,9 +83,8 @@ describe Card::Set::Type::Signup do
|
|
83
83
|
@account.reload
|
84
84
|
# token gets updated
|
85
85
|
expect(@account.token).not_to eq(@token)
|
86
|
-
success = Card::Env.params[:success]
|
87
86
|
# user notified of expired token
|
88
|
-
expect(success
|
87
|
+
expect(Card::Env.success.message).to match(/expired/)
|
89
88
|
end
|
90
89
|
end
|
91
90
|
|
data/spec/lib/card/auth_spec.rb
CHANGED
@@ -1,17 +1,58 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Auth do
|
4
|
+
before do
|
5
|
+
Card::Auth.current_id = Card::AnonymousID
|
6
|
+
@joeuserid = Card['Joe User'].id
|
7
|
+
end
|
4
8
|
|
5
9
|
it 'should authenticate user' do
|
6
|
-
|
10
|
+
authenticated = Card::Auth.authenticate 'joe@user.com', 'joe_pass'
|
11
|
+
expect(authenticated.left_id).to eq(@joeuserid)
|
7
12
|
end
|
8
13
|
|
9
14
|
it 'should authenticate user despite whitespace' do
|
10
|
-
|
15
|
+
authenticated = Card::Auth.authenticate ' joe@user.com ', ' joe_pass '
|
16
|
+
expect(authenticated.left_id).to eq(@joeuserid)
|
11
17
|
end
|
12
18
|
|
13
19
|
it 'should authenticate user with weird email capitalization' do
|
14
|
-
|
20
|
+
authenticated = Card::Auth.authenticate 'JOE@user.com', 'joe_pass'
|
21
|
+
expect(authenticated.left_id).to eq(@joeuserid)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set current directly from email' do
|
25
|
+
Card::Auth.set_current_from_mark 'joe@user.com'
|
26
|
+
expect(Card::Auth.current_id).to eq(@joeuserid)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should set current directly from id when mark is id' do
|
30
|
+
Card::Auth.set_current_from_mark @joeuserid
|
31
|
+
expect(Card::Auth.current_id).to eq(@joeuserid)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should set current directly from id when mark is id' do
|
35
|
+
Card::Auth.set_current_from_mark @joeuserid
|
36
|
+
expect(Card::Auth.current_id).to eq(@joeuserid)
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with token' do
|
40
|
+
before do
|
41
|
+
@joeadmin = Card['Joe Admin']
|
42
|
+
@token = 'abcd'
|
43
|
+
Card::Auth.as_bot do
|
44
|
+
@joeadmin.account.token_card.update_attributes! content: @token
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should set current from token' do
|
49
|
+
Card::Auth.set_current_from_token @token
|
50
|
+
expect(Card::Auth.current_id).to eq(@joeadmin.id)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should set arbitrary current from token on authorized account' do
|
54
|
+
Card::Auth.set_current_from_token @token, @joeuserid
|
55
|
+
expect(Card::Auth.current_id).to eq(@joeuserid)
|
56
|
+
end
|
15
57
|
end
|
16
|
-
|
17
|
-
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-11-
|
14
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: smartname
|
@@ -103,14 +103,14 @@ dependencies:
|
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
106
|
+
version: 0.4.0
|
107
107
|
type: :runtime
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
113
|
+
version: 0.4.0
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: coderay
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,6 +308,7 @@ files:
|
|
308
308
|
- db/migrate_core_cards/20150824135418_update_file_history.rb
|
309
309
|
- db/migrate_core_cards/20150903130006_attachment_upload_cards.rb
|
310
310
|
- db/migrate_core_cards/20150910085603_remove_performance_log_card.rb
|
311
|
+
- db/migrate_core_cards/20151120180631_add_token_expiration.rb
|
311
312
|
- db/migrate_core_cards/data/1.11_help_text.json
|
312
313
|
- db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss
|
313
314
|
- db/migrate_core_cards/data/1.12_stylesheets/common.scss
|