refinerycms-authentication-devise 1.0.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.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +89 -0
  3. data/.travis.yml +15 -0
  4. data/Gemfile +50 -0
  5. data/Rakefile +20 -0
  6. data/app/controllers/refinery/authentication/devise/admin/users_controller.rb +147 -0
  7. data/app/controllers/refinery/authentication/devise/passwords_controller.rb +58 -0
  8. data/app/controllers/refinery/authentication/devise/sessions_controller.rb +39 -0
  9. data/app/controllers/refinery/authentication/devise/users_controller.rb +50 -0
  10. data/app/decorators/controllers/action_controller_base_decorator.rb +25 -0
  11. data/app/decorators/controllers/refinery/admin_controller_decorator.rb +20 -0
  12. data/app/decorators/controllers/refinery/application_controller_decorator.rb +7 -0
  13. data/app/mailers/refinery/authentication/devise/user_mailer.rb +26 -0
  14. data/app/models/refinery/authentication/devise/nil_user.rb +31 -0
  15. data/app/models/refinery/authentication/devise/role.rb +22 -0
  16. data/app/models/refinery/authentication/devise/roles_users.rb +12 -0
  17. data/app/models/refinery/authentication/devise/user.rb +166 -0
  18. data/app/models/refinery/authentication/devise/user_plugin.rb +11 -0
  19. data/app/views/refinery/authentication/devise/admin/users/_actions.html.erb +7 -0
  20. data/app/views/refinery/authentication/devise/admin/users/_form.html.erb +94 -0
  21. data/app/views/refinery/authentication/devise/admin/users/_records.html.erb +10 -0
  22. data/app/views/refinery/authentication/devise/admin/users/_user.html.erb +23 -0
  23. data/app/views/refinery/authentication/devise/admin/users/_users.html.erb +4 -0
  24. data/app/views/refinery/authentication/devise/admin/users/edit.html.erb +1 -0
  25. data/app/views/refinery/authentication/devise/admin/users/index.html.erb +6 -0
  26. data/app/views/refinery/authentication/devise/admin/users/new.html.erb +1 -0
  27. data/app/views/refinery/authentication/devise/passwords/edit.html.erb +26 -0
  28. data/app/views/refinery/authentication/devise/passwords/new.html.erb +17 -0
  29. data/app/views/refinery/authentication/devise/sessions/new.html.erb +27 -0
  30. data/app/views/refinery/authentication/devise/user_mailer/reset_notification.html.erb +12 -0
  31. data/app/views/refinery/authentication/devise/user_mailer/reset_notification.text.plain.erb +7 -0
  32. data/app/views/refinery/authentication/devise/users/new.html.erb +29 -0
  33. data/app/views/refinery/layouts/login.html.erb +22 -0
  34. data/bin/rails +5 -0
  35. data/bin/rake +21 -0
  36. data/bin/rspec +22 -0
  37. data/bin/spring +18 -0
  38. data/config/locales/bg.yml +73 -0
  39. data/config/locales/ca.yml +75 -0
  40. data/config/locales/cs.yml +77 -0
  41. data/config/locales/da.yml +73 -0
  42. data/config/locales/de.yml +73 -0
  43. data/config/locales/el.yml +73 -0
  44. data/config/locales/en.yml +77 -0
  45. data/config/locales/es.yml +73 -0
  46. data/config/locales/fi.yml +73 -0
  47. data/config/locales/fr.yml +73 -0
  48. data/config/locales/hu.yml +73 -0
  49. data/config/locales/it.yml +77 -0
  50. data/config/locales/ja.yml +73 -0
  51. data/config/locales/ko.yml +73 -0
  52. data/config/locales/lt.yml +56 -0
  53. data/config/locales/lv.yml +73 -0
  54. data/config/locales/nb.yml +73 -0
  55. data/config/locales/nl.yml +77 -0
  56. data/config/locales/pl.yml +73 -0
  57. data/config/locales/pt-BR.yml +69 -0
  58. data/config/locales/pt.yml +73 -0
  59. data/config/locales/rs.yml +73 -0
  60. data/config/locales/ru.yml +70 -0
  61. data/config/locales/sk.yml +73 -0
  62. data/config/locales/sl.yml +62 -0
  63. data/config/locales/sv.yml +65 -0
  64. data/config/locales/tr.yml +73 -0
  65. data/config/locales/uk.yml +71 -0
  66. data/config/locales/vi.yml +73 -0
  67. data/config/locales/zh-CN.yml +73 -0
  68. data/config/locales/zh-TW.yml +74 -0
  69. data/config/routes.rb +49 -0
  70. data/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb +43 -0
  71. data/db/migrate/20120301234455_add_slug_to_refinery_users.rb +7 -0
  72. data/db/migrate/20130805143059_add_full_name_to_refinery_users.rb +5 -0
  73. data/db/migrate/20150503125200_rename_tables_to_new_namespace.rb +17 -0
  74. data/lib/generators/refinery/authentication/devise/generator.rb +18 -0
  75. data/lib/generators/refinery/authentication/devise/templates/config/initializers/refinery/authentication/devise.rb.erb +8 -0
  76. data/lib/refinery/authentication/devise/authorisation_adapter.rb +36 -0
  77. data/lib/refinery/authentication/devise/authorisation_manager.rb +30 -0
  78. data/lib/refinery/authentication/devise/configuration.rb +22 -0
  79. data/lib/refinery/authentication/devise/engine.rb +43 -0
  80. data/lib/refinery/authentication/devise/initialiser.rb +228 -0
  81. data/lib/refinery/authentication/devise/system.rb +63 -0
  82. data/lib/refinery/authentication/devise.rb +26 -0
  83. data/lib/refinerycms-authentication-devise.rb +1 -0
  84. data/license.md +21 -0
  85. data/readme.md +11 -0
  86. data/refinerycms-authentication-devise.gemspec +22 -0
  87. data/spec/controllers/refinery/authentication/devise/admin/users_controller_spec.rb +90 -0
  88. data/spec/factories/user.rb +27 -0
  89. data/spec/features/refinery/authentication/devise/admin/users_spec.rb +88 -0
  90. data/spec/features/refinery/authentication/devise/passwords_spec.rb +71 -0
  91. data/spec/features/refinery/authentication/devise/sessions_spec.rb +103 -0
  92. data/spec/lib/refinery/authentication/devise/configuration_spec.rb +41 -0
  93. data/spec/models/refinery/user_spec.rb +285 -0
  94. data/spec/spec_helper.rb +27 -0
  95. data/spec/support/refinery/authentication/devise/controller_macros.rb +48 -0
  96. data/spec/support/refinery/authentication/devise/feature_macros.rb +26 -0
  97. data/tasks/rspec.rake +4 -0
  98. metadata +225 -0
