Sha256: 0b38e3535c4d510380d9a94ed10e0465692dad9d718ba80a528db4e2af4b5b5e

Contents?: true

Size: 994 Bytes

Versions: 28

Compression:

Stored size: 994 Bytes

Contents

class SessionsController < ApplicationController
  
  layout 'admin'
  filter_parameter_logging 'password', 'password_confirmation'
    
  def create
    self.current_user = User.authenticate(params[:session][:login], params[:session][:password])
    if logged_in?
      if params[:session][:remember_me] == "1"
        current_user.remember_me unless current_user.remember_token?
        cookies[:auth_token] = {:value => self.current_user.remember_token ,
                                :expires => self.current_user.remember_token_expires_at}
      end
      redirect_back_or_default(admin_root_url)
      flash[:notice] = "Logged in successfully"
    else
      flash[:error] = "Sorry, your password or username was incorrect."
      render :action => 'new'
    end
  end

  def destroy
    self.current_user.forget_me if logged_in?
    cookies.delete :auth_token
    reset_session
    flash[:notice] = "You have been logged out."
    redirect_back_or_default(new_session_url)
  end
  
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
refinerycms-0.9.5.13 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.12 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.11 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.10 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.9 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.8 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.7 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.6 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.5 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.4 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.3 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.2 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5.1 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.5 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.4.5 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.4.4 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.4.3 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.4.2 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.4.1 vendor/plugins/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.4 vendor/plugins/authentication/app/controllers/sessions_controller.rb