Forum: Ruby on Rails User Login (process_login)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Craig R. (Guest)
on 2007-05-23 19:24
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
Robert W. (Guest)
on 2007-05-23 19:30
(Received via mailing list)
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_aut...

On May 23, 11:24 am, Craig R. <removed_email_address@domain.invalid>
Craig R. (Guest)
on 2007-05-23 19:45
Robert W. 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_aut...
>
> On May 23, 11:24 am, Craig R. <removed_email_address@domain.invalid>


I had a look at that but I get the error:

Couldn't find 'authenticated' generator
Robert W. (Guest)
on 2007-05-24 00:58
(Received via mailing list)
Did you first install the plugin into your rails application using:

./script/plugin install
http://svn.techno-weenie.net/projects/plugins/rest...

On May 23, 11:45 am, Craig R. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.