Help needed ror

Hello all,
I wanted that a particular user can login only 1 time in a day and his
details are updated in the table.Can anyone help me with it.

my login method is

args = params[:user]
@user = User.find_by_username(args[:username])
if @user && @user.password == args[:password]
session[:login] = @user.username
redirect_to( :controller => “users”, :action => “show”)
else
session[:login] = nil

redirect_to logins_path()
flash[:notice] = “Wrong username or password”
end

any help would be appriciated