Displaying 4 results from an estimated 4 matches for "attempt_login".
2006 Apr 22
2
Question about functional tests and log/test.log
Here''s something a bit weird:
After running functional tests, my test log contains many lines,
including many like these:
> Processing UserController#attempt_login (for 0.0.0.0 at 2006-04-22
> 02:38:08) [POST]
> Session ID:
> Parameters: {"user"=>{"password"=>"bogus",
> "email"=>"tmornini@bogus.com"}, "action"=>"attempt_login",
> "controller"=&...
2006 Mar 02
8
User Authentication
...gin when
there is no valid session user_id.
Code so far:
--------------------------------------------
# controller
class PublishController < ApplicationController
before_filter :authenticate, :except => [:login, :login_user]
def login
if request.post?
logged_in_user = @user.attempt_login
if logged_in_user
session[:user_id] = logged_in_user.id
redirect_to(:action => ''index'')
else
flash[:notice] = ''Invalid username or password. Please try again''
end
end
end
def self.authenticate...
2006 Mar 04
4
Two quick newbie questions
2 quick questions regarding authentication ...
1) the flash[:notice] on successful login looks completely wrong to me.
How should it be done?
def index
if request.post?
@user = User.new(params[:user])
authentic_user = @user.attempt_login
if authentic_user
session[:user_id] = authentic_user.id
flash[:notice] =
''Login successful! Welcome '' + authentic_user.first_name + '' '' +
authentic_user.last_name + ''!''
redirect_to(:controller =>...
2008 Mar 01
0
Fixtures in ActionController::TestCase
Hi guys,
Need some help.
I am using Rails 2.0 and while writing functional test, I encountered
the following problem
class UserControllerTest < ActionController::TestCase
fixtures :users
...
def do_something
attempt_login(users(:valid_user)) # assuming valid_user is a
proper line in
...
end
def attempt_login(user)
post :login, :user => { :login => user.login, :password =>
user.password }
end
Running the test:
...
1) Error:
do_something(UserControllerTest):
NoMethodError: You have a nil object wh...