Class: PasswordsController

Inherits:
Devise::PasswordsController
  • Object
show all
Defined in:
app/controllers/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/passwords_controller.rb', line 3

def update
  self.resource = resource_class.reset_password_by_token(resource_params)

  if resource.errors.empty?
    resource.unlock_access! if unlockable?(resource)
    flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
    set_flash_message(:notice, flash_message) if is_navigational_format?
    (resource_name, resource)
    respond_with resource, :location => after_resetting_password_path_for(resource)
  else
    if resource.errors[:password]
      return respond_with resource
    end

    flash[:notice] = I18n.t('devise.failure.password_token')
    redirect_to new_password_path(resource_name)
  end
end