what is .....undefined method `authenticate'

def login_submit
   if session['user']
      @logged_in = true
    else
      @logged_in = false
    end
        @user = User.new(params['user'])
    if session['user'] = User.authenticate(params['user']['username'],
params['user']['password'])
      flash[:notice] = l(:user_login_succeeded)
      redirect_to :action => 'list'
    else
      @login = params['user']['login']
      flash.now[:notice] = l(:user_login_failed)
    end
  end

do you have a user model with that method defined?

HERE IS MY USER CONTROLLER---------

class UserController < ApplicationController

  layout "home"

  def list
    @user = User.find(:all)
  end

  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
      if @user.save
            redirect_to :action => 'list'
      else
            redirect_to :action => 'new'
      end
    end

    def login
      @user = User.new
      @user.username = params[:user][:username]
    end

  def login_submit
   username = params[:user][:username]
    password = params[:user][:password]
    if session["user"] = User.authorize(username, password)
      @user = User.find(session["user"].id)
      @user.first_login = 1
      @user.save
      flash[:notice] = "You are now logged in"
      redirect_to :action => 'create'
    else
      flash[:error] = "Incorrect username and/or password"
      redirect_to :action => 'list'
    end
  end
end

You should have a method authenticate defined in User model.

In your case, authenticate method must be defined in User model as

class User < ActiveRecord::Base
  validates_presence_of :username, :message=>"User Name will not
bblank"
  validates_presence_of :password, :message=>"Password cannot be
blank"

# # # # Authenticate method # # #
  def self.authenticate(login, pass)
    find(:first, :conditions=>["login = ? AND password = ?", login,
pass]) # login, password are your users table fields..
  end

end

Thx prasad...........

my prog is running successfully........

in future also if i have any problem i wil contact u........
can u give me u r email-id....

Thnx a lot....... :slight_smile: