1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Refactoring passwords controller

This commit is contained in:
Rodrigo Flores 2011-06-16 16:10:53 -03:00
parent 7d160650b8
commit 8b54ff699f

View file

@ -12,22 +12,19 @@ class Devise::PasswordsController < ApplicationController
def create
self.resource = resource_class.send_reset_password_instructions(params[resource_name])
if resource.errors.empty? || Devise.paranoid
set_flash_message(:notice, Devise.paranoid ? :send_paranoid_instructions : :send_instructions) if is_navigational_format?
#TODO needs refactor
if Devise.paranoid
if resource.errors.any?
set_flash_message(:notice, :send_paranoid_instructions) if is_navigational_format?
resource.errors.clear
end
respond_with_navigational(resource) { render_with_scope :new }
else
if resource.errors.empty?
set_flash_message(:notice, :send_instructions) if is_navigational_format?
respond_with resource, :location => new_session_path(resource_name)
end
else
respond_with_navigational(resource){ render_with_scope :new }
end
end
end
# GET /resource/password/edit?reset_password_token=abcdef