authenticate 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile +0 -4
  4. data/Gemfile.lock +0 -5
  5. data/README.md +149 -78
  6. data/app/controllers/authenticate/passwords_controller.rb +130 -0
  7. data/app/controllers/authenticate/sessions_controller.rb +46 -0
  8. data/app/controllers/authenticate/users_controller.rb +46 -0
  9. data/app/mailers/authenticate_mailer.rb +13 -0
  10. data/app/views/authenticate_mailer/change_password.html.erb +8 -0
  11. data/app/views/authenticate_mailer/change_password.text.erb +5 -0
  12. data/app/views/layouts/application.html.erb +25 -0
  13. data/app/views/passwords/edit.html.erb +20 -0
  14. data/app/views/passwords/new.html.erb +19 -0
  15. data/app/views/sessions/new.html.erb +28 -0
  16. data/app/views/users/new.html.erb +24 -0
  17. data/authenticate.gemspec +1 -2
  18. data/config/locales/authenticate.en.yml +57 -0
  19. data/config/routes.rb +14 -1
  20. data/lib/authenticate/callbacks/brute_force.rb +5 -9
  21. data/lib/authenticate/callbacks/lifetimed.rb +1 -0
  22. data/lib/authenticate/callbacks/timeoutable.rb +2 -1
  23. data/lib/authenticate/callbacks/trackable.rb +1 -3
  24. data/lib/authenticate/configuration.rb +94 -5
  25. data/lib/authenticate/controller.rb +69 -9
  26. data/lib/authenticate/debug.rb +1 -0
  27. data/lib/authenticate/engine.rb +4 -11
  28. data/lib/authenticate/model/brute_force.rb +22 -3
  29. data/lib/authenticate/model/db_password.rb +12 -7
  30. data/lib/authenticate/model/email.rb +8 -10
  31. data/lib/authenticate/model/password_reset.rb +76 -0
  32. data/lib/authenticate/model/timeoutable.rb +9 -3
  33. data/lib/authenticate/model/trackable.rb +1 -1
  34. data/lib/authenticate/model/username.rb +21 -8
  35. data/lib/authenticate/modules.rb +19 -1
  36. data/lib/authenticate/session.rb +3 -1
  37. data/lib/authenticate/user.rb +6 -1
  38. data/lib/authenticate/version.rb +1 -1
  39. data/lib/generators/authenticate/controllers/USAGE +12 -0
  40. data/lib/generators/authenticate/controllers/controllers_generator.rb +21 -0
  41. data/lib/generators/authenticate/install/USAGE +7 -0
  42. data/lib/generators/authenticate/install/install_generator.rb +140 -0
  43. data/lib/generators/authenticate/install/templates/authenticate.rb +22 -0
  44. data/lib/generators/authenticate/install/templates/db/migrate/add_authenticate_brute_force_to_users.rb +6 -0
  45. data/lib/generators/authenticate/install/templates/db/migrate/add_authenticate_password_reset_to_users.rb +7 -0
  46. data/lib/generators/authenticate/install/templates/db/migrate/add_authenticate_timeoutable_to_users.rb +5 -0
  47. data/lib/generators/authenticate/install/templates/db/migrate/add_authenticate_to_users.rb +21 -0
  48. data/lib/generators/authenticate/install/templates/db/migrate/create_users.rb +14 -0
  49. data/lib/generators/authenticate/install/templates/user.rb +3 -0
  50. data/lib/generators/authenticate/routes/USAGE +8 -0
  51. data/lib/generators/authenticate/routes/routes_generator.rb +32 -0
  52. data/lib/generators/authenticate/routes/templates/routes.rb +10 -0
  53. data/lib/generators/authenticate/views/USAGE +13 -0
  54. data/lib/generators/authenticate/views/views_generator.rb +21 -0
  55. data/spec/dummy/app/controllers/application_controller.rb +1 -0
  56. data/spec/dummy/config/initializers/authenticate.rb +12 -5
  57. data/spec/dummy/db/development.sqlite3 +0 -0
  58. data/spec/dummy/db/migrate/20160130192728_create_users.rb +18 -0
  59. data/spec/dummy/db/migrate/20160130192729_add_authenticate_brute_force_to_users.rb +6 -0
  60. data/spec/dummy/db/migrate/20160130192730_add_authenticate_timeoutable_to_users.rb +5 -0
  61. data/spec/dummy/db/migrate/20160130192731_add_authenticate_password_reset_to_users.rb +7 -0
  62. data/spec/dummy/db/schema.rb +14 -10
  63. data/spec/dummy/db/test.sqlite3 +0 -0
  64. data/spec/factories/users.rb +5 -8
  65. data/spec/model/brute_force_spec.rb +63 -0
  66. data/spec/model/session_spec.rb +4 -0
  67. data/spec/model/user_spec.rb +15 -5
  68. data/spec/spec_helper.rb +2 -1
  69. metadata +41 -9
  70. data/app/controllers/.keep +0 -0
  71. data/app/mailers/.keep +0 -0
  72. data/app/views/.keep +0 -0
  73. data/spec/dummy/db/migrate/20160120003910_create_users.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95466d6fe7aaa95a7157ca870d2cb7324a11aacf
