Skip to content

Commit

Permalink
Moves minimum_password_length to DeviseController.
Browse files Browse the repository at this point in the history
  • Loading branch information
Katee committed Dec 16, 2014
1 parent 5e12b15 commit d0a30d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 1 addition & 4 deletions app/controllers/devise/passwords_controller.rb
Expand Up @@ -23,10 +23,7 @@ def create
# GET /resource/password/edit?reset_password_token=abcdef
def edit
self.resource = resource_class.new
@validatable = devise_mapping.validatable?
if @validatable
@minimum_password_length = resource_class.password_length.min
end
set_minimum_password_length
resource.reset_password_token = params[:reset_password_token]
end

Expand Down
10 changes: 2 additions & 8 deletions app/controllers/devise/registrations_controller.rb
Expand Up @@ -5,10 +5,7 @@ class Devise::RegistrationsController < DeviseController
# GET /resource/sign_up
def new
build_resource({})
@validatable = devise_mapping.validatable?
if @validatable
@minimum_password_length = resource_class.password_length.min
end
set_minimum_password_length
yield resource if block_given?
respond_with self.resource
end
Expand All @@ -31,10 +28,7 @@ def create
end
else
clean_up_passwords resource
@validatable = devise_mapping.validatable?
if @validatable
@minimum_password_length = resource_class.password_length.min
end
set_minimum_password_length
respond_with resource
end
end
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/devise_controller.rb
Expand Up @@ -154,6 +154,14 @@ def set_flash_message(key, kind, options = {})
end
end

# Sets minimum password length to show to user
def set_minimum_password_length
@validatable = devise_mapping.validatable?
if @validatable
@minimum_password_length = resource_class.password_length.min
end
end

def devise_i18n_options(options)
options
end
Expand Down

0 comments on commit d0a30d4

Please sign in to comment.