Sha256: e59c3c625b2903b411e1b37dbc79aedb08007ac1adaa5a117680c2c9c8096fe5

Contents?: true

Size: 941 Bytes

Versions: 3

Compression:

Stored size: 941 Bytes

Contents

class Devise::PasswordExpiredController < DeviseController
  skip_before_filter :handle_password_change
  prepend_before_filter :authenticate_scope!, :only => [:show, :update]
  include Devise::Controllers::Helpers

  def show
    if not resource.nil? and resource.need_change_password?
      render 'devise/password_expired/show'
    else
      redirect_to :root
    end
  end

  def update
    if resource.update_with_password(params[resource_name])
      warden.session(scope)[:password_expired] = false
      set_flash_message :notice, :updated
      sign_in scope, resource, :bypass => true
      redirect_to stored_location_for(scope) || :root
    else
      clean_up_passwords(resource)
      render 'devise/password_expired/show'
    end
  end

  private

  def scope
    resource_name.to_sym
  end

  def authenticate_scope!
    send(:"authenticate_#{resource_name}!")
    self.resource = send("current_#{resource_name}")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devise_security_extension-0.7.0 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.6.2 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.6.1 app/controllers/devise/password_expired_controller.rb