app/controllers/login_controller.rb
def login
    # If it's GET request, render form
    if request.get?
      session[:user_id] = nil
      @log_user = User.new
    
    # Try logging in if POST request
    elsif request.post?
      logged_in_user = User.authorize(params[:log_user][:login], params[:log_user][:password])      
      if logged_in_user.kind_of? User
        if logged_in_user.is_inactive?
          flash[:error] = "Your account is currently inactive"
        else
          session[:user_id] = logged_in_user.id
          redirect_to(:controller => "your_data")
        end
      else
        session[:user_id] = nil
        flash[:error] = "Invalid user/password combination"
      end
    end
  end
#
# Signs-in user if login and password are correct, by setting session[:user_id]
# This is a default way to authorize users in application
#

Signs-in user if login and password are correct, by setting session[:user_id]
This is a default way to authorize users in application
Signs - in user if login and password are correct by setting session [ : user_id ] This is a default way to authorize users in application
def login
    if request.get?
      session[:user_id] = nil
      @log_user = User.new
    elsif request.post?
      logged_in_user = User.authorize(params[:log_user][:login], params[:log_user][:password])      
      if logged_in_user.kind_of? User
        if logged_in_user.is_inactive?
          flash[:error] = "Your account is currently inactive"
        else
          session[:user_id] = logged_in_user.id
          redirect_to(:controller => "your_data")
        end
      else
        session[:user_id] = nil
        flash[:error] = "Invalid user/password combination"
      end
    end
  end
def login if request . get? session [ :user_id ] = nil @log_user = User . new elsif request . post? logged_in_user = User . authorize ( params [ :log_user ] [ :login ] , params [ :log_user ] [ :password ] ) if logged_in_user . kind_of? User if logged_in_user . is_inactive? flash [ :error ] = "Your account is currently inactive" else session [ :user_id ] = logged_in_user . id redirect_to ( :controller => "your_data" ) end else session [ :user_id ] = nil flash [ :error ] = "Invalid user/password combination" end end end
Signs-in user if login and password are correct, by setting session[:user_id]
This is a default way to authorize users in application
Signs - in user if login and password are correct by setting session [ : user_id ] This is a default way to authorize users in application
# If it's GET request, render form
 # Try logging in if POST request
