Hiya - before I start let me tell you i''m a Nuby on Rails. I''ve created a user registration within my application that requires email validation and that seems to be working fine. I''m now creating the user login page and have the following code in my UsersController: def login @user = User.new @user.username = params[:username] end def process_login if user = User.authenticate(params[:user]) session[:id] = user.id # Remember the user''s id during this session redirect_to session[:return_to] || ''/'' else flash[:error] = ''Invalid login.'' redirect_to :action => ''login'', :username => params[:user][:username] end end def logout reset_session flash[:message] = ''You are now logged out.'' redirect_to :action => ''login'' end I''ve attempted to login using a validated account that I set up but can''t seem to get passed the process_login. It doesn''t seem to attempt to ''authenticate''. I''m just seeing process_login.rhtml. Is there something missing in my code? Cheers Craig -- 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 -~----------~----~----~----~------~----~------~--~---
I would suggest taking a look at some authentication plugins, even if you don''t actually end up using one of them. I personally like the restful_authentication plugin: http://agilewebdevelopment.com/plugins/restful_authentication On May 23, 11:24 am, Craig Rackham <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hiya - before I start let me tell you i''m a Nuby on Rails. > > I''ve created a user registration within my application that requires > email validation and that seems to be working fine. > > I''m now creating the user login page and have the following code in my > UsersController: > > def login > @user = User.new > @user.username = params[:username] > end > > def process_login > if user = User.authenticate(params[:user]) > session[:id] = user.id # Remember the user''s id during this > session > redirect_to session[:return_to] || ''/'' > else > flash[:error] = ''Invalid login.'' > redirect_to :action => ''login'', :username => > params[:user][:username] > end > end > > def logout > reset_session > flash[:message] = ''You are now logged out.'' > redirect_to :action => ''login'' > end > > I''ve attempted to login using a validated account that I set up but > can''t seem to get passed the process_login. > > It doesn''t seem to attempt to ''authenticate''. I''m just seeing > process_login.rhtml. Is there something missing in my code? > > Cheers > Craig > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Robert Walker wrote:> I would suggest taking a look at some authentication plugins, even if > you don''t actually end up using one of them. > > I personally like the restful_authentication plugin: > > http://agilewebdevelopment.com/plugins/restful_authentication > > On May 23, 11:24 am, Craig Rackham <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>I had a look at that but I get the error: Couldn''t find ''authenticated'' generator -- 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 -~----------~----~----~----~------~----~------~--~---
Did you first install the plugin into your rails application using: ./script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication On May 23, 11:45 am, Craig Rackham <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Robert Walker wrote: > > I would suggest taking a look at some authentication plugins, even if > > you don''t actually end up using one of them. > > > I personally like the restful_authentication plugin: > > >http://agilewebdevelopment.com/plugins/restful_authentication > > > On May 23, 11:24 am, Craig Rackham <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > I had a look at that but I get the error: > > Couldn''t find ''authenticated'' generator > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---