@@ -0,0 +1,166 @@
1
+ require 'devise'
2
+ require 'friendly_id'
3
+
4
+ module Refinery
5
+ module Authentication
6
+ module Devise
7
+ class User < Refinery::Core::BaseModel
8
+
9
+ extend FriendlyId
10
+
11
+ has_and_belongs_to_many :roles, join_table: :refinery_authentication_devise_roles_users
12
+
13
+ has_many :plugins, -> { order('position ASC') },
14
+ class_name: "Refinery::Authentication::Devise::UserPlugin", dependent: :destroy
15
+
16
+ friendly_id :username, use: [:slugged]
17
+
18
+ # Include default devise modules. Others available are:
19
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable
20
+ if self.respond_to?(:devise)
21
+ devise :database_authenticatable, :registerable, :recoverable, :rememberable,
22
+ :trackable, :validatable, authentication_keys: [:login]
23
+ end
24
+
25
+ # Setup accessible (or protected) attributes for your model
26
+ # :login is a virtual attribute for authenticating by either username or email
27
+ # This is in addition to a real persisted field like 'username'
28
+ attr_accessor :login
29
+
30
+ validates :username, presence: true, uniqueness: true
31
+ before_validation :downcase_username, :strip_username
32
+
33
+ class << self
34
+ # Find user by email or username.
35
+ # https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address
36
+ def find_for_database_authentication(conditions)
37
+ value = conditions[authentication_keys.first]
38
+ where(["username = :value OR email = :value", { value: value }]).first
39
+ end
40
+
41
+ def find_or_initialize_with_error_by_reset_password_token(original_token)
42
+ find_or_initialize_with_error_by :reset_password_token,
43
+ ::Devise.token_generator.digest(self, :reset_password_token, original_token)
44
+ end
45
+ end
46
+
47
+ # Call devise reset function, taken from
48
+ # https://github.com/plataformatec/devise/blob/v3.2.4/lib/devise/models/recoverable.rb#L45-L56
49
+ def generate_reset_password_token!
50
+ raw, enc = ::Devise.token_generator.generate(self.class, :reset_password_token)
51
+ update_attributes(
52
+ :reset_password_token => enc,
53
+ :reset_password_sent_at => Time.now.utc
54
+ )
55
+ raw
56
+ end
57
+
58
+ def plugins=(plugin_names)
59
+ return :can_not_set_plugins_when_not_persisted unless persisted?
60
+
61
+ filtered_names = filter_existing_plugins_for(string_plugin_names(plugin_names))
62
+ create_plugins_for(filtered_names)
63
+ end
64
+
65
+ def active_plugins
66
+ @active_plugins ||= Refinery::Plugins.new(
67
+ Refinery::Plugins.registered.select do |plugin|
68
+ has_role?(:superuser) || authorised_plugins.include?(plugin.name)
69
+ end
70
+ )
71
+ end
72
+
73
+ def authorised_plugins
74
+ plugins.collect(&:name) | ::Refinery::Plugins.always_allowed.names
75
+ end
76
+ alias_method :authorized_plugins, :authorised_plugins
77
+
78
+ # Returns a URL to the first plugin with a URL in the menu. Used for
79
+ # admin user's root admin url.
80
+ # See Refinery::Core::NilUser#landing_url.
81
+ def landing_url
82
+ active_plugins.in_menu.first_url_in_menu
83
+ end
84
+
85
+ def can_delete?(user_to_delete = self)
86
+ user_to_delete.persisted? &&
87
+ !user_to_delete.has_role?(:superuser) &&
88
+ ::Refinery::Authentication::Devise::Role[:refinery].users.any? &&
89
+ id != user_to_delete.id
90
+ end
91
+
92
+ def can_edit?(user_to_edit = self)
93
+ user_to_edit.persisted? && (user_to_edit == self || self.has_role?(:superuser))
94
+ end
95
+
96
+ def add_role(title)
97
+ raise ArgumentException, "Role should be the title of the role not a role object." if title.is_a?(::Refinery::Authentication::Devise::Role)
98
+ roles << ::Refinery::Authentication::Devise::Role[title] unless has_role?(title)
99
+ end
100
+
101
+ def has_role?(title)
102
+ raise ArgumentException, "Role should be the title of the role not a role object." if title.is_a?(::Refinery::Authentication::Devise::Role)
103
+ roles.any?{ |r| r.title == title.to_s.camelize}
104
+ end
105
+
106
+ def create_first
107
+ if valid?
108
+ # first we need to save user
109
+ save
110
+ # add refinery role
111
+ add_role(:refinery)
112
+ # add superuser role if there are no other users
113
+ add_role(:superuser) if ::Refinery::Authentication::Devise::Role[:refinery].users.count == 1
114
+ # add plugins
115
+ self.plugins = Refinery::Plugins.registered.in_menu.names
116
+ end
117
+
118
+ # return true/false based on validations
119
+ valid?
120
+ end
121
+
122
+ def to_s
123
+ (full_name.presence || username).to_s
124
+ end
125
+
126
+ private
127
+ # To ensure uniqueness without case sensitivity we first downcase the username.
128
+ # We do this here and not in SQL is that it will otherwise bypass indexes using LOWER:
129
+ # SELECT 1 FROM "refinery_users" WHERE LOWER("refinery_users"."username") = LOWER('UsErNAME') LIMIT 1
130
+ def downcase_username
131
+ self.username = self.username.downcase if self.username?
132
+ end
133
+
134
+ # To ensure that we aren't creating "admin" and "admin " as the same thing.
135
+ # Also ensures that "admin user" and "admin user" are the same thing.
136
+ def strip_username
137
+ self.username = self.username.strip.gsub(/\ {2,}/, ' ') if self.username?
138
+ end
139
+
140
+ def string_plugin_names(plugin_names)
141
+ plugin_names.select{ |plugin_name| plugin_name.is_a?(String) }
142
+ end
143
+
144
+ def create_plugins_for(plugin_names)
145
+ plugin_names.each { |plugin_name| plugins.create name: plugin_name, position: plugin_position}
146
+ end
147
+
148
+ def plugin_position
149
+ plugins.select(:position).map{ |p| p.position.to_i}.max.to_i + 1
150
+ end
151
+
152
+ def filter_existing_plugins_for(plugin_names)
153
+ assigned_plugins = plugins.load
154
+ assigned_plugins.each do |assigned_plugin|
155
+ if plugin_names.include?(assigned_plugin.name)
156
+ plugin_names.delete(assigned_plugin.name)
157
+ else
158
+ assigned_plugin.destroy
159
+ end
160
+ end
161
+ plugin_names
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,11 @@
1
+ module Refinery
2
+ module Authentication
3
+ module Devise
4
+ class UserPlugin < Refinery::Core::BaseModel
5
+
6
+ belongs_to :user
7
+
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ <ul>
2
+ <li><%= render '/refinery/admin/search', :url => refinery.authentication_devise_admin_users_path -%></li>
3
+ <li>
4
+ <%= link_to t('.create_new_user'),
5
+ refinery.new_authentication_devise_admin_user_path, :class => "add_icon" %>
6
+ </li>
7
+ </ul>
@@ -0,0 +1,94 @@
1
+ <%= form_for [refinery, :authentication, :devise, :admin, @user] do |f| %>
2
+
3
+ <%= render '/refinery/admin/error_messages',
4
+ :object => @user,
5
+ :include_object_name => true %>
6
+
7
+ <div class='field'>
8
+ <%= f.label :username %>
9
+ <%= f.text_field :username %>
10
+ </div>
11
+ <div class='field'>
12
+ <%= f.label :full_name %>
13
+ <%= f.text_field :full_name %>
14
+ </div>
15
+ <div class='field'>
16
+ <%= f.label :email %>
17
+ <%= f.text_field :email %>
18
+ </div>
19
+ <div class='field'>
20
+ <%= f.label :password %>
21
+ <%= f.password_field :password, :autocomplete => 'off' %>
22
+ <% if @user.persisted? %>
23
+ <br>
24
+ <%= content_tag(:span, t('.blank_password_keeps_current')) %>
25
+ <% end %>
26
+ </div>
27
+ <div class='field'>
28
+ <%= f.label :password_confirmation %>
29
+ <%= f.password_field :password_confirmation, :autocomplete => 'off' %>
30
+ </div>
31
+ <div class='field plugin_access'>
32
+ <span class='label_with_help'>
33
+ <%= f.label :plugin_access, t('.plugin_access'), :class => "title_label" %>
34
+ <%= link_to "(#{t('.enable_all')})", "", :id => "user_plugins_enable_all" %>
35
+ </span>
36
+ <ul id='plugins' class='checkboxes'>
37
+ <% @available_plugins.each do |plugin| -%>
38
+ <% if Refinery::Plugins.always_allowed.names.include?(plugin[:name]) or
39
+ (plugin[:name] == 'refinery_authentication_devise' && @user.id == current_refinery_user.id) %>
40
+ <%= hidden_field_tag 'user[plugins][]', plugin[:name],
41
+ :id => "plugins_#{plugin[:name]}" %>
42
+ <% else %>
43
+ <li>
44
+ <%= check_box_tag 'user[plugins][]', plugin[:name],
45
+ @selected_plugin_names.include?(plugin[:name]),
46
+ :id => "plugins_#{plugin[:name]}" %>
47
+ <%= f.label 'user[plugins][]',
48
+ t('title', :scope => "refinery.plugins.#{plugin[:name].downcase}", :default => plugin[:title]),
49
+ :class => "stripped",
50
+ :for => "plugins_#{plugin[:name]}" %>
51
+ </li>
52
+ <% end %>
53
+ <% end %>
54
+ </ul>
55
+ </div>
56
+
57
+ <% if current_refinery_user.has_role?(:superuser) && Refinery::Authentication::Devise.superuser_can_assign_roles %>
58
+ <div class='field role_access'>
59
+ <span class='label_with_help'>
60
+ <%= f.label :role_access, t('.role_access'), :class => "title_label" %>
61
+ </span>
62
+ <ul id='roles' class='checkboxes'>
63
+ <% @available_roles.each do |role|
64
+ downcased_title = (title = role[:title]).downcase -%>
65
+ <li>
66
+ <%= check_box_tag 'user[roles][]', downcased_title, @user.has_role?(title),
67
+ :id => "roles_#{downcased_title}" %>
68
+ <%= f.label 'user[roles][]',
69
+ t(downcased_title, :scope => 'refinery.authentication.devise.roles', :default => title),
70
+ :class => 'stripped',
71
+ :for => "roles_#{downcased_title}" %>
72
+ </li>
73
+ <% end %>
74
+ </ul>
75
+ </div>
76
+ <% end %>
77
+
78
+ <%= render '/refinery/admin/form_actions', :f => f,
79
+ :continue_editing => false,
80
+ :hide_delete => !current_refinery_user.can_delete?(@user),
81
+ :delete_title => t('delete', :scope => 'refinery.authentication.devise.admin.users'),
82
+ :delete_confirmation => t('message', :scope => 'refinery.authentication.devise.admin.delete', :title => @user.username) %>
83
+ <% end %>
84
+
85
+ <% content_for :javascripts do %>
86
+ <script>
87
+ $(document).ready(function() {
88
+ $('#user_plugins_enable_all').click(function(e, a) {
89
+ $('div.field.plugin_access ul#plugins li input:checkbox').prop('checked', true);
90
+ e.preventDefault();
91
+ });
92
+ });
93
+ </script>
94
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= render 'refinery/admin/search_header', :url => refinery.authentication_devise_admin_users_path %>
2
+ <% if @users.any? %>
3
+ <div class='pagination_container'>
4
+ <%= render 'users' %>
5
+ </div>
6
+ <% else %>
7
+ <p>
8
+ <%= t('no_results', :scope => 'refinery.authentication.devise.admin.search') %>
9
+ </p>
10
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <li id="sortable_<%= user.id %>" class='clearfix record <%= cycle("on", "on-hover") %>'>
2
+ <span class='title'>
3
+ <strong><%= user.username %></strong>
4
+ <span class="preview">
5
+ <%= t('.preview', :who => user.email, :created_at => l(user.created_at, :format => :short)) %>
6
+ </span>
7
+ </span>
8
+ <span class='actions'>
9
+ <%= mail_to user.email, refinery_icon_tag('email_go.png'),
10
+ :title => t('.email_user') %>
11
+ <%= link_to refinery_icon_tag('application_edit.png'),
12
+ refinery.edit_authentication_devise_admin_user_path(user),
13
+ :title => t('edit', :scope => 'refinery.authentication.devise.admin.users') if current_refinery_user.can_edit?(user) %>
14
+ <%= link_to refinery_icon_tag('delete.png'),
15
+ refinery.authentication_devise_admin_user_path(user),
16
+ :class => "cancel confirm-delete",
17
+ :title => t('delete', :scope => 'refinery.authentication.devise.admin.users'),
18
+ :method => :delete,
19
+ :data => {
20
+ :confirm => t('message', :scope => 'refinery.authentication.devise.admin.delete', :title => user.username)
21
+ } if current_refinery_user.can_delete?(user) %>
22
+ </span>
23
+ </li>
@@ -0,0 +1,4 @@
1
+ <%= will_paginate @users %>
2
+ <ul>
3
+ <%= render :partial => 'user', :collection => @users %>
4
+ </ul>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,6 @@
1
+ <section id='records'>
2
+ <%= render 'records' %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render 'actions' %>
6
+ </aside>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,26 @@
1
+ <% content_for :header, t('pick_new_password_for', :scope => 'refinery.authentication.devise.users.reset', :email => resource.email) %>
2
+
3
+ <%= form_for resource, :as => resource_name,
4
+ :url => refinery.authentication_devise_user_password_path,
5
+ :html => { :method => :put } do |f| %>
6
+ <%= f.hidden_field :reset_password_token, :value => @reset_password_token %>
7
+
8
+ <%= render '/refinery/admin/error_messages', :object => resource, :include_object_name => true %>
9
+
10
+ <div class='field'>
11
+ <%= f.label :password %>
12
+ <%= f.password_field :password, :class => 'larger widest' %>
13
+ </div>
14
+
15
+ <div class='field'>
16
+ <%= f.label :password_confirmation %>
17
+ <%= f.password_field :password_confirmation, :class => 'larger widest' %>
18
+ </div>
19
+
20
+ <%= render '/refinery/admin/form_actions', :f => f,
21
+ :continue_editing => false,
22
+ :submit_button_text => t('reset_password', :scope => 'refinery.authentication.devise.users.reset'),
23
+ :cancel_url => refinery.login_path,
24
+ :cancel_title => nil,
25
+ :hide_delete => true -%>
26
+ <% end -%>
@@ -0,0 +1,17 @@
1
+ <% content_for :header, t('enter_email_address', :scope => 'refinery.authentication.devise.users.forgot') %>
2
+
3
+ <%= form_for resource, :as => resource_name,
4
+ :url => refinery.authentication_devise_user_password_path,
5
+ :html => { :method => :post } do |f| %>
6
+
7
+ <div class='field'>
8
+ <%= f.text_field :email, :class => "larger widest",
9
+ :placeholder => t('email_address', :scope => 'refinery.authentication.devise.users.forgot') %>
10
+ </div>
11
+
12
+ <%= render '/refinery/admin/form_actions', :f => f,
13
+ :continue_editing => false,
14
+ :submit_button_text => t('reset_password', :scope => 'refinery.authentication.devise.users.forgot'),
15
+ :cancel_url => refinery.authentication_devise_user_session_path,
16
+ :cancel_title => nil -%>
17
+ <% end -%>
@@ -0,0 +1,27 @@
1
+ <% content_for :header, t('.hello_please_sign_in') %>
2
+
3
+ <%= form_for resource, :as => resource_name,
4
+ :url => refinery.authentication_devise_user_session_path do |f| %>
5
+ <div class='field session_username clearfix'>
6
+ <%= f.label :login %>
7
+ <%= f.text_field :login, :class => 'larger widest' %>
8
+ </div>
9
+ <div class='field session_password clearfix'>
10
+ <%= f.label :password %>
11
+ <%= f.password_field :password, :autocomplete => 'off', :class => 'larger widest' %>
12
+ </div>
13
+ <div class='clearfix'>
14
+ <% if devise_mapping.rememberable? %>
15
+ <div class='field remember_me'>
16
+ <%= f.check_box :remember_me %>
17
+ <%= f.label :remember_me %>
18
+ </div>
19
+ <% end %>
20
+ <div class='field forgot_password'>
21
+ <%= link_to t('.forgot_password'), refinery.new_authentication_devise_user_password_path %>
22
+ </div>
23
+ </div>
24
+ <%= render '/refinery/admin/form_actions', :f => f,
25
+ :submit_button_text => t('.sign_in'),
26
+ :hide_cancel => true %>
27
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ <p>
2
+ <%= t('reset_request_received_for', :scope => 'refinery.authentication.devise.user_mailer.reset_notification', :username => @user.username) %>
3
+ </p>
4
+ <p>
5
+ <%= t('visit_this_url', :scope => 'refinery.authentication.devise.user_mailer.reset_notification') %>:
6
+ </p>
7
+ <p>
8
+ <%= @url %>
9
+ </p>
10
+ <p>
11
+ (<%= t('remain_same_if_no_action', :scope => 'refinery.authentication.devise.user_mailer.reset_notification') %>)
12
+ </p>
@@ -0,0 +1,7 @@
1
+ <%= t('reset_request_received_for', :scope => 'refinery.authentication.devise.user_mailer.reset_notification', :username => @user.username) %>
2
+
3
+ <%= t('visit_this_url', :scope => 'refinery.authentication.devise.user_mailer.reset_notification') %>:
4
+
5
+ <%= @url %>
6
+
7
+ (<%= t('remain_same_if_no_action', :scope => 'refinery.authentication.devise.user_mailer.reset_notification') %>)
@@ -0,0 +1,29 @@
1
+ <% content_for :header, t('there_are_no_users', :scope => 'refinery.welcome') %>
2
+
3
+ <%= form_for :user, :url => refinery.signup_path do |f| -%>
4
+
5
+ <%= render '/refinery/admin/error_messages', :object => @user, :include_object_name => true %>
6
+
7
+ <div class='field'>
8
+ <%= f.label :username %>
9
+ <%= f.text_field :username, :class => 'larger widest' %>
10
+ </div>
11
+ <div class='field'>
12
+ <%= f.label :email %>
13
+ <%= f.text_field :email, :class => 'larger widest' %>
14
+ </div>
15
+ <div class='field'>
16
+ <%= f.label :password %>
17
+ <%= f.password_field :password, :class => 'larger widest' %>
18
+ </div>
19
+ <div class='field'>
20
+ <%= f.label :password_confirmation %>
21
+ <%= f.password_field :password_confirmation, :class => 'larger widest' %>
22
+ </div>
23
+
24
+ <%= render '/refinery/admin/form_actions', :f => f,
25
+ :submit_continue => false,
26
+ :submit_button_text => t('.sign_up'),
27
+ :hide_delete => true,
28
+ :hide_cancel => true %>
29
+ <% end -%>
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <%= render '/refinery/html_tag' %>
3
+ <%= render '/refinery/admin/head' %>
4
+ <body class='login <%= I18n.locale %>'>
5
+ <div id='tooltip_container'></div>
6
+ <div id="login_container" class="clearfix">
7
+ <header>
8
+ <h1><%= yield :header %></h1>
9
+ </header>
10
+ <div id="page_container">
11
+ <div id="page">
12
+ <div id="content" class="clearfix">
13
+ <div id="flash_container">
14
+ <%= render '/refinery/message' %>
15
+ </div>
16
+ <%= yield %>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </body>
22
+ </html>
data/bin/rails ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
5
+ load File.expand_path('../../spec/dummy/bin/rails', __FILE__)
data/bin/rake ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+ begin
9
+ if Dir.exist?(File.expand_path('../../spec/dummy', __FILE__))
10
+ load File.expand_path("../spring", __FILE__)
11
+ end
12
+ rescue LoadError
13
+ end
14
+ require 'pathname'
15
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
16
+ Pathname.new(__FILE__).realpath)
17
+
18
+ require 'rubygems'
19
+ require 'bundler/setup'
20
+
21
+ load Gem.bin_path('rake', 'rake')
data/bin/rspec ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ begin
10
+ if Dir.exist?(File.expand_path('../../spec/dummy', __FILE__))
11
+ load File.expand_path("../spring", __FILE__)
12
+ end
13
+ rescue LoadError
14
+ end
15
+ require 'pathname'
16
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
17
+ Pathname.new(__FILE__).realpath)
18
+
19
+ require 'rubygems'
20
+ require 'bundler/setup'
21
+
22
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/spring ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads spring without using Bundler, in order to be fast
4
+ # It gets overwritten when you run the `spring binstub` command
5
+
6
+ unless defined?(Spring)
7
+ require "rubygems"
8
+ require "bundler"
9
+
10
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
+ ENV["GEM_HOME"] = ""
13
+ Gem.paths = ENV
14
+
15
+ gem "spring", match[1]
16
+ require "spring/binstub"
17
+ end
18
+ end
@@ -0,0 +1,73 @@
1
+ bg:
2
+ refinery:
3
+ plugins:
4
+ refinery_authentication_devise:
5
+ title: Потребители
6
+ description: Управление на потребители
7
+ authentication:
8
+ devise:
9
+ admin:
10
+ users:
11
+ delete: Изтриване на този потребител завинаги
12
+ edit: Редактиране на този потребител
13
+ update:
14
+ lockout_prevented: Не можете да премахнете добавката "Потребители" чрез потребителя, с който сте влезли в момента в системата.
15
+ form:
16
+ blank_password_keeps_current: При празно поле текущата парола ще бъде запазена
17
+ plugin_access: Достъп до добавки
18
+ role_access: Достъп до роли
19
+ enable_all: разрешаване на всички
20
+ actions:
21
+ create_new_user: Добавяне на нов потребител
22
+ user:
23
+ email_user: Изпращане на е-поща до този потребител
24
+ preview: '(%{who}) добавен на %{created_at}'
25
+ sessions:
26
+ new:
27
+ hello_please_sign_in: Здравейте! Моля, влезте в системата.
28
+ sign_in: Вход
29
+ forgot_password: Забравена парола
30
+ user_mailer:
31
+ reset_notification:
32
+ subject: Връзка за смяна на Вашата парола
33
+ reset_request_received_for: "Получена е заявка за смяна на паролата на %{username}"
34
+ visit_this_url: Моля, посетете следния уеб адрес за въвеждане на нова парола
35
+ remain_same_if_no_action: Вашата парола ще остане непроменена, ако не предприемете никакви действия
36
+ users:
37
+ new:
38
+ fill_form: За начало, моля попълнете Вашите данни в полетата по-долу.
39
+ sign_up: Регистрация
40
+ create:
41
+ welcome: 'Добре дошли в Refinery, %{who}'
42
+ forgot:
43
+ email_address: Е-поща
44
+ enter_email_address: Моля, въведете адреса на е-пощата на Вашия потребител.
45
+ reset_password: Смяна на парола
46
+ blank_email: Не сте въвели адрес на е-поща.
47
+ email_not_associated_with_account_html: 'За съжаление, "%{email}" не принадлежи на нито един потребител.<br />Сигурни ли сте, че въведохте точния адрес?'
48
+ email_reset_sent: До Вас бе изпратена е-поща, съдържаща връзка за смяна на паролата Ви.
49
+ password_encryption: Налага се да смените Вашата парола, тъй като метода за криптиране на пароли в Refinery бе променен. Чрез новия метод паролите се съхраняват по-сигурно отпреди.
50
+ reset:
51
+ successful: 'Паролата бе успешно сменена за "%{email}"'
52
+ pick_new_password_for: "Моля, изберете нова парола за %{email}"
53
+ reset_password: Смяна на парола
54
+ roles:
55
+ superuser: Привилегирован потребител
56
+ refinery: Refinery
57
+ devise:
58
+ failure:
59
+ unauthenticated: Трябва да влезете в системата преди да продължите.
60
+ invalid: "За съжаление сте въвели грешно потребителско име или парола."
61
+ sessions:
62
+ signed_in: Успешен вход в системата.
63
+ activerecord:
64
+ models:
65
+ refinery/authentication/devise/user: потребител
66
+ attributes:
67
+ refinery/authentication/devise/user:
68
+ login: Вход
69
+ username: Потребителско име
70
+ password: Парола
71
+ password_confirmation: Потвърждение на паролата
72
+ email: Е-поща
73
+ remember_me: Запомняне на данните за вход