refinerycms-authentication 2.0.10 → 2.1.0
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/app/controllers/refinery/admin/users_controller.rb +82 -54
- data/app/controllers/refinery/passwords_controller.rb +1 -1
- data/app/controllers/refinery/users_controller.rb +1 -1
- data/app/models/refinery/user.rb +28 -9
- data/app/views/refinery/admin/users/_actions.html.erb +3 -0
- data/app/views/refinery/admin/users/_form.html.erb +6 -4
- data/app/views/refinery/admin/users/_records.html.erb +7 -0
- data/app/views/refinery/passwords/edit.html.erb +1 -1
- data/app/views/refinery/users/new.html.erb +1 -1
- data/config/locales/bg.yml +1 -1
- data/config/locales/cs.yml +3 -3
- data/config/locales/da.yml +1 -1
- data/config/locales/de.yml +1 -1
- data/config/locales/el.yml +1 -1
- data/config/locales/en.yml +3 -2
- data/config/locales/es.yml +1 -1
- data/config/locales/fi.yml +1 -1
- data/config/locales/fr.yml +1 -1
- data/config/locales/hu.yml +72 -0
- data/config/locales/it.yml +1 -1
- data/config/locales/ja.yml +1 -1
- data/config/locales/ko.yml +2 -2
- data/config/locales/lt.yml +1 -1
- data/config/locales/lv.yml +1 -1
- data/config/locales/nb.yml +1 -1
- data/config/locales/nl.yml +37 -35
- data/config/locales/pl.yml +7 -3
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/pt.yml +72 -0
- data/config/locales/rs.yml +1 -1
- data/config/locales/ru.yml +1 -1
- data/config/locales/sk.yml +9 -9
- data/config/locales/sl.yml +1 -1
- data/config/locales/sv.yml +1 -1
- data/config/locales/tr.yml +72 -0
- data/config/locales/uk.yml +98 -0
- data/config/locales/vi.yml +1 -1
- data/config/locales/zh-CN.yml +5 -5
- data/config/locales/zh-TW.yml +1 -1
- data/config/routes.rb +9 -11
- data/db/migrate/20120301234455_add_slug_to_refinery_users.rb +7 -0
- data/lib/refinery/authenticated_system.rb +1 -1
- data/lib/refinery/authentication.rb +1 -0
- data/lib/refinery/authentication/devise.rb +0 -7
- data/lib/refinery/authentication/engine.rb +3 -4
- data/refinerycms-authentication.gemspec +4 -4
- data/spec/controllers/refinery/admin/users_controller_spec.rb +14 -5
- data/spec/factories/user.rb +2 -2
- data/spec/{requests → features}/refinery/admin/users_spec.rb +10 -10
- data/spec/{requests → features}/refinery/passwords_spec.rb +1 -1
- data/spec/{requests → features}/refinery/sessions_spec.rb +12 -11
- data/spec/models/refinery/user_spec.rb +57 -10
- metadata +29 -18
@@ -1,17 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe "
|
4
|
-
|
3
|
+
describe "User admin page" do
|
4
|
+
refinery_login_with :refinery_superuser
|
5
5
|
|
6
6
|
describe "new/create" do
|
7
7
|
def visit_and_fill_form
|
8
8
|
visit refinery.admin_users_path
|
9
9
|
click_link "Add new user"
|
10
10
|
|
11
|
-
fill_in "
|
12
|
-
fill_in "
|
13
|
-
fill_in "
|
14
|
-
fill_in "
|
11
|
+
fill_in "user[username]", :with => "test"
|
12
|
+
fill_in "user[email]", :with => "test@refinerycms.com"
|
13
|
+
fill_in "user[password]", :with => "123456"
|
14
|
+
fill_in "user[password_confirmation]", :with => "123456"
|
15
15
|
end
|
16
16
|
|
17
17
|
it "can create a user" do
|
@@ -43,7 +43,7 @@ describe "manage users" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "edit/update" do
|
46
|
-
it "
|
46
|
+
it "can update a user" do
|
47
47
|
visit refinery.admin_users_path
|
48
48
|
click_link "Edit this user"
|
49
49
|
|
@@ -73,14 +73,14 @@ describe "manage users" do
|
|
73
73
|
describe "destroy" do
|
74
74
|
let!(:user) { FactoryGirl.create(:user, :username => "ugisozols") }
|
75
75
|
|
76
|
-
it "
|
76
|
+
it "can only destroy regular users" do
|
77
77
|
visit refinery.admin_users_path
|
78
78
|
page.should have_selector("a[href='/refinery/users/#{user.username}']")
|
79
|
-
page.should have_no_selector("a[href='/refinery/users
|
79
|
+
page.should have_no_selector("a[href='/refinery/users/#{logged_in_user.username}']")
|
80
80
|
|
81
81
|
click_link "Remove this user"
|
82
82
|
page.should have_content("'#{user.username}' was successfully removed.")
|
83
|
-
page.should have_content("
|
83
|
+
page.should have_content("#{logged_in_user.username} (#{logged_in_user.email})")
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -6,7 +6,7 @@ module Refinery
|
|
6
6
|
let!(:user) { FactoryGirl.create(:refinery_user, :email => "refinery@refinerycms.com") }
|
7
7
|
|
8
8
|
it "asks user to specify email address" do
|
9
|
-
visit refinery.
|
9
|
+
visit refinery.login_path
|
10
10
|
click_link "I forgot my password"
|
11
11
|
page.should have_content("Please enter the email address for your account.")
|
12
12
|
end
|
@@ -8,9 +8,10 @@ module Refinery
|
|
8
8
|
|
9
9
|
before do
|
10
10
|
FactoryGirl.create(:refinery_user, :username => "ugisozols",
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
:password => "123456",
|
12
|
+
:password_confirmation => "123456")
|
13
|
+
|
14
|
+
visit refinery.login_path
|
14
15
|
end
|
15
16
|
|
16
17
|
it "shows login form" do
|
@@ -21,7 +22,7 @@ module Refinery
|
|
21
22
|
|
22
23
|
context "when supplied data is valid" do
|
23
24
|
it "logs in user" do
|
24
|
-
fill_in "
|
25
|
+
fill_in "Username or email", :with => "ugisozols"
|
25
26
|
fill_in "Password", :with => "123456"
|
26
27
|
click_button "Sign in"
|
27
28
|
page.should have_content("Signed in successfully.")
|
@@ -31,7 +32,7 @@ module Refinery
|
|
31
32
|
|
32
33
|
context "when supplied data is not valid" do
|
33
34
|
it "shows flash error" do
|
34
|
-
fill_in "
|
35
|
+
fill_in "Username or email", :with => "Hmmm"
|
35
36
|
fill_in "Password", :with => "Hmmm"
|
36
37
|
click_button "Sign in"
|
37
38
|
page.should have_content("Sorry, your login or password was incorrect.")
|
@@ -48,14 +49,14 @@ module Refinery
|
|
48
49
|
describe 'when there are no users' do
|
49
50
|
it 'allows user creation' do
|
50
51
|
# Verify that we can access the sign up page.
|
51
|
-
visit refinery.
|
52
|
+
visit refinery.admin_root_path
|
52
53
|
page.should have_content("There are no users yet, so we'll set you up first")
|
53
54
|
|
54
55
|
# Fill in user details.
|
55
|
-
fill_in '
|
56
|
-
fill_in '
|
57
|
-
fill_in '
|
58
|
-
fill_in '
|
56
|
+
fill_in 'user[username]', :with => 'rspec'
|
57
|
+
fill_in 'user[email]', :with => 'rspec@example.com'
|
58
|
+
fill_in 'user[password]', :with => 'spectacular'
|
59
|
+
fill_in 'user[password_confirmation]', :with => 'spectacular'
|
59
60
|
|
60
61
|
# Sign up and verify!
|
61
62
|
click_button "Sign up"
|
@@ -92,7 +93,7 @@ module Refinery
|
|
92
93
|
end
|
93
94
|
|
94
95
|
it "redirects to the protected path on login" do
|
95
|
-
fill_in "
|
96
|
+
fill_in "Username or email", :with => "ugisozols"
|
96
97
|
fill_in "Password", :with => "123456"
|
97
98
|
page.click_button "Sign in"
|
98
99
|
current_path.should == protected_path
|
@@ -51,7 +51,7 @@ module Refinery
|
|
51
51
|
context "validations" do
|
52
52
|
# email and password validations are done by including devises validatable
|
53
53
|
# module so those validations are not tested here
|
54
|
-
let(:
|
54
|
+
let(:attributes) do
|
55
55
|
{
|
56
56
|
:username => "Refinery CMS",
|
57
57
|
:email => "refinery@cms.com",
|
@@ -61,17 +61,28 @@ module Refinery
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it "requires username" do
|
64
|
-
User.new(
|
64
|
+
User.new(attributes.merge(:username => "")).should_not be_valid
|
65
65
|
end
|
66
66
|
|
67
67
|
it "rejects duplicate usernames" do
|
68
|
-
User.create!(
|
69
|
-
User.new(
|
68
|
+
User.create!(attributes)
|
69
|
+
User.new(attributes.merge(:email => "another@email.com")).should_not be_valid
|
70
70
|
end
|
71
71
|
|
72
72
|
it "rejects duplicate usernames regardless of case" do
|
73
|
-
User.create!(
|
74
|
-
User.new(
|
73
|
+
User.create!(attributes)
|
74
|
+
User.new(attributes.merge(
|
75
|
+
:username => attributes[:username].upcase,
|
76
|
+
:email => "another@email.com")
|
77
|
+
).should_not be_valid
|
78
|
+
end
|
79
|
+
|
80
|
+
it "rejects duplicate usernames regardless of whitespace" do
|
81
|
+
User.create!(attributes)
|
82
|
+
new_user = User.new(attributes.merge(:username => " Refinery CMS "))
|
83
|
+
new_user.valid?
|
84
|
+
new_user.username.should == 'refinery cms'
|
85
|
+
new_user.should_not be_valid
|
75
86
|
end
|
76
87
|
end
|
77
88
|
|
@@ -152,10 +163,46 @@ module Refinery
|
|
152
163
|
end
|
153
164
|
|
154
165
|
describe "#plugins=" do
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
166
|
+
context "when user is not persisted" do
|
167
|
+
it "does not add plugins for this user" do
|
168
|
+
new_user = FactoryGirl.build(:user)
|
169
|
+
new_user.plugins = ["test"]
|
170
|
+
new_user.plugins.should be_empty
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context "when user is persisted" do
|
175
|
+
it "only assigns plugins with names that are of string type" do
|
176
|
+
user.plugins = [1, :test, false, "refinery_one"]
|
177
|
+
user.plugins.collect(&:name).should eq(["refinery_one"])
|
178
|
+
end
|
179
|
+
|
180
|
+
it "won't raise exception if plugins position is not a number" do
|
181
|
+
Refinery::UserPlugin.create! :name => "refinery_one", :user_id => user.id
|
182
|
+
|
183
|
+
expect { user.plugins = ["refinery_one", "refinery_two"] }.to_not raise_error
|
184
|
+
end
|
185
|
+
|
186
|
+
context "when no plugins assigned" do
|
187
|
+
it "assigns them to user" do
|
188
|
+
user.plugins.should eq([])
|
189
|
+
|
190
|
+
plugin_list = ["refinery_one", "refinery_two", "refinery_three"]
|
191
|
+
user.plugins = plugin_list
|
192
|
+
user.plugins.collect(&:name).should eq(plugin_list)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context "when plugins are already assigned" do
|
197
|
+
it "only adds new ones and deletes ones that are not used" do
|
198
|
+
user.plugins = ["refinery_one", "refinery_two", "refinery_three"]
|
199
|
+
new_plugin_list = ["refinery_one", "refinery_two", "refinery_four"]
|
200
|
+
|
201
|
+
user.plugins = new_plugin_list
|
202
|
+
user.plugins.reload
|
203
|
+
user.plugins.collect(&:name).should eq(new_plugin_list)
|
204
|
+
end
|
205
|
+
end
|
159
206
|
end
|
160
207
|
end
|
161
208
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Arndt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: refinerycms-core
|
@@ -18,42 +18,48 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0
|
21
|
+
version: 2.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 2.0
|
28
|
+
version: 2.1.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: actionmailer
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 3.1.3
|
36
|
+
- - <
|
34
37
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
38
|
+
version: '3.3'
|
36
39
|
type: :runtime
|
37
40
|
prerelease: false
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
39
42
|
requirements:
|
40
|
-
- -
|
43
|
+
- - '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.1.3
|
46
|
+
- - <
|
41
47
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
48
|
+
version: '3.3'
|
43
49
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
50
|
+
name: devise
|
45
51
|
requirement: !ruby/object:Gem::Requirement
|
46
52
|
requirements:
|
47
53
|
- - ~>
|
48
54
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
55
|
+
version: 2.2.3
|
50
56
|
type: :runtime
|
51
57
|
prerelease: false
|
52
58
|
version_requirements: !ruby/object:Gem::Requirement
|
53
59
|
requirements:
|
54
60
|
- - ~>
|
55
61
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
62
|
+
version: 2.2.3
|
57
63
|
description: The default authentication extension for Refinery CMS
|
58
64
|
email: info@refinerycms.com
|
59
65
|
executables: []
|
@@ -98,6 +104,7 @@ files:
|
|
98
104
|
- config/locales/es.yml
|
99
105
|
- config/locales/fi.yml
|
100
106
|
- config/locales/fr.yml
|
107
|
+
- config/locales/hu.yml
|
101
108
|
- config/locales/it.yml
|
102
109
|
- config/locales/ja.yml
|
103
110
|
- config/locales/ko.yml
|
@@ -107,16 +114,20 @@ files:
|
|
107
114
|
- config/locales/nl.yml
|
108
115
|
- config/locales/pl.yml
|
109
116
|
- config/locales/pt-BR.yml
|
117
|
+
- config/locales/pt.yml
|
110
118
|
- config/locales/rs.yml
|
111
119
|
- config/locales/ru.yml
|
112
120
|
- config/locales/sk.yml
|
113
121
|
- config/locales/sl.yml
|
114
122
|
- config/locales/sv.yml
|
123
|
+
- config/locales/tr.yml
|
124
|
+
- config/locales/uk.yml
|
115
125
|
- config/locales/vi.yml
|
116
126
|
- config/locales/zh-CN.yml
|
117
127
|
- config/locales/zh-TW.yml
|
118
128
|
- config/routes.rb
|
119
129
|
- db/migrate/20100913234705_create_refinerycms_authentication_schema.rb
|
130
|
+
- db/migrate/20120301234455_add_slug_to_refinery_users.rb
|
120
131
|
- lib/generators/refinery/authentication/authentication_generator.rb
|
121
132
|
- lib/generators/refinery/authentication/templates/config/initializers/refinery/authentication.rb.erb
|
122
133
|
- lib/refinery/authenticated_system.rb
|
@@ -129,10 +140,10 @@ files:
|
|
129
140
|
- refinerycms-authentication.gemspec
|
130
141
|
- spec/controllers/refinery/admin/users_controller_spec.rb
|
131
142
|
- spec/factories/user.rb
|
143
|
+
- spec/features/refinery/admin/users_spec.rb
|
144
|
+
- spec/features/refinery/passwords_spec.rb
|
145
|
+
- spec/features/refinery/sessions_spec.rb
|
132
146
|
- spec/models/refinery/user_spec.rb
|
133
|
-
- spec/requests/refinery/admin/users_spec.rb
|
134
|
-
- spec/requests/refinery/passwords_spec.rb
|
135
|
-
- spec/requests/refinery/sessions_spec.rb
|
136
147
|
homepage: http://refinerycms.com
|
137
148
|
licenses:
|
138
149
|
- MIT
|
@@ -160,7 +171,7 @@ summary: Authentication extension for Refinery CMS
|
|
160
171
|
test_files:
|
161
172
|
- spec/controllers/refinery/admin/users_controller_spec.rb
|
162
173
|
- spec/factories/user.rb
|
174
|
+
- spec/features/refinery/admin/users_spec.rb
|
175
|
+
- spec/features/refinery/passwords_spec.rb
|
176
|
+
- spec/features/refinery/sessions_spec.rb
|
163
177
|
- spec/models/refinery/user_spec.rb
|
164
|
-
- spec/requests/refinery/admin/users_spec.rb
|
165
|
-
- spec/requests/refinery/passwords_spec.rb
|
166
|
-
- spec/requests/refinery/sessions_spec.rb
|