refinerycms-authentication 1.0.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/app/controllers/refinery/admin/users_controller.rb +100 -0
  2. data/app/controllers/refinery/passwords_controller.rb +51 -0
  3. data/app/controllers/refinery/sessions_controller.rb +26 -0
  4. data/app/controllers/refinery/users_controller.rb +42 -0
  5. data/app/helpers/refinery/sessions_helper.rb +4 -0
  6. data/app/helpers/refinery/users_helper.rb +4 -0
  7. data/app/mailers/refinery/user_mailer.rb +22 -0
  8. data/app/models/refinery/role.rb +18 -0
  9. data/app/models/refinery/roles_users.rb +8 -0
  10. data/app/models/refinery/user.rb +94 -0
  11. data/app/models/refinery/user_plugin.rb +8 -0
  12. data/app/views/refinery/admin/users/_actions.html.erb +6 -0
  13. data/app/views/{admin → refinery/admin}/users/_form.html.erb +15 -19
  14. data/app/views/{admin → refinery/admin}/users/_records.html.erb +1 -1
  15. data/app/views/refinery/admin/users/_user.html.erb +21 -0
  16. data/app/views/refinery/admin/users/_users.html.erb +4 -0
  17. data/app/views/refinery/admin/users/edit.html.erb +1 -0
  18. data/app/views/refinery/admin/users/index.html.erb +6 -0
  19. data/app/views/refinery/admin/users/new.html.erb +1 -0
  20. data/app/views/{layouts → refinery/layouts}/login.html.erb +3 -4
  21. data/app/views/refinery/passwords/edit.html.erb +26 -0
  22. data/app/views/refinery/passwords/new.html.erb +17 -0
  23. data/app/views/{sessions → refinery/sessions}/new.html.erb +6 -8
  24. data/app/views/refinery/user_mailer/reset_notification.html.erb +12 -0
  25. data/app/views/refinery/user_mailer/reset_notification.text.plain.erb +7 -0
  26. data/app/views/refinery/users/new.html.erb +29 -0
  27. data/config/locales/bg.yml +55 -55
  28. data/config/locales/cs.yml +58 -58
  29. data/config/locales/da.yml +55 -55
  30. data/config/locales/de.yml +55 -55
  31. data/config/locales/el.yml +55 -55
  32. data/config/locales/en.yml +55 -55
  33. data/config/locales/es.yml +55 -60
  34. data/config/locales/fi.yml +55 -55
  35. data/config/locales/fr.yml +55 -55
  36. data/config/locales/it.yml +51 -57
  37. data/config/locales/ja.yml +72 -0
  38. data/config/locales/ko.yml +72 -0
  39. data/config/locales/lt.yml +46 -46
  40. data/config/locales/lv.yml +55 -55
  41. data/config/locales/nb.yml +55 -55
  42. data/config/locales/nl.yml +55 -55
  43. data/config/locales/pl.yml +53 -59
  44. data/config/locales/pt-BR.yml +52 -52
  45. data/config/locales/rs.yml +62 -61
  46. data/config/locales/ru.yml +52 -52
  47. data/config/locales/sk.yml +55 -55
  48. data/config/locales/sl.yml +55 -54
  49. data/config/locales/sv.yml +52 -52
  50. data/config/locales/vi.yml +55 -55
  51. data/config/locales/zh-CN.yml +55 -55
  52. data/config/locales/zh-TW.yml +55 -55
  53. data/config/routes.rb +30 -24
  54. data/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb +30 -30
  55. data/lib/refinery/authenticated_system.rb +40 -0
  56. data/lib/refinery/authentication/configuration.rb +9 -0
  57. data/lib/refinery/authentication/engine.rb +36 -0
  58. data/lib/refinery/authentication.rb +29 -0
  59. data/lib/refinerycms-authentication.rb +1 -54
  60. data/refinerycms-authentication.gemspec +14 -109
  61. data/spec/controllers/refinery/admin/users_controller_spec.rb +73 -0
  62. data/spec/factories/user.rb +38 -0
  63. data/spec/models/refinery/user_spec.rb +220 -0
  64. data/spec/requests/refinery/admin/users_spec.rb +49 -0
  65. data/spec/requests/refinery/passwords_spec.rb +84 -0
  66. data/spec/requests/refinery/sessions_spec.rb +62 -0
  67. metadata +109 -124
  68. data/app/controllers/admin/users_controller.rb +0 -86
  69. data/app/controllers/passwords_controller.rb +0 -42
  70. data/app/controllers/sessions_controller.rb +0 -23
  71. data/app/controllers/users_controller.rb +0 -67
  72. data/app/helpers/sessions_helper.rb +0 -2
  73. data/app/helpers/users_helper.rb +0 -2
  74. data/app/mailers/user_mailer.rb +0 -20
  75. data/app/models/role.rb +0 -16
  76. data/app/models/roles_users.rb +0 -6
  77. data/app/models/user.rb +0 -65
  78. data/app/models/user_plugin.rb +0 -6
  79. data/app/views/admin/users/_actions.html.erb +0 -5
  80. data/app/views/admin/users/_user.html.erb +0 -19
  81. data/app/views/admin/users/_users.html.erb +0 -4
  82. data/app/views/admin/users/edit.html.erb +0 -1
  83. data/app/views/admin/users/index.html.erb +0 -6
  84. data/app/views/admin/users/new.html.erb +0 -1
  85. data/app/views/passwords/edit.html.erb +0 -31
  86. data/app/views/passwords/new.html.erb +0 -18
  87. data/app/views/user_mailer/reset_notification.html.erb +0 -12
  88. data/app/views/user_mailer/reset_notification.text.plain.erb +0 -7
  89. data/app/views/users/new.html.erb +0 -41
  90. data/config/locales/jp.yml +0 -72
  91. data/config/locales/lolcat.yml +0 -55
  92. data/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb +0 -11
  93. data/db/migrate/20101206013505_change_to_devise_users_table.rb +0 -27
  94. data/db/migrate/20110106184757_add_remember_created_at_to_users.rb +0 -9
  95. data/db/migrate/20110325213325_remove_password_salt_from_users.rb +0 -13
  96. data/features/lost_password.feature +0 -49
  97. data/features/manage_users.feature +0 -88
  98. data/features/step_definitions/lost_password.rb +0 -8
  99. data/features/step_definitions/user_steps.rb +0 -41
  100. data/features/support/factories.rb +0 -32
  101. data/features/support/paths.rb +0 -24
  102. data/lib/authenticated_system.rb +0 -29
  103. data/lib/gemspec.rb +0 -38
  104. data/lib/generators/refinerycms_authentication_generator.rb +0 -8
  105. data/spec/models/user_spec.rb +0 -152