4
- data.tar.gz: f10ec192418dff2700252c2c37c99ff0324c18ba
3
+ metadata.gz: 1233e7491c83dd3155f5546e45fe6de01e3dfba3
4
+ data.tar.gz: 8cf747a94820850842e2ae37137a2be1bdd22f6a
5
5
  SHA512:
6
- metadata.gz: 137399918e6cad2a327fde6bda5c724192d10cc52b7c5682814773641662ab4b58808a48a7a3076e1baf9dde108cc4db942675bdf3072177aa8ab3cb6dc489a8
7
- data.tar.gz: be34b75f473e5f0ae869c0859710a158c87a92d02bd5d2166d0ebe9527ce02eb58458027bdc1133665d2ee3be4148ddd58cbfeac14618ea548e4156fe76a6973
6
+ metadata.gz: 578c426daca72149a48eea0340da3df6c98dda9df0707eef6479dc9aa2b622ccfe113ab16a2cfe1bf693974368545af190710371f29959108b01bc6b40cd408b
7
+ data.tar.gz: 70817ffbf340daa66078abf00b427412e6bec84b8257c4fd5d1f5fa30ed200718f2b6bd73c81c72b8dc58d7f1c520ed95c890080b6c91e615d0e3054ad7aa353
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Authenticate Changelog
2
+
3
+
4
+ ## [0.2.0] - February 2, 2016
5
+
6
+ Added app/ including controllers, views, routes, mailers.
7
+
8
+
9
+ ## [0.1.0] - January 23, 2016
10
+
11
+ Initial Release, barely functioning
data/Gemfile CHANGED
@@ -1,10 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails'
4
- gem 'sqlite3'
5
- gem 'pry'
6
- gem 'factory_girl_rails'
7
- # gem 'capybara'
8
4
 
9
5
  # Declare your gem's dependencies in authenticate.gemspec.
10
6
  # Bundler will treat runtime dependencies like base dependencies, and
data/Gemfile.lock CHANGED
@@ -104,10 +104,6 @@ GEM
104
104
  rake (>= 0.8.7)
105
105
  thor (>= 0.18.1, < 2.0)
106
106
  rake (10.4.2)
107
- rspec (3.1.0)
108
- rspec-core (~> 3.1.0)
109
- rspec-expectations (~> 3.1.0)
110
- rspec-mocks (~> 3.1.0)
111
107
  rspec-core (3.1.7)
112
108
  rspec-support (~> 3.1.0)
113
109
  rspec-expectations (3.1.2)
@@ -146,7 +142,6 @@ DEPENDENCIES
146
142
  factory_girl_rails
147
143
  pry
148
144
  rails
149
- rspec
150
145
  rspec-rails
151
146
  sqlite3
152
147
 
data/README.md CHANGED
@@ -7,21 +7,79 @@ open to significant modification.
7
7
 
8
8
  Authenticate is inspired by, and draws from, Devise, Warden, Authlogic, Clearance, Sorcery, and restful_authentication.
9
9
 
