activity_notification 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +11 -1
  3. data/README.md +63 -28
  4. data/activity_notification.gemspec +4 -2
  5. data/app/controllers/activity_notification/notifications_controller.rb +1 -1
  6. data/app/controllers/activity_notification/notifications_with_devise_controller.rb +10 -10
  7. data/app/views/activity_notification/notifications/default/_index.html.erb +9 -4
  8. data/lib/activity_notification.rb +7 -6
  9. data/lib/activity_notification/apis/notification_api.rb +14 -15
  10. data/lib/activity_notification/common.rb +15 -7
  11. data/lib/activity_notification/config.rb +2 -0
  12. data/lib/activity_notification/helpers/view_helpers.rb +5 -4
  13. data/lib/activity_notification/mailers/helpers.rb +9 -9
  14. data/lib/activity_notification/models.rb +16 -0
  15. data/lib/activity_notification/models/{notifiable.rb → concerns/notifiable.rb} +15 -10
  16. data/lib/activity_notification/models/{notifier.rb → concerns/notifier.rb} +6 -0
  17. data/lib/activity_notification/models/{target.rb → concerns/target.rb} +34 -17
  18. data/lib/activity_notification/renderable.rb +2 -1
  19. data/lib/activity_notification/roles/acts_as_notifiable.rb +38 -23
  20. data/lib/activity_notification/roles/acts_as_notifier.rb +11 -0
  21. data/lib/activity_notification/roles/acts_as_target.rb +9 -18
  22. data/lib/activity_notification/version.rb +1 -1
  23. data/lib/generators/activity_notification/{migration → active_record}/migration_generator.rb +5 -4
  24. data/lib/generators/activity_notification/controllers_generator.rb +1 -1
  25. data/lib/generators/activity_notification/install_generator.rb +3 -6
  26. data/lib/generators/activity_notification/{notification → models}/notification_generator.rb +5 -4
  27. data/lib/generators/activity_notification/views_generator.rb +20 -22
  28. data/lib/generators/templates/active_record/migration.rb +1 -1
  29. data/lib/generators/templates/activity_notification.rb +13 -3
  30. data/{config → lib/generators/templates}/locales/en.yml +0 -0
  31. data/lib/generators/templates/notification/notification.rb +4 -1
  32. data/spec/concerns/{notification_api_spec.rb → apis/notification_api_spec.rb} +169 -45
  33. data/spec/concerns/common_spec.rb +150 -0
  34. data/spec/concerns/models/notifiable_spec.rb +435 -0
  35. data/spec/concerns/models/notifier_spec.rb +23 -0
  36. data/spec/concerns/models/target_spec.rb +579 -0
  37. data/spec/concerns/renderable_spec.rb +110 -0
  38. data/spec/controllers/notifications_controller_shared_examples.rb +457 -0
  39. data/spec/controllers/notifications_controller_spec.rb +12 -0
  40. data/spec/controllers/notifications_with_devise_controller_spec.rb +81 -0
  41. data/spec/factories/admins.rb +5 -0
  42. data/spec/factories/articles.rb +1 -1
  43. data/spec/factories/comments.rb +1 -1
  44. data/spec/factories/dummy/dummy_notifiable.rb +4 -0
  45. data/spec/factories/dummy/dummy_notifier.rb +4 -0
  46. data/spec/factories/dummy/dummy_target.rb +4 -0
  47. data/spec/factories/notifications.rb +1 -1
  48. data/spec/factories/users.rb +7 -1
  49. data/spec/generators/active_record/migration_generator_spec.rb +41 -0
  50. data/spec/generators/controllers_generator_spec.rb +62 -0
  51. data/spec/generators/install_generator_spec.rb +43 -0
  52. data/spec/generators/models/notification_generator_spec.rb +41 -0
  53. data/spec/generators/views_generator_spec.rb +111 -0
  54. data/spec/helpers/polymorphic_helpers_spec.rb +89 -0
  55. data/spec/helpers/view_helpers_spec.rb +258 -0
  56. data/spec/mailers/mailer_spec.rb +98 -0
  57. data/spec/models/dummy/dummy_notifiable_spec.rb +6 -0
  58. data/spec/models/dummy/dummy_notifier_spec.rb +6 -0
  59. data/spec/models/dummy/dummy_target_spec.rb +6 -0
  60. data/spec/models/notification_spec.rb +5 -4
  61. data/spec/rails_app/app/assets/javascripts/application.js +2 -0
  62. data/spec/rails_app/app/controllers/articles_controller.rb +62 -0
  63. data/spec/rails_app/app/controllers/comments_controller.rb +34 -0
  64. data/spec/rails_app/app/models/admin.rb +8 -0
  65. data/spec/rails_app/app/models/article.rb +6 -6
  66. data/spec/rails_app/app/models/comment.rb +2 -2
  67. data/spec/rails_app/app/models/dummy/dummy_base.rb +2 -0
  68. data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +4 -0
  69. data/spec/rails_app/app/models/dummy/dummy_notifier.rb +4 -0
  70. data/spec/rails_app/app/models/dummy/dummy_target.rb +4 -0
  71. data/spec/rails_app/app/models/user.rb +5 -5
  72. data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb +1 -0
  73. data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb +1 -0
  74. data/spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb +1 -0
  75. data/spec/rails_app/app/views/activity_notification/notifications/users/custom/_test.html.erb +1 -0
  76. data/spec/rails_app/app/views/articles/_form.html.erb +20 -0
  77. data/spec/rails_app/app/views/articles/edit.html.erb +6 -0
  78. data/spec/rails_app/app/views/articles/index.html.erb +67 -0
  79. data/spec/rails_app/app/views/articles/new.html.erb +5 -0
  80. data/spec/rails_app/app/views/articles/show.html.erb +38 -0
  81. data/spec/rails_app/app/views/layouts/_header.html.erb +8 -0
  82. data/spec/rails_app/app/views/layouts/application.html.erb +3 -4
  83. data/spec/rails_app/config/initializers/activity_notification.rb +13 -3
  84. data/spec/rails_app/config/initializers/devise.rb +274 -274
  85. data/spec/rails_app/config/locales/activity_notification.en.yml +20 -0
  86. data/spec/rails_app/config/locales/devise.en.yml +62 -0
  87. data/spec/rails_app/config/routes.rb +6 -2
  88. data/spec/rails_app/db/migrate/20160715050433_create_test_tables.rb +6 -2
  89. data/spec/rails_app/db/schema.rb +8 -0
  90. data/spec/rails_app/db/seeds.rb +43 -0
  91. data/spec/roles/acts_as_notifiable_spec.rb +32 -0
  92. data/spec/roles/acts_as_notifier_spec.rb +17 -0
  93. data/spec/roles/acts_as_target_spec.rb +40 -0
  94. data/spec/spec_helper.rb +18 -14
  95. metadata +136 -12
