Sha256: 5bb3d3e8d6c27fe33583ef72fa41714b8389f42e76bfc84976fea3491151d546

Contents?: true

Size: 926 Bytes

Versions: 7

Compression:

Stored size: 926 Bytes

Contents

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

  def show
    if not resource.nil? and resource.need_change_password?
      render_with_scope :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_with_scope :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

7 entries across 7 versions & 1 rubygems

Version Path
devise_security_extension-0.6.0 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.5.1 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.5.0 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.4.2 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.4.1 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.4.0 app/controllers/devise/password_expired_controller.rb
devise_security_extension-0.3.6 app/controllers/devise/password_expired_controller.rb