10
+ Please use [GitHub Issues] to report bugs.
11
+
12
+ [GitHub Issues]: https://github.com/tomichj/authenticate/issues
13
+
14
+
15
+
16
+ ## Philosophy
17
+
18
+ * simple - Authenticate's code is straightforward and easy to read.
19
+ * opinionated - set the "right" defaults, but let you control almost everything if you want
20
+ * small footprint - as few public methods and modules as possible
21
+ * configuration driven - almost all configuration is performed in the initializer
22
+
23
+
24
+
25
+ ## Implementation Overview
26
+
27
+ Authenticate:
28
+ * loads modules into your user model to provide authentication functionality
29
+ * loads `callbacks` that are triggered during authentication and access events. All authentication
30
+ decisions are performed in callbacks, e.g. do you have a valid session, has your session timed out, etc.
31
+ * loads a module into your controllers (typically application controller) to secure controller actions
32
+
33
+ The callback architecture is based on the system used by devise and warden, but significantly simplified.
34
+
35
+
36
+ ### Session Token
37
+
38
+ Authenticate generates and clears a token (called a 'session token') to identify the user from a saved cookie.
39
+ When a user authenticates successfully, Authenticate generates and stores a 'session token' for your user in
40
+ your database. The session token is also stored in a cookie in the user's browser.
41
+ The cookie is then presented upon each subsequent access attempt to your server.
42
+
43
+ ### User Model
44
+
45
+
46
+
10
47
 
11
48
  ## Install
12
49
 
13
- Installation is pretty standard. Authenticate does not currently have an automated install process. One is coming.
50
+ To get started, add Authenticate to your `Gemfile`:
14
51
 
15
- * Include `Authenticate::User` into your `User` model.
16
- * Include `Authenticate::Controller` into your `ApplicationController`
17
- * Add an initializer: config/intializers/authenticate.rb containing:
18
- Authenticate.configure do |config|
19
- # any settings you wish to tweak, see below
20
- end
21
- * Create a migration for any Authenticate features you wish to take advantage of. Here's a good default:
22
- `rails g migration AddAuthenticateToUsers email:string encrypted_password:string session_token:string
23
- session_expiration:datetime sign_in_count:integer last_sign_in_at:datetime last_sign_in_ip:string
24
- last_access_at:datetime current_sign_in_at:datetime current_sign_in_ip:string`
52
+ ```ruby
53
+ gem 'authenticate'
54
+ ```
55
+
56
+ Then run:
57
+
58
+ ```sh
59
+ bundle install
60
+ ```
61
+
62
+ Then run the installation generator:
63
+
64
+ ```sh
65
+ rails generate authenticate:install
66
+ ```
67
+
68
+ The generator does the following:
69
+
70
+ * Insert `include Authenticate::User` into your `User` model.
71
+ * Insert `include Authenticate::Controller` into your `ApplicationController`
72
+ * Add an initializer at `config/intializers/authenticate.rb`.
73
+ * Create migrations to either create a users table or add additional columns to :user. A primary migration is added,
74
+ 'create users' or 'add_authenticate_to_users'. This migration is required. Two additonal migrations are created
75
+ to support the 'brute_force' and 'timeoutable' modules. You may delete the brute_force and timeoutable migrations,
76
+ but those migrations are required if you use those Authenticate features (see Configure, next).
77
+
78
+ Finally, you'll need to run the migrations that Authenticate just generated:
79
+
80
+ ```sh
81
+ rake db:migrate
82
+ ```
25
83
 
26
84
 
27
85
  ## Configure
@@ -30,18 +88,22 @@ Override any of these defaults in your application `config/initializers/authenti
30
88
 
31
89
  ```ruby
32
90
  Authenticate.configure do |config|
