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'' %><br>
Password: <%= password_field ''login'',
''password'' %>
<% end_form_tag %>
I know its simple, but just want to try out a few things.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
What do you need help with? On 9/13/07, Kevin Ruscoe <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > > 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'' %><br> > Password: <%= password_field ''login'', ''password'' %> > <% end_form_tag %> > > I know its simple, but just want to try out a few things. > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Angilly 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Good to hear Cheers, Ryan On 9/13/07, Kevin Ruscoe <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Ryan Angilly 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. > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Kevin Ruscoe wrote:> Ryan Angilly 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. ;) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jean Nibee wrote:> Kevin Ruscoe wrote: >> Ryan Angilly 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---