Weird ever loop question

Hi, folks,
I’ve run into a weird problem when I was trying to implement an
authentication system myself, here is the adminController code,

class AdminController < ApplicationController
before_filter :check_authentication, :except =>
[:signin_form, :signin]

def index
end

def signin_form
end

def signin
session[:user] = User.authenticate(params[:username],
params[:password]).id
redirect_to :action=>session[:intended_action]
end

def check_authentication
unless session[:user]
session[:intended_action] = action_name
redirect_to :action=>“singin_form”
end
end
end

I restart my webrick server and I typed http://localhost:3000/admin,
it should go to signin_form.rhtml to ask me sign in, but what happned
is ever loop sending request to signin_form, any informative tips will
be appreciated.

All the best,
Liu Hao

Hello Liu:

Firstly, I wouldn’t implement an authentication system your self as
there are plenty of good plugins out there for that. Try checking out

Secondly, there are a couple of issues with the code in the
check_authentication method:

  session[:intended_action] = action_name # where is action_name

being set/coming from?
redirect_to :action=>“singin_form” Your redirect action is
incorrrect - should be signin_form

Cheers,
Nicholas