33
- config.user_model = 'User'
34
- config.cookie_name = 'authenticate_session_token'
35
- config.cookie_expiration = { 1.year.from_now.utc }
36
- config.cookie_domain = nil
37
- config.crypto_provider = Bcrypt
38
- config.timeout_in = nil # 45.minutes
39
- config.max_session_lifetime = nil # 8.hours
40
- config.max_consecutive_bad_logins_allowed = nil # 5
41
- config.bad_login_lockout_period = nil # 5.minutes
42
- config.authentication_strategy = :email
91
+ config.user_model = 'User'
92
+ config.cookie_name = 'authenticate_session_token'
93
+ config.cookie_expiration = { 1.year.from_now.utc }
94
+ config.cookie_domain = nil
95
+ config.cookie_path = '/
96
+ config.secure_cookie = false
97
+ config.http_only = false
98
+ config.crypto_provider = Bcrypt
99
+ config.timeout_in = nil # 45.minutes
100
+ config.max_session_lifetime = nil # 8.hours
101
+ config.max_consecutive_bad_logins_allowed = nil # 5
102
+ config.bad_login_lockout_period = nil # 5.minutes
103
+ config.authentication_strategy = :email
43
104
  ```
44
105
 
106
+ Configuration parameters are described in detail here: [Configuration](lib/authenticate/configuration.rb)
45
107
 
46
108
 
47
109
  ### timeout_in
@@ -53,7 +115,6 @@ If the interval between the current access time and the last access time is grea
53
115
  the session is invalidated. The user will be prompted for authentication again.
54
116
 
55
117
 
56
-
57
118
  ### max_session_lifetime
58
119
 
59
120
  * max_session_lifetime: the maximum interval a session is valid, regardless of user activity.
@@ -63,7 +124,6 @@ max_session_lifetime. The user session is invalidated and the next access will w
63
124
  authentication again.
64
125
 
65
126
 
66
-
67
127
  ### max_consecutive_bad_logins_allowed & bad_login_lockout_period
68
128
 
69
129
  * max_consecutive_bad_logins_allowed: an integer
@@ -74,7 +134,6 @@ The user's consecutive bad logins will be tracked, and if they exceed the allowe
74
134
  will be locked. The lock will last `bad_login_lockout_period`, which can be any time period (e.g. `10.minutes`).
75
135
 
76
136
 
77
-
78
137
  ### authentication_strategy
79
138
 
80
139
  The default authentication strategy is :email. This requires that your User model have an attribute named `email`.
@@ -85,50 +144,18 @@ You may instead opt for :username. The username strategy will identify users wit
85
144
  The strategy will also add username attribute validation, ensuring the username exists and is unique.
86
145
 
87
146
 
147
+
88
148
  ## Use
89
149
 
90
150
  ### Authentication
91
151
 
92
- To perform authentication use:
93
-
94
- * authenticate(params) - authenticate a user with credentials in params, return user if correct.
95
- `params[:session][:email]` and `params[:session][:password]` are required for the :email authentication
96
- strategy. `params[:session][:username]` and `params[:session][:password]` are required for
97
- the :username authentication strategy.
98
-
99
- * login(user, &block) - log in the just-authenticated user. Login will run all rules as provided in the configuration,
100
- such as timeout_in detection, max_session_lifetime, etc. You can provide a block to this method to handle the result.
101
- Your block will receive either {SuccessStatus} or {FailureStatus}.
102
-
103
- An example session controller:
152
+ Authenticate provides a session controller and views to authenticate users. After successful authentication,
153
+ the user is redirected to the path they attempted to access, or as specified by the `redirect_url` property
154
+ in your configuration. This defaults to '/' but can customized:
104
155
 
105
156
  ```ruby
106
- class SessionsController < ActionController::Base
107
- include Authenticate::Controller
108
-
109
- def create
110
- user = authenticate(params)
111
- login(user) do |status|
112
- if status.success?
113
- flash[:notice] = 'You successfully logged in! Very nice.'
114
- logger.info flash[:notice].inspect
115
- redirect_to '/'
116
- else
117
- flash[:notice] = status.message
118
- logger.info flash[:notice].inspect
119
- render template: 'sessions/new', status: :unauthorized
120
- end
121
- end
122
- end
123
-
124
-
125
- def new
126
- end
127
-
128
- def destroy
129
- logout
130
- redirect_to '/', notice: 'You logged out successfully'
131
- end
157
+ Authenticate.configure do |config|
158
+ config.redirect_url = '/specials'
132
159
  end
133
160
  ```
134
161
 
@@ -153,7 +180,7 @@ Example:
153
180
  ```erb
154
181
  <% if authenticated? %>
155
182
  <%= current_user.email %>
156
- <%= button_to "Sign out", sign_out_path, method: :delete %>
183
+ <%= link_to "Sign out", sign_out_path %>
157
184
  <% else %>
158
185
  <%= link_to "Sign in", sign_in_path %>
159
186
  <% end %>
