# Acts as Authenticated Multiple login screens

**URL:** <https://www.ruby-forum.com/t/acts-as-authenticated-multiple-login-screens/104435>\
**Category:** Rails\
**Created:** [May 17, 2007, 10:13pm UTC](https://www.ruby-forum.com/t/acts-as-authenticated-multiple-login-screens/104435 "2007-05-17T22:13:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valehru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e36b37/32.png) [@Valehru](https://www.ruby-forum.com/u/Valehru)\
**Post date:** [May 17, 2007, 10:13pm UTC](https://www.ruby-forum.com/t/acts-as-authenticated-multiple-login-screens/104435/1 "2007-05-17T22:13:27Z")

</div>

I have need to display two distinguishing types of information on the  
login.rhtml view, one for a hunter and the other for a recruiter. The  
are both based on the same user model that acts as authenticated has  
created.

Each of the methods hunter/index and recruiter/index redirect me to  
account/login when I need to login to the system. I need a way to  
find out from what the controller was before it hit the account/login  
redirect, either it was recruiter or hunter.

Is there a way of doing getting the name of the controller before that  
redirect and accessing it from the account/login view?

---

<div class="post-metadata">

**Author:** ![Valehru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e36b37/32.png) [@Valehru](https://www.ruby-forum.com/u/Valehru)\
**Post date:** [May 17, 2007, 10:16pm UTC](https://www.ruby-forum.com/t/acts-as-authenticated-multiple-login-screens/104435/2 "2007-05-17T22:16:28Z")

</div>

Look at it as there are two partial views to be rendered with the  
login screen. Either hunter or recruiter partial depending on which  
link was clicked before the redirect to /account/login. I need a way  
of finding out that controller name…

---

<div class="post-metadata">

**Author:** ![Valehru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e36b37/32.png) [@Valehru](https://www.ruby-forum.com/u/Valehru)\
**Post date:** [May 17, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/acts-as-authenticated-multiple-login-screens/104435/3 "2007-05-17T22:50:30Z")

</div>

On May 17, 4:12 pm, Valehru [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have need to display two distinguishing types of information on the  
> login.rhtml view, one for a hunter and the other for a recruiter. The  
> are both based on the same user model that acts as authenticated has  
> created.
> 
> Each of the methods hunter/index and recruiter/index redirect me to  
> account/login when I need to login to the system. I need a way to  
> find out from what the controller was before it hit the account/login  
> redirect, either it was recruiter or hunter.

The session contains the originating request URL in  
session[:return\_to]. It’s messy, but you could parse the  
route and figure out the component from there.

Or you could change lib/authenticated\_system.rb to provide a more  
elegant workflow for click-thru tracking.  
-angel

---

<div class="post-metadata">

**Author:** ![Valehru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e36b37/32.png) [@Valehru](https://www.ruby-forum.com/u/Valehru)\
**Post date:** [May 18, 2007, 8:38pm UTC](https://www.ruby-forum.com/t/acts-as-authenticated-multiple-login-screens/104435/4 "2007-05-18T20:38:06Z")

</div>

Or you could simply create two login actions and link to whichever one  
is appropriate
