Sha256: 1561ca3a3aee30f108121b8cf84497d9c5edd41aecbf72c0d18f7a07970de847

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

class SessionsController < ApplicationController
  
  def new
    redirect_to kublog_path if signed_in?
  end
  
  def create
    @user = User.find_by_email(params[:email])
    if @user.authenticate(params[:password])
      self.current_user = @user 
      redirect_to kublog_path, :notice => 'logged in successfully'
    else
      render 'new'
    end
  end
  
  def destroy
    session[:user_id] = nil
    redirect_to new_session_path, :notice => 'Logged out successfully'
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kublog-0.9.0 spec/dummy/app/controllers/sessions_controller.rb
kublog-0.0.1.1 test/dummy/app/controllers/sessions_controller.rb