# Weird ever loop question

**URL:** <https://www.ruby-forum.com/t/weird-ever-loop-question/120560>\
**Category:** Rails\
**Created:** [November 18, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/weird-ever-loop-question/120560 "2007-11-18T15:09:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSSSSSS\_SSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/87869e/32.png) [@SSSSSSSS\_SSSS](https://www.ruby-forum.com/u/SSSSSSSS_SSSS)\
**Post date:** [November 18, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/weird-ever-loop-question/120560/1 "2007-11-18T15:09:01Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![SSSSSSSS\_SSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/87869e/32.png) [@SSSSSSSS\_SSSS](https://www.ruby-forum.com/u/SSSSSSSS_SSSS)\
**Post date:** [November 18, 2007, 5:53pm UTC](https://www.ruby-forum.com/t/weird-ever-loop-question/120560/2 "2007-11-18T17:53:26Z")

</div>

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

- [http://svn.techno-weenie.net/projects/plugins/acts\_as\_authenticated/](http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/)
- [http://svn.techno-weenie.net/projects/plugins/restful\_authentication/](http://svn.techno-weenie.net/projects/plugins/restful_authentication/)

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
