dotty
September 13, 2007, 2:44pm
1
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.
dotty
September 13, 2007, 3:57pm
2
What do you need help with?
dotty
September 13, 2007, 3:58pm
3
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.
dotty
September 13, 2007, 9:38pm
4
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.
dotty
September 13, 2007, 10:03pm
5
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.