@@ -1 +0,0 @@
1
- <%= render :partial => "form" %>
@@ -1,31 +0,0 @@
1
- <% content_for :header, t('pick_new_password_for', :scope => 'users.reset', :email => @user.email) %>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
- <%= f.hidden_field :reset_password_token %>
5
-
6
- <%= render :partial => "/shared/admin/error_messages",
7
- :locals => {
8
- :object => @user,
9
- :include_object_name => true
10
- } %>
11
-
12
- <div class='field'>
13
- <%= f.label :password %>
14
- <%= f.password_field :password, :class => 'larger widest' %>
15
- </div>
16
-
17
- <div class='field'>
18
- <%= f.label :password_confirmation %>
19
- <%= f.password_field :password_confirmation, :class => 'larger widest' %>
20
- </div>
21
-
22
- <%= render :partial => "/shared/admin/form_actions",
23
- :locals => {
24
- :f => f,
25
- :continue_editing => false,
26
- :submit_button_text => t('reset_password', :scope => 'users.reset'),
27
- :cancel_url => new_user_session_path,
28
- :cancel_title => nil,
29
- :hide_delete => true
30
- } -%>
31
- <% end -%>
@@ -1,18 +0,0 @@
1
- <% content_for :header, t('enter_email_address', :scope => 'users.forgot') %>
2
-
3
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4
-
5
- <div class='field'>
6
- <%= f.text_field :email, :class => "larger widest",
7
- :placeholder => t('email_address', :scope => 'users.forgot') %>
8
- </div>
9
-
10
- <%= render :partial => "/shared/admin/form_actions",
11
- :locals => {
12
- :f => f,
13
- :continue_editing => false,
14
- :submit_button_text => t('reset_password', :scope => 'users.forgot'),
15
- :cancel_url => session_path(resource_name),
16
- :cancel_title => nil
17
- } -%>
18
- <% end -%>
@@ -1,12 +0,0 @@
1
- <p>
2
- <%= t('reset_request_received_for', :scope => 'user_mailer.reset_notification', :username => @user.username) %>
3
- </p>
4
- <p>
5
- <%= t('visit_this_url', :scope => 'user_mailer.reset_notification') %>:
6
- </p>
7
- <p>
8
- <%= @url %>
9
- </p>
10
- <p>
11
- (<%= t('remain_same_if_no_action', :scope => 'user_mailer.reset_notification') %>)
12
- </p>
@@ -1,7 +0,0 @@
1
- <%= t('reset_request_received_for', :scope => 'user_mailer.reset_notification', :username => @user.username) %>
2
-
3
- <%= t('visit_this_url', :scope => 'user_mailer.reset_notification') %>:
4
-
5
- <%= @url %>
6
-
7
- (<%= t('remain_same_if_no_action', :scope => 'user_mailer.reset_notification') %>)
@@ -1,41 +0,0 @@
1
- <% content_for :header, t('fill_form', :scope => 'users.new') %>
2
- <%= form_for :user, :url => user_registration_path do |f| -%>
3
-
4
- <%= render :partial => "/shared/admin/error_messages",
5
- :locals => {
6
- :object => @user,
7
- :include_object_name => true
8
- } %>
9
-
10
- <div class='field'>
11
- <%= f.label :username %>
12
- <%= f.text_field :username, :class => 'larger widest' %>
13
- </div>
14
- <div class='field'>
15
- <%= f.label :email %>
16
- <%= f.text_field :email, :class => 'larger widest' %>
17
- </div>
18
- <div class='field'>
19
- <%= f.label :password %>
20
- <%= f.password_field :password, :class => 'larger widest' %>
21
- </div>
22
- <div class='field'>
23
- <%= f.label :password_confirmation %>
24
- <%= f.password_field :password_confirmation, :class => 'larger widest' %>
25
- </div>
26
-
27
- <% if just_installed? %>
28
- <% Refinery::Plugins.registered.in_menu.names.sort.each do |plugin| -%>
29
- <%= hidden_field_tag 'user[plugins][]', plugin, :id => "plugins_#{plugin.downcase.gsub(" ", "_")}" %>
30
- <% end -%>
31
- <% end -%>
32
-
33
- <%= render :partial => "/shared/admin/form_actions",
34
- :locals => {
35
- :f => f,
36
- :submit_continue => false,
37
- :submit_button_text => t('sign_up', :scope => 'users.new'),
38
- :hide_delete => true,
39
- :hide_cancel => true
40
- }%>
41
- <% end -%>
@@ -1,72 +0,0 @@
1
- jp:
2
- plugins:
3
- refinery_users:
4
- title: ユーザ
5
- description: ユーザ管理
6
- admin:
7
- users:
8
- delete: ユーザを削除
9
- edit: 変更
10
- update:
11
- cannot_remove_user_plugin_from_current_user: 現在使用中のアカウントから'ユーザ'プラグインを削除する事は出来ません。
12
- form:
13
- blank_password_keeps_current: 空にしておくと現在のパスワードがそのまま保存されます。
14
- plugin_access: プラグインアクセス
15
- role_access: ロールアクセス
16
- enable_all: 全てを有効にする
17
- actions:
18
- create_new_user: ユーザの新規作成
19
- user:
20
- email_user: このユーザにメールを送信
21
- preview: '(%{who}) により %{created_at} に作成されました。'
22
- sessions:
23
- new:
24
- hello_please_sign_in: サインインして下さい
25
- sign_in: サインイン
26
- forgot_password: パスワードを無くしました
27
- users:
28
- setup_website_name_html: "サイトに名前を付けます。<a href='%{link}' name='%{title}'>ここ</a>をクリックして下さい。"
29
- new:
30
- fill_form: 記入して下さい。
31
- sign_up: サインアップ
32
- create:
33
- welcome: '%{who}さん、Refineryへようこそ。'
34
- forgot:
35
- email_address: メールアドレス
36
- enter_email_address: メールアドレスを記入して下さい。
37
- reset_password: パスワードのリセット
38
- blank_email: メールアドレス欄が空欄です
39
- email_not_associated_with_account_html: "「%{email}」は記録に無いアドレスです。<br />今一度確認して下さい。"
40
- email_reset_sent: パスワードをリセットする為のリンクをメールで送信しました。
41
- password_encryption: パスワードの暗号が強化されましたので、パスワードをリセットする必要があります。
42
- reset:
43
- code_invalid: "リセット用のコードは失効したか、無効です。メールに書かれているリンクをコピーするか、パスワードのリセット手続きを初めからやり直して下さい。"
44
- successful: "「%{email}」のパスワードは正しくリセットされました。"
45
- pick_new_password_for: "%{email}の新しいパスワードを入れて下さい。"
46
- reset_password: パスワードをリセット
47
- user_mailer:
48
- reset_notification:
49
- subject: パスワードをリセットして下さい
50
- reset_request_received_for: "%{username}のパスワード変更依頼がありました。"
51
- visit_this_url: ここをクリックしてパスワードを更新して下さい。
52
- remain_same_if_no_action: 何もしなければパスワードの変更はありません。
53
- devise:
54
- failure:
55
- unauthenticated: サインインして下さい。
56
- invalid: ログイン、またはパスワードが違います。
57
- sessions:
58
- signed_in: サインインしました。
59
- roles:
60
- superuser: 管理人
61
- refinery: Refinery
62
- activerecord:
63
- models:
64
- user: ユーザ
65
- attributes:
66
- user:
67
- login: ログイン
68
- username: アカウント名
69
- password: パスワード
70
- password_confirmation: パスワードの確認
71
- email: メールアドレス
72
- remember_me: ユーザ情報を記憶する
@@ -1,55 +0,0 @@
1
- lolcat:
2
- plugins:
3
- refinery_users:
4
- title: USERS
5
- description: MANAGE USERS
6
- admin:
7
- users:
8
- delete: REMOOV DIS USR FOREVR
9
- edit: EDIT DIS USR
10
- update:
11
- cannot_remove_user_plugin_from_current_user: U CANT REMOOV TEH USERS PLUGIN FRUM TEH CURRENTLY LOGGD IN AKOWNT.
12
- form:
13
- blank_password_keeps_current: LEAVIN PASWORD BLANK KEEPS TEH CURRENT PASWORD
14
- enable_all: ENABLE ALL
15
- actions:
16
- create_new_user: ADD NEW USR
17
- user:
18
- email_user: EMAIL DIS USR
19
- preview: '(%{who}) ADDD %{created_at}'
20
- sessions:
21
- new:
22
- hello_please_sign_in: Y HALO THAR! PLZ SIGN IN.
23
- sign_in: SIGN IN
24
- forgot_password: I FORGOT MAH PASWORD
25
- users:
26
- setup_website_name_html: "FURST LETS GIV TEH SIET NAYM. <A HREF=%{link}' name='%{title}>GO HER</A> 2 EDIT UR WEBSIETS NAYM"
27
- new:
28
- fill_form: FILL OUT UR DETAILS BELOW SO DAT WE CAN GIT U STARTD.
29
- sign_up: SIGN UP
30
- create:
31
- welcome: 'WELCOM 2 REFINERY, %{who}'
32
- forgot:
33
- email_address: EMAIL ADDRES
34
- enter_email_address: PLZ ENTR TEH EMAIL ADDRES 4 UR AKOWNT.
35
- reset_password: RESET PASWORD
36
- blank_email: U DID NOT ENTR AN EMAIL ADDRES.
37
- email_not_associated_with_account_html: 'SRY, %{email} ISNT ASSOCIATD WIF ANY ACCOUNTS.<BR />R U SURE U TYPD TEH CORRECT EMAIL ADDRES?'
38
- email_reset_sent: AN EMAIL HAS BEEN SENT 2 U WIF LINK 2 RESET UR PASWORD.
39
- reset:
40
- code_invalid: 'WERE SRY, BUT DIS RESET CODE HAS EXPIRD OR IZ INVALID. IF U R HAVIN ISSUEZ TRY COPYIN AN PASTIN TEH URL FRUM UR EMAIL INTO UR BROWSR OR RESTARTIN TEH RESET PASWORD PROCES.'
41
- successful: 'PASWORD RESET SUCCESFULLY 4 %{email}'
42
- pick_new_password_for: 'PICK NEW PASWORD 4 %{email}'
43
- reset_password: RESET PASWORD
44
- user_mailer:
45
- reset_notification:
46
- subject: LINK 2 RESET UR PASWORD
47
- activerecord:
48
- models:
49
- user: USR
50
- attributes:
51
- user:
52
- login: LOGIN
53
- email: EMAIL
54
- password: PASWORD
55
- remember_me: REMEMBR ME
@@ -1,11 +0,0 @@
1
- class AddMissingIndexesToRolesUsers < ActiveRecord::Migration
2
- def self.up
3
- add_index ::RolesUsers.table_name, [:role_id, :user_id]
4
- add_index ::RolesUsers.table_name, [:user_id, :role_id]
5
- end
6
-
7
- def self.down
8
- remove_index ::RolesUsers.table_name, :column => [:role_id, :user_id]
9
- remove_index ::RolesUsers.table_name, :column => [:user_id, :role_id]
10
- end
11
- end
@@ -1,27 +0,0 @@
1
- class ChangeToDeviseUsersTable < ActiveRecord::Migration
2
- def self.up
3
- add_column ::User.table_name, :current_sign_in_at, :datetime
4
- add_column ::User.table_name, :last_sign_in_at, :datetime
5
- add_column ::User.table_name, :current_sign_in_ip, :string
6
- add_column ::User.table_name, :last_sign_in_ip, :string
7
- add_column ::User.table_name, :sign_in_count, :integer
8
- add_column ::User.table_name, :remember_token, :string
9
- add_column ::User.table_name, :reset_password_token, :string
10
-
11
- rename_column ::User.table_name, :crypted_password, :encrypted_password
12
- rename_column ::User.table_name, :login, :username
13
- end
14
-
15
- def self.down
16
- remove_column ::User.table_name, :current_sign_in_at
17
- remove_column ::User.table_name, :last_sign_in_at
18
- remove_column ::User.table_name, :current_sign_in_ip
19
- remove_column ::User.table_name, :last_sign_in_ip
20
- remove_column ::User.table_name, :sign_in_count
21
- remove_column ::User.table_name, :remember_token
22
- remove_column ::User.table_name, :reset_password_token
23
-
24
- rename_column ::User.table_name, :encrypted_password, :crypted_password
25
- rename_column ::User.table_name, :username, :login
26
- end
27
- end
@@ -1,9 +0,0 @@
1
- class AddRememberCreatedAtToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :remember_created_at, :datetime
4
- end
5
-
6
- def self.down
7
- remove_column :users, :remember_created_at
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- class RemovePasswordSaltFromUsers < ActiveRecord::Migration
2
- def self.up
3
- remove_column :users, :password_salt
4
- # Make the current password invalid :(
5
- User.all.each do |u|
6
- u.update_attribute(:encrypted_password, u.encrypted_password[29..-1])
7
- end
8
- end
9
-
10
- def self.down
11
- add_column :users, :password_salt, :string
12
- end
13
- end
@@ -1,49 +0,0 @@
1
- @refinerycms @authentication @users @users-password
2
- Feature: Lost Password
3
- In order to restore my password
4
- As a lost soul
5
- I want to reset my password
6
-
7
- Background:
8
- Given A Refinery user exists
9
-
10
- @users-password-forgot
11
- Scenario: Forgot Password page (no email entered)
12
- And I am on the forgot password page
13
- When I press "Reset password"
14
- Then I should see "You did not enter an email address."
15
-
16
- @users-password-forgot
17
- Scenario: Forgot Password page (non existing email entered)
18
- Given I am on the forgot password page
19
- And I have a user with email "green@cukes.com"
20
- When I fill in "user_email" with "none@cukes.com"
21
- And I press "Reset password"
22
- Then I should see "Sorry, 'none@cukes.com' isn't associated with any accounts."
23
- And I should see "Are you sure you typed the correct email address?"
24
-
25
- @users-password-forgot
26
- Scenario: Forgot Password page (existing email entered)
27
- Given I am on the forgot password page
28
- And I have a user with email "green@cukes.com"
29
- When I fill in "user_email" with "green@cukes.com"
30
- And I press "Reset password"
31
- Then I should see "An email has been sent to you with a link to reset your password."
32
-
33
- @users-password-reset
34
- Scenario: Reset password page (invalid reset_code)
35
- Given I am not requesting password reset
36
- When I go to the reset password page
37
- Then I should be on the forgot password page
38
- And I should see "We're sorry, but this reset code has expired or is invalid."
39
- And I should see "If you are having issues try copying and pasting the URL from your email into your browser or restarting the reset password process."
40
-
41
- @users-password-reset
42
- Scenario: Reset password page (valid reset_code)
43
- Given I am requesting password reset
44
- When I go to the reset password page
45
- And I fill in "Password" with "cukes"
46
- And I fill in "Password confirmation" with "cukes"
47
- And I press "Reset password"
48
- Then I should be on the admin root
49
- And I should see "Password reset successfully for"
@@ -1,88 +0,0 @@
1
- @refinerycms @authentication @users @users-manage
2
- Feature: Manage Users
3
- In order to control who can access my website's backend
4
- As an administrator
5
- I want to create and manage users
6
-
7
- Background:
8
- Given I have no users
9
-
10
- Scenario: When there are no users, you are invited to create a user
11
- When I go to the home page
12
- Then I should see "There are no users yet, so we'll set you up first."
13
-
14
- @users-add @add
15
- Scenario: When there are no users, you can create a user
16
- When I go to the home page
17
- And I follow "Continue..."
18
- And I should see "Fill out your details below so that we can get you started."
19
- And I fill in "Username" with "cucumber"
20
- And I fill in "Email" with "green@cucumber.com"
21
- And I fill in "Password" with "greenandjuicy"
22
- And I fill in "Password confirmation" with "greenandjuicy"
23
- And I press "Sign up"
24
- Then I should see "Welcome to Refinery, cucumber."
25
- And I should see "Latest Activity"
26
- And I should have 1 user
27
-
28
- @users-list @list
29
- Scenario: User List
30
- Given I have a user named "steven"
31
- And I am a logged in refinery user
32
- When I go to the list of users
33
- Then I should see "steven"
34
-
35
- @users-add @add
36
- Scenario: Create User
37
- Given I have a user named "steven"
38
- And I am a logged in refinery user
39
- When I go to the list of users
40
- And I follow "Add new user"
41
- And I fill in "Username" with "cucumber"
42
- And I fill in "Email" with "green@cucumber.com"
43
- And I fill in "Password" with "greenandjuicy"
44
- And I fill in "Password confirmation" with "greenandjuicy"
45
- And I press "Save"
46
- Then I should be on the list of users
47
- And I should see "cucumber was successfully added."
48
- And I should see "cucumber (green@cucumber.com)"
49
-
50
- @users-edit @edit
51
- Scenario: Edit User
52
- Given I have a user named "steven"
53
- And I am a logged in refinery user
54
- When I go to the list of users
55
- And I follow "Edit this user"
56
- And I fill in "Username" with "cucumber"
57
- And I fill in "Email" with "green@cucumber.com"
58
- And I press "Save"
59
- Then I should be on the list of users
60
- And I should see "cucumber was successfully updated."
61
- And I should see "cucumber (green@cucumber.com)"
62
-
63
- @users-dashboard @add
64
- Scenario: Add User
65
- Given I have a user named "steven"
66
- And I am a logged in refinery user
67
- When I go to the list of users
68
- And I follow "Add new user"
69
- And I fill in "Username" with "marian"
70
- And I fill in "Email" with "green@cucumber.com"
71
- And I fill in "Password" with "greenandjuicy"
72
- And I fill in "Password confirmation" with "greenandjuicy"
73
- And I press "Save"
74
- Then I should be on the list of users
75
- When I go to the Dashboard
76
- Then I should see "Marian user was added"
77
-
78
- @users-dashboard @edit
79
- Scenario: Edit User
80
- Given I have a user named "steven"
81
- And I am a logged in refinery user
82
- When I go to the list of users
83
- And I follow "Edit this user"
84
- And I fill in "Username" with "marian"
85
- And I press "Save"
86
- Then I should be on the list of users
87
- When I go to the Dashboard
88
- Then I should see "Marian user was updated"
@@ -1,8 +0,0 @@
1
- Given /^I have a user with email "(.*)"$/ do |email|
2
- Factory(:refinery_user, :email => email)
3
- end
4
-
5
- Given /^I am (not )?requesting password reset$/ do |action|
6
- @user = Factory(:refinery_user, :updated_at => 11.minutes.ago)
7
- @user.send(:generate_reset_password_token!) if action.nil?
8
- end
@@ -1,41 +0,0 @@
1
- def login
2
- visit new_user_session_path
3
- fill_in("user_login", :with => @user.email)
4
- fill_in("user_password", :with => 'greenandjuicy')
5
- click_button("submit_button")
6
- end
7
-
8
- Given /^I am a logged in refinery user$/i do
9
- @user ||= Factory(:refinery_user)
10
- login
11
- end
12
-
13
- Given /^I am a logged in refinery translator$/i do
14
- @user ||= Factory(:refinery_translator)
15
- login
16
- end
17
-
18
- Given /^I am a logged in customer$/i do
19
- @user ||= Factory(:user)
20
- login
21
- end
22
-
23
- Given /^A Refinery user exists$/i do
24
- @refinery_user ||= Factory(:refinery_user)
25
- end
26
-
27
- Given /^I have a user named "(.*)"$/ do |name|
28
- Factory(:user, :username => name)
29
- end
30
-
31
- Given /^I have a refinery user named "(.*)"$/i do |name|
32
- Factory(:refinery_user, :username => name)
33
- end
34
-
35
- Given /^I have no users$/i do
36
- User.delete_all
37
- end
38
-
39
- Then /^I should have ([0-9]+) users?$/i do |count|
40
- User.count.should == count.to_i
41
- end
@@ -1,32 +0,0 @@
1
- require 'factory_girl'
2
-
3
- FactoryGirl.define do
4
- factory :user do |u|
5
- u.sequence(:username) { |n| "person#{n}" }
6
- u.sequence(:email) { |n| "person#{n}@cucumber.com" }
7
- u.password "greenandjuicy"
8
- u.password_confirmation "greenandjuicy"
9
- end
10
- end
11
-
12
- FactoryGirl.define do
13
- factory :refinery_user, :parent => :user do |u|
14
- u.roles { [ Role[:refinery] ] }
15
-
16
- u.after_create do |user|
17
- Refinery::Plugins.registered.each_with_index do |plugin, index|
18
- user.plugins.create(:name => plugin.name, :position => index)
19
- end
20
- end
21
- end
22
- end
23
-
24
- FactoryGirl.define do
25
- factory :refinery_translator, :parent => :user do |u|
26
- u.roles { [ Role[:refinery], Role[:translator] ] }
27
-
28
- u.after_create do |user|
29
- user.plugins.create(:name => 'refinery_pages', :position => 0)
30
- end
31
- end
32
- end
@@ -1,24 +0,0 @@
1
- module NavigationHelpers
2
- module Refinery
3
- module Authentication
4
- def path_to(page_name)
5
- case page_name
6
-
7
- when /the list of users/
8
- admin_users_path
9
-
10
- when /the login page/
11
- new_user_session_path
12
-
13
- when /the forgot password page/
14
- new_user_password_path
15
-
16
- when /the reset password page/
17
- edit_user_password_path(:reset_password_token => @user.reset_password_token)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,29 +0,0 @@
1
- module AuthenticatedSystem
2
- protected
3
- # Store the URI of the current request in the session.
4
- #
5
- # We can return to this location by calling #redirect_back_or_default.
6
- def store_location
7
- session[:return_to] = request.fullpath
8
- end
9
-
10
- # Redirect to the URI stored by the most recent store_location call or
11
- # to the passed default.
12
- def redirect_back_or_default(default)
13
- redirect_to(session[:return_to] || default)
14
- session[:return_to] = nil
15
- end
16
-
17
- #def current_user
18
- #current_user
19
- #end
20
-
21
- def refinery_user?
22
- user_signed_in? && current_user.has_role?(:refinery)
23
- end
24
-
25
- def self.included(base)
26
- base.send :helper_method, :current_user, :current_user_session, :user_signed_in?, :refinery_user? if base.respond_to? :helper_method
27
- end
28
-
29
- end
data/lib/gemspec.rb DELETED
@@ -1,38 +0,0 @@
1
- # Encoding: UTF-8
2
- require 'pathname'
3
- gempath = Pathname.new(File.expand_path('../../', __FILE__))
4
- require gempath.join('..', 'base', 'lib', 'base', 'refinery')
5
-
6
- gemspec = <<EOF
7
- # Encoding: UTF-8
8
- # DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
9
-
10
- Gem::Specification.new do |s|
11
- s.name = %q{#{gemname = 'refinerycms-authentication'}}
12
- s.version = %q{#{::Refinery.version}}
13
- s.summary = %q{Authentication engine for Refinery CMS}
14
- s.description = %q{The default authentication engine for Refinery CMS}
15
- s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
16
- s.email = %q{info@refinerycms.com}
17
- s.homepage = %q{http://refinerycms.com}
18
- s.rubyforge_project = %q{refinerycms}
19
- s.authors = ['Resolve Digital', 'Philip Arndt', 'David Jones', 'Steven Heidel', 'Uģis Ozols']
20
- s.license = %q{MIT}
21
- s.require_paths = %w(lib)
22
- s.executables = %w(#{Pathname.glob(gempath.join('bin/*')).map{|d| d.relative_path_from(gempath)}.sort.join(" ")})
23
-
24
- s.add_dependency 'refinerycms-core', '= #{::Refinery::Version}'
25
- s.add_dependency 'activerecord', '~> 3.0.10'
26
- s.add_dependency 'devise', '~> 1.4.3'
27
- s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
28
-
29
- s.files = [
30
- '#{%w( **/{*,.rspec,.gitignore,.yardopts} ).map { |file| Pathname.glob(gempath.join(file)) }.flatten.reject{|f|
31
- !f.exist? or f.to_s =~ /(\.(gem|rbc)|tmp(\/.*)?|spec\/lib\/tmp(\/.*)?)$/ or (f.directory? and f.children.empty?)
32
- }.map{|d| d.relative_path_from(gempath)}.uniq.sort.join("',\n '")}'
33
- ]
34
- end
35
- EOF
36
-
37
- (gemfile = gempath.join("#{gemname}.gemspec")).open('w') {|f| f.puts(gemspec)}
38
- puts `cd #{gempath} && gem build #{gemfile}` if ARGV.any?{|a| a == "BUILD=true"}
@@ -1,8 +0,0 @@
1
- require 'refinery/generators'
2
-
3
- class RefinerycmsAuthentication < ::Refinery::Generators::EngineInstaller
4
-
5
- source_root File.expand_path('../../../', __FILE__)
6
- engine_name "authentication"
7
-
8
- end