# Simple login action help

**URL:** <https://www.ruby-forum.com/t/simple-login-action-help/114505>\
**Category:** Rails\
**Created:** [September 13, 2007, 2:44pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505 "2007-09-13T14:44:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dotty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@dotty](https://www.ruby-forum.com/u/dotty)\
**Post date:** [September 13, 2007, 2:44pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505/1 "2007-09-13T14:44:47Z")

</div>

def do\_login  
@login\_u = params[:username]  
@login\_p = params[:password]  
@login\_ua == “admin”  
@login\_pa == “letmein”  
if @login\_u == @login\_ua && @password\_u == @password\_ua  
redirect\_to :action =\> ‘suc’  
end  
if @login\_u != @login\_ua && @password\_u != @password\_ua  
redirect\_to :action =\> ‘fail’  
end  
end

Could someone help me out.

And my form looks like

\<%= form\_tag :action =\> ‘do\_login’ %\>  
Username: \<%= text\_field ‘login’, ‘username’ %\>  
  
Password: \<%= password\_field ‘login’, ‘password’ %\>  
\<% end\_form\_tag %\>

I know its simple, but just want to try out a few things.

---

<div class="post-metadata">

**Author:** ![dotty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@dotty](https://www.ruby-forum.com/u/dotty)\
**Post date:** [September 13, 2007, 3:57pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505/2 "2007-09-13T15:57:01Z")

</div>

What do you need help with?

---

<div class="post-metadata">

**Author:** ![dotty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@dotty](https://www.ruby-forum.com/u/dotty)\
**Post date:** [September 13, 2007, 3:58pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505/3 "2007-09-13T15:58:58Z")

</div>

Ryan A. wrote:

> What do you need help with?

I got it working now.

I forgot that when data is sent from a form, it’s sent as a hash.

Thanks for the reply.

---

<div class="post-metadata">

**Author:** ![dotty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@dotty](https://www.ruby-forum.com/u/dotty)\
**Post date:** [September 13, 2007, 9:38pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505/4 "2007-09-13T21:38:02Z")

</div>

Kevin R. wrote:

> Ryan A. wrote:
> 
> > What do you need help with?
> 
> I got it working now.
> 
> I forgot that when data is sent from a form, it’s sent as a hash.
> 
> Thanks for the reply.

FYI you actually never said what the problem was.

Glad you fixed whatever it was. 😉

---

<div class="post-metadata">

**Author:** ![dotty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@dotty](https://www.ruby-forum.com/u/dotty)\
**Post date:** [September 13, 2007, 10:03pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505/5 "2007-09-13T22:03:57Z")

</div>

Jean N. wrote:

> Kevin R. wrote:
> 
> > Ryan A. wrote:
> > 
> > > What do you need help with?
> > 
> > I got it working now.
> > 
> > I forgot that when data is sent from a form, it’s sent as a hash.
> > 
> > Thanks for the reply.
> 
> FYI you actually never said what the problem was.
> 
> Glad you fixed whatever it was. 😉

If you pass valid user name and invalid password , you would hit a  
missing template error probably. If you are only looking to learn its  
fine, othewise there are bunch authentication plugins. Have a look at  
them.

---

<div class="post-metadata">

**Author:** ![dotty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@dotty](https://www.ruby-forum.com/u/dotty)\
**Post date:** [September 17, 2007, 1:21pm UTC](https://www.ruby-forum.com/t/simple-login-action-help/114505/6 "2007-09-17T13:21:47Z")

</div>

Good to hear

Cheers,  
Ryan
