Sha256: b627d95509677fe3cd2ec67f59290f3beea8da7d0dda271cabb6f493ed8566ac

Contents?: true

Size: 949 Bytes

Versions: 3

Compression:

Stored size: 949 Bytes

Contents

class SessionsController < ApplicationController
  layout 'sessions'
  skip_before_filter :require_puavo_authorization, :only => [:new, :create]
  skip_before_filter :require_login, :only => [:new, :create]

  def new
  end

  def create
    session[:uid] = params[:user][:uid]
    session[:password_plaintext] = params[:user][:password]
    session[:login_flash] = t('flash.session.login_successful')
    redirect_back_or_default root_path
  end

  def auth
    
    respond_to do |format|
      format.json { render :json => true.to_json }
    end
  end

  def show
    @user = current_user
    respond_to do |format|
      format.json  { render :json => @user.to_json(:methods => :managed_schools) }
    end
  end

  def destroy
    # Remove dn and plaintext password values from session
    session.delete :password_plaintext
    session.delete :uid
    flash[:notice] = t('flash.session.logout_successful')
    redirect_to login_path
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puavo_authentication-0.2.5 app/controllers/sessions_controller.rb
puavo_authentication-0.2.4 app/controllers/sessions_controller.rb
puavo_authentication-0.2.3 app/controllers/sessions_controller.rb