@@ -173,23 +200,64 @@ end
173
200
  ```
174
201
 
175
202
 
203
+ ## Overriding Authenticate
204
+
205
+ ### Views
206
+
207
+ You can quickly get started with a rails application using the built-in views. See [app/views](/app/views) for
208
+ the default views. When you want to customize an Authenticate view, create your own copy of it in your app.
209
+
210
+ You can use the Authenticate view generator to copy the default views into your application:
211
+
212
+ ```sh
213
+ $ rails generate authenticate:views
214
+ ```
215
+
216
+
217
+ ### Controllers
218
+
219
+ If the customization at the views level is not enough, you can customize each controller, and the
220
+ authenticate mailer. See [app/controllers](/app/controllers) for the default controllers, and
221
+ [app/mailers](/app/mailers) for the default mailer.
222
+
223
+ You can use the Authenticate controller generator to copy the default controllers and mailer into your application:
224
+
225
+ ```sh
226
+ $ rails generate authenticate:controllers
227
+ ```
228
+
229
+
230
+ ### Routes
231
+
232
+ Authenticate adds routes. See [config/routes.rb](/config/routes.rb) for the default routes.
233
+
234
+ If you want to control and customizer the routes, you can turn off the built-in routes in
235
+ the Authenticate configuration with `config.routes = false`.
236
+
237
+ You can optionally run a generator to dump a copy of the default routes into your application for modification.
238
+
239
+ ```sh
240
+ $ rails generate authenticate:routes
241
+ ```
242
+
243
+
176
244
  ## Extending Authenticate
177
245
 
178
- Authenticate can be extended with two mechanisms:
246
+ Authenticate can be further extended with two mechanisms:
179
247
 
180
248
  * user modules: add behavior to the user model
181
- * callbacks: add login during various authentication events, during login and access
182
-
249
+ * callbacks: add behavior during various authentication events, such as login and subsequent hits
183
250
 
184
251
 
185
252
  ### User Modules
186
253
 
187
- Add behavior to your User model for your callbacks to use. Include them yourself directly in your User class,
188
- or via the Authentication configuration.
254
+ Add behavior to your User model for your callbacks to use. You can, of course, incldue behavrio yourself directly
255
+ in your User class, but you can also use the Authenticate module loading system.
256
+
257
+ To add a custom module to Authenticate, e.g. `MyUserModule`:
189
258
 
190
- Example:
191
259
  ```ruby
192
- Authenticate.configuraton do |config|
260
+ Authenticate.configuration do |config|
193
261
  config.modules = [MyUserModule]
194
262
  end
195
263
  ```
@@ -197,38 +265,41 @@ end
197
265
 
198
266
  ### Callbacks
199
267
 
200
- Callbacks can be added with `after_set_user` or `after_authentication`. See {Authenticate::Lifecycle} for full details.
268
+ Callbacks can be added to Authenticate. Use `Authenticate.lifecycle.after_set_user` or
269
+ `Authenticate.lifecycle.after_authentication`. See [Lifecycle](lib/authenticate/lifecycle.rb) for full details.
201
270
 
202
- Callbacks can `throw(:failure, message)` to signal an authentication/authorization failure, or perform
271
+ Callbacks can `throw(:failure, message)` to signal an authentication/authorization failure. Callbacks can also perform
203
272
  actions on the user or session. Callbacks are passed a block at runtime of `|user, session, options|`.
204
273
 
205
-
206
- Example that counts logins for users. It consists of a module for User, and a callback that is
274
+ Here's an example that counts logins for users. It consists of a module for User, and a callback that is
207
275
  set in the `included` block. The callback is then added to the User module via the Authenticate configuration.
208
276
 
209
277
  ```ruby
278
+ # app/models/concerns/login_count.rb
210
279
  module LoginCount
211
280
  extend ActiveSupport::Concern
212
281
 
213
- included do
214
- # authentication hook
282
+ included do
283
+ # Add a callback that is triggered after every authentication
215
284
  Authenticate.lifecycle.after_authentication name:'login counter' do |user, session, options|
216
285
  user.count_login if user
217
286
  end
218
287
  end
219
288
 
220
289
  def count_login
290
+ self.login_count ||= 0
221
291
  self.login_counter += 1
222
292
  end
223
293
  end
224
294
 
225
- Authenticate.configiration do |config|
295
+ # config/initializers/authenticate.rb
296
+ # You could also just `include LoginCount` in your user model.
297
+ Authenticate.configuration do |config|
226
298
  config.modules = [LoginCount]
227
299
  end