@@ -1,274 +1,274 @@
1
- # # Use this hook to configure devise mailer, warden hooks and so forth.
2
- # # Many of these configuration options can be set straight in your model.
3
- # Devise.setup do |config|
4
- # # The secret key used by Devise. Devise uses this key to generate
5
- # # random tokens. Changing this key will render invalid all existing
6
- # # confirmation, reset password and unlock tokens in the database.
7
- # # Devise will use the `secret_key_base` as its `secret_key`
8
- # # by default. You can change it below and use your own secret key.
9
- # config.secret_key = 'e6f62a5ffa4bd32a1c36f12c77f3ba071e2f7de683ef0f20f91e0fe53fbf5eda4a8600800250460280a816d151fdab45fe044ef7f0dae0e18b5cac241cfebaef'
10
- #
11
- # # ==> Mailer Configuration
12
- # # Configure the e-mail address which will be shown in Devise::Mailer,
13
- # # note that it will be overwritten if you use your own mailer class
14
- # # with default "from" parameter.
15
- # config.mailer_sender = 'please-change-me@example.com'
16
- #
17
- # # Configure the class responsible to send e-mails.
18
- # # config.mailer = 'Devise::Mailer'
19
- #
20
- # # Configure the parent class responsible to send e-mails.
21
- # # config.parent_mailer = 'ActionMailer::Base'
22
- #
23
- # # ==> ORM configuration
24
- # # Load and configure the ORM. Supports :active_record (default) and
25
- # # :mongoid (bson_ext recommended) by default. Other ORMs may be
26
- # # available as additional gems.
27
- # require 'devise/orm/active_record'
28
- #
29
- # # ==> Configuration for any authentication mechanism
30
- # # Configure which keys are used when authenticating a user. The default is
31
- # # just :email. You can configure it to use [:username, :subdomain], so for
32
- # # authenticating a user, both parameters are required. Remember that those
33
- # # parameters are used only when authenticating and not when retrieving from
34
- # # session. If you need permissions, you should implement that in a before filter.
35
- # # You can also supply a hash where the value is a boolean determining whether
36
- # # or not authentication should be aborted when the value is not present.
37
- # # config.authentication_keys = [:email]
38
- #
39
- # # Configure parameters from the request object used for authentication. Each entry
40
- # # given should be a request method and it will automatically be passed to the
41
- # # find_for_authentication method and considered in your model lookup. For instance,
42
- # # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
43
- # # The same considerations mentioned for authentication_keys also apply to request_keys.
44
- # # config.request_keys = []
45
- #
46
- # # Configure which authentication keys should be case-insensitive.
47
- # # These keys will be downcased upon creating or modifying a user and when used
48
- # # to authenticate or find a user. Default is :email.
49
- # config.case_insensitive_keys = [:email]
50
- #
51
- # # Configure which authentication keys should have whitespace stripped.
52
- # # These keys will have whitespace before and after removed upon creating or
53
- # # modifying a user and when used to authenticate or find a user. Default is :email.
54
- # config.strip_whitespace_keys = [:email]
55
- #
56
- # # Tell if authentication through request.params is enabled. True by default.
57
- # # It can be set to an array that will enable params authentication only for the
58
- # # given strategies, for example, `config.params_authenticatable = [:database]` will
59
- # # enable it only for database (email + password) authentication.
60
- # # config.params_authenticatable = true
61
- #
62
- # # Tell if authentication through HTTP Auth is enabled. False by default.
63
- # # It can be set to an array that will enable http authentication only for the
64
- # # given strategies, for example, `config.http_authenticatable = [:database]` will
65
- # # enable it only for database authentication. The supported strategies are:
66
- # # :database = Support basic authentication with authentication key + password
67
- # # config.http_authenticatable = false
68
- #
69
- # # If 401 status code should be returned for AJAX requests. True by default.
70
- # # config.http_authenticatable_on_xhr = true
71
- #
72
- # # The realm used in Http Basic Authentication. 'Application' by default.
73
- # # config.http_authentication_realm = 'Application'
74
- #
75
- # # It will change confirmation, password recovery and other workflows
76
- # # to behave the same regardless if the e-mail provided was right or wrong.
77
- # # Does not affect registerable.
78
- # # config.paranoid = true
79
- #
80
- # # By default Devise will store the user in session. You can skip storage for
81
- # # particular strategies by setting this option.
82
- # # Notice that if you are skipping storage for all authentication paths, you
83
- # # may want to disable generating routes to Devise's sessions controller by
84
- # # passing skip: :sessions to `devise_for` in your config/routes.rb
85
- # config.skip_session_storage = [:http_auth]
86
- #
87
- # # By default, Devise cleans up the CSRF token on authentication to
88
- # # avoid CSRF token fixation attacks. This means that, when using AJAX
89
- # # requests for sign in and sign up, you need to get a new CSRF token
90
- # # from the server. You can disable this option at your own risk.
91
- # # config.clean_up_csrf_token_on_authentication = true
92
- #
93
- # # When false, Devise will not attempt to reload routes on eager load.
94
- # # This can reduce the time taken to boot the app but if your application
95
- # # requires the Devise mappings to be loaded during boot time the application
96
- # # won't boot properly.
97
- # # config.reload_routes = true
98
- #
99
- # # ==> Configuration for :database_authenticatable
100
- # # For bcrypt, this is the cost for hashing the password and defaults to 11. If
101
- # # using other algorithms, it sets how many times you want the password to be hashed.
102
- # #
103
- # # Limiting the stretches to just one in testing will increase the performance of
104
- # # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
105
- # # a value less than 10 in other environments. Note that, for bcrypt (the default
106
- # # algorithm), the cost increases exponentially with the number of stretches (e.g.
107
- # # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
108
- # config.stretches = Rails.env.test? ? 1 : 11
109
- #
110
- # # Set up a pepper to generate the hashed password.
111
- # # config.pepper = 'cd724b7dbe7ac7688f5fb620d26b1a305594f4f025e42c279524254dec22e7ff16a501a2d788ffe8d0365b5dc4ea7474c7e694585a8dd132d76887fe1fca7969'
112
- #
113
- # # Send a notification email when the user's password is changed
114
- # # config.send_password_change_notification = false
115
- #
116
- # # ==> Configuration for :confirmable
117
- # # A period that the user is allowed to access the website even without
118
- # # confirming their account. For instance, if set to 2.days, the user will be
119
- # # able to access the website for two days without confirming their account,
120
- # # access will be blocked just in the third day. Default is 0.days, meaning
121
- # # the user cannot access the website without confirming their account.
122
- # # config.allow_unconfirmed_access_for = 2.days
123
- #
124
- # # A period that the user is allowed to confirm their account before their
125
- # # token becomes invalid. For example, if set to 3.days, the user can confirm
126
- # # their account within 3 days after the mail was sent, but on the fourth day
127
- # # their account can't be confirmed with the token any more.
128
- # # Default is nil, meaning there is no restriction on how long a user can take
129
- # # before confirming their account.
130
- # # config.confirm_within = 3.days
131
- #
132
- # # If true, requires any email changes to be confirmed (exactly the same way as
133
- # # initial account confirmation) to be applied. Requires additional unconfirmed_email
134
- # # db field (see migrations). Until confirmed, new email is stored in
135
- # # unconfirmed_email column, and copied to email column on successful confirmation.
136
- # config.reconfirmable = true
137
- #
138
- # # Defines which key will be used when confirming an account
139
- # # config.confirmation_keys = [:email]
140
- #
141
- # # ==> Configuration for :rememberable
142
- # # The time the user will be remembered without asking for credentials again.
143
- # # config.remember_for = 2.weeks
144
- #
145
- # # Invalidates all the remember me tokens when the user signs out.
146
- # config.expire_all_remember_me_on_sign_out = true
147
- #
148
- # # If true, extends the user's remember period when remembered via cookie.
149
- # # config.extend_remember_period = false
150
- #
151
- # # Options to be passed to the created cookie. For instance, you can set
152
- # # secure: true in order to force SSL only cookies.
153
- # # config.rememberable_options = {}
154
- #
155
- # # ==> Configuration for :validatable
156
- # # Range for password length.
157
- # config.password_length = 6..128
158
- #
159
- # # Email regex used to validate email formats. It simply asserts that
160
- # # one (and only one) @ exists in the given string. This is mainly
161
- # # to give user feedback and not to assert the e-mail validity.
162
- # config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
163
- #
164
- # # ==> Configuration for :timeoutable
165
- # # The time you want to timeout the user session without activity. After this
166
- # # time the user will be asked for credentials again. Default is 30 minutes.
167
- # # config.timeout_in = 30.minutes
168
- #
169
- # # ==> Configuration for :lockable
170
- # # Defines which strategy will be used to lock an account.
171
- # # :failed_attempts = Locks an account after a number of failed attempts to sign in.
172
- # # :none = No lock strategy. You should handle locking by yourself.
173
- # # config.lock_strategy = :failed_attempts
174
- #
175
- # # Defines which key will be used when locking and unlocking an account
176
- # # config.unlock_keys = [:email]
177
- #
178
- # # Defines which strategy will be used to unlock an account.
179
- # # :email = Sends an unlock link to the user email
180
- # # :time = Re-enables login after a certain amount of time (see :unlock_in below)
181
- # # :both = Enables both strategies
182
- # # :none = No unlock strategy. You should handle unlocking by yourself.
183
- # # config.unlock_strategy = :both
184
- #
185
- # # Number of authentication tries before locking an account if lock_strategy
186
- # # is failed attempts.
187
- # # config.maximum_attempts = 20
188
- #
189
- # # Time interval to unlock the account if :time is enabled as unlock_strategy.
190
- # # config.unlock_in = 1.hour
191
- #
192
- # # Warn on the last attempt before the account is locked.
193
- # # config.last_attempt_warning = true
194
- #
195
- # # ==> Configuration for :recoverable
196
- # #
197
- # # Defines which key will be used when recovering the password for an account
198
- # # config.reset_password_keys = [:email]
199
- #
200
- # # Time interval you can reset your password with a reset password key.
201
- # # Don't put a too small interval or your users won't have the time to
202
- # # change their passwords.
203
- # config.reset_password_within = 6.hours
204
- #
205
- # # When set to false, does not sign a user in automatically after their password is
206
- # # reset. Defaults to true, so a user is signed in automatically after a reset.
207
- # # config.sign_in_after_reset_password = true
208
- #
209
- # # ==> Configuration for :encryptable
210
- # # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
211
- # # You can use :sha1, :sha512 or algorithms from others authentication tools as
212
- # # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
213
- # # for default behavior) and :restful_authentication_sha1 (then you should set
214
- # # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
215
- # #
216
- # # Require the `devise-encryptable` gem when using anything other than bcrypt
217
- # # config.encryptor = :sha512
218
- #
219
- # # ==> Scopes configuration
220
- # # Turn scoped views on. Before rendering "sessions/new", it will first check for
221
- # # "users/sessions/new". It's turned off by default because it's slower if you
222
- # # are using only default views.
223
- # # config.scoped_views = false
224
- #
225
- # # Configure the default scope given to Warden. By default it's the first
226
- # # devise role declared in your routes (usually :user).
227
- # # config.default_scope = :user
228
- #
229
- # # Set this configuration to false if you want /users/sign_out to sign out
230
- # # only the current scope. By default, Devise signs out all scopes.
231
- # # config.sign_out_all_scopes = true
232
- #
233
- # # ==> Navigation configuration
234
- # # Lists the formats that should be treated as navigational. Formats like
235
- # # :html, should redirect to the sign in page when the user does not have
236
- # # access, but formats like :xml or :json, should return 401.
237
- # #
238
- # # If you have any extra navigational formats, like :iphone or :mobile, you
239
- # # should add them to the navigational formats lists.
240
- # #
241
- # # The "*/*" below is required to match Internet Explorer requests.
242
- # # config.navigational_formats = ['*/*', :html]
243
- #
244
- # # The default HTTP method used to sign out a resource. Default is :delete.
245
- # config.sign_out_via = :delete
246
- #
247
- # # ==> OmniAuth
248
- # # Add a new OmniAuth provider. Check the wiki for more information on setting
249
- # # up on your models and hooks.
250
- # # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
251
- #
252
- # # ==> Warden configuration
253
- # # If you want to use other strategies, that are not supported by Devise, or
254
- # # change the failure app, you can configure them inside the config.warden block.
255
- # #
256
- # # config.warden do |manager|
257
- # # manager.intercept_401 = false
258
- # # manager.default_strategies(scope: :user).unshift :some_external_strategy
259
- # # end
260
- #
261
- # # ==> Mountable engine configurations
262
- # # When using Devise inside an engine, let's call it `MyEngine`, and this engine
263
- # # is mountable, there are some extra configurations to be taken into account.
264
- # # The following options are available, assuming the engine is mounted as:
265
- # #
266
- # # mount MyEngine, at: '/my_engine'
267
- # #
268
- # # The router that invoked `devise_for`, in the example above, would be:
269
- # # config.router_name = :my_engine
270
- # #
271
- # # When using OmniAuth, Devise cannot automatically set OmniAuth path,
272
- # # so you need to do it manually. For the users scope, it would be:
273
- # # config.omniauth_path_prefix = '/my_engine/users/auth'
274
- # end
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # Devise will use the `secret_key_base` as its `secret_key`
8
+ # by default. You can change it below and use your own secret key.
9
+ config.secret_key = 'e6f62a5ffa4bd32a1c36f12c77f3ba071e2f7de683ef0f20f91e0fe53fbf5eda4a8600800250460280a816d151fdab45fe044ef7f0dae0e18b5cac241cfebaef'
10
+
11
+ # ==> Mailer Configuration
12
+ # Configure the e-mail address which will be shown in Devise::Mailer,
13
+ # note that it will be overwritten if you use your own mailer class
14
+ # with default "from" parameter.
15
+ config.mailer_sender = 'please-change-me@example.com'
16
+
17
+ # Configure the class responsible to send e-mails.
18
+ # config.mailer = 'Devise::Mailer'
19
+
20
+ # Configure the parent class responsible to send e-mails.
21
+ # config.parent_mailer = 'ActionMailer::Base'
22
+
23
+ # ==> ORM configuration
24
+ # Load and configure the ORM. Supports :active_record (default) and
25
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
26
+ # available as additional gems.
27
+ require 'devise/orm/active_record'
28
+
29
+ # ==> Configuration for any authentication mechanism
30
+ # Configure which keys are used when authenticating a user. The default is
31
+ # just :email. You can configure it to use [:username, :subdomain], so for
32
+ # authenticating a user, both parameters are required. Remember that those
33
+ # parameters are used only when authenticating and not when retrieving from
34
+ # session. If you need permissions, you should implement that in a before filter.
35
+ # You can also supply a hash where the value is a boolean determining whether
36
+ # or not authentication should be aborted when the value is not present.
37
+ # config.authentication_keys = [:email]
38
+
39
+ # Configure parameters from the request object used for authentication. Each entry
40
+ # given should be a request method and it will automatically be passed to the
41
+ # find_for_authentication method and considered in your model lookup. For instance,
42
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
43
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
44
+ # config.request_keys = []
45
+
46
+ # Configure which authentication keys should be case-insensitive.
47
+ # These keys will be downcased upon creating or modifying a user and when used
48
+ # to authenticate or find a user. Default is :email.
49
+ config.case_insensitive_keys = [:email]
50
+
51
+ # Configure which authentication keys should have whitespace stripped.
52
+ # These keys will have whitespace before and after removed upon creating or
53
+ # modifying a user and when used to authenticate or find a user. Default is :email.
54
+ config.strip_whitespace_keys = [:email]
55
+
56
+ # Tell if authentication through request.params is enabled. True by default.
57
+ # It can be set to an array that will enable params authentication only for the
58
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
59
+ # enable it only for database (email + password) authentication.
60
+ # config.params_authenticatable = true
61
+
62
+ # Tell if authentication through HTTP Auth is enabled. False by default.
63
+ # It can be set to an array that will enable http authentication only for the
64
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
65
+ # enable it only for database authentication. The supported strategies are:
66
+ # :database = Support basic authentication with authentication key + password
67
+ # config.http_authenticatable = false
68
+
69
+ # If 401 status code should be returned for AJAX requests. True by default.
70
+ # config.http_authenticatable_on_xhr = true
71
+
72
+ # The realm used in Http Basic Authentication. 'Application' by default.
73
+ # config.http_authentication_realm = 'Application'
74
+
75
+ # It will change confirmation, password recovery and other workflows
76
+ # to behave the same regardless if the e-mail provided was right or wrong.
77
+ # Does not affect registerable.
78
+ # config.paranoid = true
79
+
80
+ # By default Devise will store the user in session. You can skip storage for
81
+ # particular strategies by setting this option.
82
+ # Notice that if you are skipping storage for all authentication paths, you
83
+ # may want to disable generating routes to Devise's sessions controller by
84
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
85
+ config.skip_session_storage = [:http_auth]
86
+
87
+ # By default, Devise cleans up the CSRF token on authentication to
88
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
89
+ # requests for sign in and sign up, you need to get a new CSRF token
90
+ # from the server. You can disable this option at your own risk.
91
+ # config.clean_up_csrf_token_on_authentication = true
92
+
93
+ # When false, Devise will not attempt to reload routes on eager load.
94
+ # This can reduce the time taken to boot the app but if your application
95
+ # requires the Devise mappings to be loaded during boot time the application
96
+ # won't boot properly.
97
+ # config.reload_routes = true
98
+
99
+ # ==> Configuration for :database_authenticatable
100
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
101
+ # using other algorithms, it sets how many times you want the password to be hashed.
102
+ #
103
+ # Limiting the stretches to just one in testing will increase the performance of
104
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
105
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
106
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
107
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
108
+ config.stretches = Rails.env.test? ? 1 : 11
109
+
110
+ # Set up a pepper to generate the hashed password.
111
+ # config.pepper = 'cd724b7dbe7ac7688f5fb620d26b1a305594f4f025e42c279524254dec22e7ff16a501a2d788ffe8d0365b5dc4ea7474c7e694585a8dd132d76887fe1fca7969'
112
+
113
+ # Send a notification email when the user's password is changed
114
+ # config.send_password_change_notification = false
115
+
116
+ # ==> Configuration for :confirmable
117
+ # A period that the user is allowed to access the website even without
118
+ # confirming their account. For instance, if set to 2.days, the user will be
119
+ # able to access the website for two days without confirming their account,
120
+ # access will be blocked just in the third day. Default is 0.days, meaning
121
+ # the user cannot access the website without confirming their account.
122
+ # config.allow_unconfirmed_access_for = 2.days
123
+
124
+ # A period that the user is allowed to confirm their account before their
125
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
126
+ # their account within 3 days after the mail was sent, but on the fourth day
127
+ # their account can't be confirmed with the token any more.
128
+ # Default is nil, meaning there is no restriction on how long a user can take
129
+ # before confirming their account.
130
+ # config.confirm_within = 3.days
131
+
132
+ # If true, requires any email changes to be confirmed (exactly the same way as
133
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
134
+ # db field (see migrations). Until confirmed, new email is stored in
135
+ # unconfirmed_email column, and copied to email column on successful confirmation.
136
+ config.reconfirmable = false
137
+
138
+ # Defines which key will be used when confirming an account
139
+ # config.confirmation_keys = [:email]
140
+
141
+ # ==> Configuration for :rememberable
142
+ # The time the user will be remembered without asking for credentials again.
143
+ # config.remember_for = 2.weeks
144
+
145
+ # Invalidates all the remember me tokens when the user signs out.
146
+ config.expire_all_remember_me_on_sign_out = true
147
+
148
+ # If true, extends the user's remember period when remembered via cookie.
149
+ # config.extend_remember_period = false
150
+
151
+ # Options to be passed to the created cookie. For instance, you can set
152
+ # secure: true in order to force SSL only cookies.
153
+ # config.rememberable_options = {}
154
+
155
+ # ==> Configuration for :validatable
156
+ # Range for password length.
157
+ config.password_length = 6..128
158
+
159
+ # Email regex used to validate email formats. It simply asserts that
160
+ # one (and only one) @ exists in the given string. This is mainly
161
+ # to give user feedback and not to assert the e-mail validity.
162
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
163
+
164
+ # ==> Configuration for :timeoutable
165
+ # The time you want to timeout the user session without activity. After this
166
+ # time the user will be asked for credentials again. Default is 30 minutes.
167
+ # config.timeout_in = 30.minutes
168
+
169
+ # ==> Configuration for :lockable
170
+ # Defines which strategy will be used to lock an account.
171
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
172
+ # :none = No lock strategy. You should handle locking by yourself.
173
+ # config.lock_strategy = :failed_attempts
174
+
175
+ # Defines which key will be used when locking and unlocking an account
176
+ # config.unlock_keys = [:email]
177
+
178
+ # Defines which strategy will be used to unlock an account.
179
+ # :email = Sends an unlock link to the user email
180
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
181
+ # :both = Enables both strategies
182
+ # :none = No unlock strategy. You should handle unlocking by yourself.
183
+ # config.unlock_strategy = :both
184
+
185
+ # Number of authentication tries before locking an account if lock_strategy
186
+ # is failed attempts.
187
+ # config.maximum_attempts = 20
188
+
189
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
190
+ # config.unlock_in = 1.hour
191
+
192
+ # Warn on the last attempt before the account is locked.
193
+ # config.last_attempt_warning = true
194
+
195
+ # ==> Configuration for :recoverable
196
+ #
197
+ # Defines which key will be used when recovering the password for an account
198
+ # config.reset_password_keys = [:email]
199
+
200
+ # Time interval you can reset your password with a reset password key.
201
+ # Don't put a too small interval or your users won't have the time to
202
+ # change their passwords.
203
+ config.reset_password_within = 6.hours
204
+
205
+ # When set to false, does not sign a user in automatically after their password is
206
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
207
+ # config.sign_in_after_reset_password = true
208
+
209
+ # ==> Configuration for :encryptable
210
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
211
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
212
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
213
+ # for default behavior) and :restful_authentication_sha1 (then you should set
214
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
215
+ #
216
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
217
+ # config.encryptor = :sha512
218
+
219
+ # ==> Scopes configuration
220
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
221
+ # "users/sessions/new". It's turned off by default because it's slower if you
222
+ # are using only default views.
223
+ # config.scoped_views = false
224
+
225
+ # Configure the default scope given to Warden. By default it's the first
226
+ # devise role declared in your routes (usually :user).
227
+ # config.default_scope = :user
228
+
229
+ # Set this configuration to false if you want /users/sign_out to sign out
230
+ # only the current scope. By default, Devise signs out all scopes.
231
+ # config.sign_out_all_scopes = true
232
+
233
+ # ==> Navigation configuration
234
+ # Lists the formats that should be treated as navigational. Formats like
235
+ # :html, should redirect to the sign in page when the user does not have
236
+ # access, but formats like :xml or :json, should return 401.
237
+ #
238
+ # If you have any extra navigational formats, like :iphone or :mobile, you
239
+ # should add them to the navigational formats lists.
240
+ #
241
+ # The "*/*" below is required to match Internet Explorer requests.
242
+ # config.navigational_formats = ['*/*', :html]
243
+
244
+ # The default HTTP method used to sign out a resource. Default is :delete.
245
+ config.sign_out_via = :delete
246
+
247
+ # ==> OmniAuth
248
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
249
+ # up on your models and hooks.
250
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
251
+
252
+ # ==> Warden configuration
253
+ # If you want to use other strategies, that are not supported by Devise, or
254
+ # change the failure app, you can configure them inside the config.warden block.
255
+ #
256
+ # config.warden do |manager|
257
+ # manager.intercept_401 = false
258
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
259
+ # end
260
+
261
+ # ==> Mountable engine configurations
262
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
263
+ # is mountable, there are some extra configurations to be taken into account.
264
+ # The following options are available, assuming the engine is mounted as:
265
+ #
266
+ # mount MyEngine, at: '/my_engine'
267
+ #
268
+ # The router that invoked `devise_for`, in the example above, would be:
269
+ # config.router_name = :my_engine
270
+ #
271
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
272
+ # so you need to do it manually. For the users scope, it would be:
273
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
274
+ end