Simple login action help

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.

What do you need help with?

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.

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. :wink:

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. :wink:

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.

Good to hear

Cheers,
Ryan