228
300
  ```
229
301
 
230
302
 
231
-
232
303
  ## Testing
233
304
 
234
305
  Authenticate has been tested with rails 4.2, other versions to follow.
@@ -0,0 +1,130 @@
1
+ # Request password change via an emailed link with a unique token.
2
+ # Thanks to devise and Clearance.
3
+ class Authenticate::PasswordsController < ApplicationController
4
+ skip_before_action :require_authentication, only: [:create, :edit, :new, :update], raise: false
5
+ before_action :ensure_existing_user, only: [:edit, :update]
6
+
7
+ # Display screen to request a password change email.
8
+ # GET /users/passwords/new
9
+ def new
10
+ render template: 'passwords/new'
11
+ end
12
+
13
+ # Send password change email.
14
+ #
15
+ # POST /users/password
16
+ def create
17
+ if user = find_user_for_create
18
+ user.forgot_password!
19
+ deliver_email(user)
20
+ end
21
+ redirect_to sign_in_path, notice: flash_create_description
22
+ end
23
+
24
+ # Screen to enter your new password.
25
+ #
26
+ # GET /users/passwords/3/edit?token=abcdef
27
+ def edit
28
+ @user = find_user_for_edit
29
+ if !@user.reset_password_period_valid?
30
+ redirect_to sign_in_path, notice: flash_failure_token_expired
31
+ else
32
+ render template: 'passwords/edit'
33
+ end
34
+ end
35
+
36
+ # Save the new password entered in #edit.
37
+ #
38
+ # PUT /users/passwords/3/
39
+ def update
40
+ @user = find_user_for_update
41
+
42
+ if !@user.reset_password_period_valid?
43
+ redirect_to sign_in_path, notice: flash_failure_token_expired
44
+ elsif @user.update_password password_reset_params
45
+ login @user
46
+ redirect_to url_after_update, notice: flash_success_password_changed
47
+ else
48
+ # failed to update password for some reason
49
+ flash.now[:notice] = flash_failure_after_update
50
+ render template: 'passwords/edit'
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def deliver_email(user)
57
+ mail = ::AuthenticateMailer.change_password(user)
58
+
59
+ if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new('4.2.0')
60
+ mail.deliver_later
61
+ else
62
+ mail.deliver
63
+ end
64
+ end
65
+
66
+ def password_reset_params
67
+ params[:password_reset][:password]
68
+ end
69
+
70
+ def find_user_for_create
71
+ Authenticate.configuration.user_model_class.find_by_email params[:password][:email]
72
+ end
73
+
74
+ def find_user_for_edit
75
+ find_user_by_id_and_password_reset_token
76
+ end
77
+
78
+ def find_user_for_update
79
+ find_user_by_id_and_password_reset_token
80
+ end
81
+
82
+ def ensure_existing_user
83
+ unless find_user_by_id_and_password_reset_token
84
+ flash.now[:notice] = flash_failure_when_forbidden
85
+ render template: 'passwords/new'
86
+ end
87
+ end
88
+
89
+ def find_user_by_id_and_password_reset_token
90
+ Authenticate.configuration.user_model_class.where(id: params[:id], password_reset_token: params[:token].to_s).first
91
+ end
92
+
93
+ def flash_create_description
94
+ translate(:description,
95
+ scope: [:Authenticate, :controllers, :passwords],
96
+ default: t('passwords.create.description'))
97
+ end
98
+
99
+ def flash_success_password_changed
100
+ translate(:success_password_changed,
101
+ scope: [:Authenticate, :controllers, :passwords],
102
+ default: t('flashes.success_password_changed'))
103
+ end
104
+
105
+ def flash_failure_token_expired
106
+ translate(:failure_token_expired,
107
+ scope: [:Authenticate, :controllers, :passwords],
108
+ default: t('flashes.failure_token_expired'))
109
+ end
110
+
111
+ def flash_failure_when_forbidden
112
+ translate(:forbidden,
113
+ scope: [:Authenticate, :controllers, :passwords],
114
+ default: t('flashes.failure_when_forbidden'))
115
+ end
116
+
117
+ def flash_failure_after_update
118
+ translate(:blank_password,
119
+ scope: [:Authenticate, :controllers, :passwords],
120
+ default: t('flashes.failure_after_update'))
121
+ end
122
+
123
+ def url_after_create
124
+ sign_in_url
125
+ end
126
+
127
+ def url_after_update
128
+ Authenticate.configuration.redirect_url
129
+ end
130
+ end