Displaying 15 results from an estimated 15 matches for "try_to_login".
2010 Jul 31
4
Exception: can't dup Symbol
Hey everybody,
I''m trying to test a little piece of code I wrote, and I get the
following error:
Exception: can''t dup Symbol
It happens in the following line: try_to_login @valid_user, :remember_me
=> "1",
where the function try_to_login is:
def try_to_login(user, options = {})
user_hash = {:screen_name => user.screen_name, :password =>
user.password}
user_hash.merge!(options)
post :login, :user => :user_hash
assert logged_in?
e...
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
...il
end
def self.hash_password(password)
Digest::SHA1.hexdigest(password)
end
def self.login(username, password, account_id)
hashed_password = hash_password(password || "")
find_by_username_and_hashed_password_and_account_id(username,hashed_password,account_id)
end
def try_to_login(account_id)
User.login(self.username, self.password, account_id)
end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060605/f37cba6f/attachment-0001.html
2006 May 03
1
Test not Reseting
...mes around, even though that is in my
users.yml
class UserTest < Test::Unit::TestCase
fixtures :users
def setup
@chris_logged_in = User.new({:username => ''cwinslett'', :password
=> ''testpassword''})
@chris_logged_in = @chris_logged_in.try_to_login
@sherri = User.find(2)
@delete_victim = User.find(4)
end
# Replace this with your real tests.
def test_truth
assert_kind_of User, @chris_logged_in
assert_kind_of User, @sherri
assert_kind_of User, @investor
end
def test_destroy
@delete_victim.de...
2006 Jun 16
2
Problem with User Login from Agile Web Development
...rd || "")
find(:first,
:conditions => ["user_name = ? and hashed_password = ?",
user_name, hashed_password])
end
# Log in if the name and password (after hashing) match the database,
# or if the name matches an entry in the database with no password
def try_to_login
User.login(self.user_name, self.password)
end
--
Posted via http://www.ruby-forum.com/.
2006 Apr 03
7
Getters and setters problem?
Hi list,
first evening of playing with rails, so please forgive me if I ask
something stupid. ;-)
I created a User model and tried to use ActiveRecord callbacks to
convert the password to sha1 just before saving it. For some reason
postgresql gives me a error because the given password is null. To
test even further I tried to change :login too, same error happens,
:login is empty too.
I am sure
2006 Apr 28
7
a simple problem but difficult
how can i access to a collection that was created in the same control
and the data that a want to access isn?t the id
the collection has : id, usuario, comandancia
comandancia is the data to access
the question is how to access comandancia in @acceso
this code is wrong :
def new
@catelemento = Catelemento.new
@acceso= Catacceso.find(:all,
:conditions
2006 Jan 13
0
Layout not rendered when render_component used
...My user model is more-or-less the same as in the Agile RoR book.
app/controllers/auth_controller.rb:
class AuthController < ApplicationController
layout false
def login
if request.get?
@user = User.new
else
@user = User.new(@params[:user])
logged_in_user = @user.try_to_login
if logged_in_user
# handle setting cookies, setting session
# and redirecting to index
else
flash[:loginerror] = ''Invalid username/password combination''
end
end
end
end
app/views/login.rhtml
<div id="loginbox">
<...
2006 Jan 29
1
RJS template problem!
hi all,
i have the following controller:
class UserController < ApplicationController
.
.
.
def login
@user = User.new(params[:user])
@logged_in_user = @user.try_to_login
if @logged_in_user
session[:user_id] = @logged_in_user.id
else
flash[:notice] = "ungültige Daten!"
end
end
.
.
.
end
with this rjs template:
login.rjs:
if @logged_in_user
page.replace_html ''content'', ''welcome!''
page.replace_htm...
2005 Jul 13
0
Testing failing
...#=================================
def self.login(name, password)
hashed_password = hash_password(password || "")
find(:first,
:conditions => ["username = ? and
hashed_password = ?", username, hashed_password])
end
def try_to_login
Profile.login(self.username, self.password)
end
protected
def hash_password( inPassword )
Digest::SHA1.hexdigest(inPassword)
end
end
Ron Davis
I''ve got images in my head and I want to get them into my camera and
portfolio.
http://photo.reactuate.c...
2010 Jul 25
0
Testing problems: ActiveSupport
...ot sure about the
ActiveSupport errors):
Exception: undefined method `screen_name'' for nil:NilClass
C:/Ruby191/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:in
`method_missing''
D:/Projects/RailsSpace/test/functional/user_controller_test.rb:39:in
`try_to_login''
D:/Projects/RailsSpace/test/functional/user_controller_test.rb:28:in
`testing_logout''
C:/Ruby191/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/testing/setup_and_teardown.rb:62:in
`run''
C:/Ruby191/lib/ruby/gems/1.9.1/gems/test-unit-2.1.0/lib/test/unit/te...
1997 Sep 28
0
[IPD] Internet Probe Droid
...the ports on the other end
# or hose the connection too bad.
@keys = sort keys %hash;
$index = int($#keys / $max); # for stepping through the array @keys
for (''0'' .. $index) {
@buffer = splice(@keys, 0, $max);
# print "buffer: @buffer \nlength: $#keys\n";
&try_to_login(@buffer);
}
print "\nDone. Exiting...\n";
###
### Subroutines
###
# Attempt to login with each account
sub try_to_login {
my $account = shift;
return unless $account;
$level++;
my $pipe = "PIPE$level";
open $pipe, "login.exp $host $account @{$hash...
2006 Apr 21
2
destory Test Case Messes up all tests
...with => /^(.+)@(.+)\.[A-z]{2,6}$/
validates_uniqueness_of :email
def self.login(email, password)
hashed_password = hashed_password(password || "")
find(:first,
:conditions => ["email = ? and hashed_password = ?", email,
hashed_password])
end
def try_to_login
User.login(self.email, self.password)
end
def before_create
self.hashed_password = User.hashed_password(self.password)
end
def after_create
@password = nil
end
private
def self.hashed_password(password)
Digest::SHA1.hexdigest(password)
end
end
Am I doing somethin...
2006 Feb 15
8
Agile book - getting confusing error
Working through the beginning phase from the Agile book on
''Administration''
undefined method `hashed_password='' for #<User:0xb7911324>
...
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1498:in `method_missing''
#{RAILS_ROOT}/app/models/user.rb:12:in `before_create''
2005 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
...# save the new hash if the password is set
# XXX - only set password_hash during methods that can change
password
self.password_hash = MiscUtils.hexdigest(@password) unless
@password.nil?
end
def after_save
@password = nil
@password_confirmation = nil
end
def try_to_login
self.class.lookup(self.email_address, @password)
end
# Class methods
def self.lookup(email_address, password, additional_conds = '''')
hashed_password = MiscUtils.hexdigest(password)
begin
find( :first,
:conditions => ["email_add...
2006 Jun 13
13
Pass infomation between different views and controllers
Hi, I am a rails and ruby nuby :-)
How do you pass data between different controllers and views? I have a
page ( a quote) that I am editing url ....quote/edit/6 6 id the
current id. I then go to a catalog (url....catalog) to add an item to
my quote (I do this via a line_item file that the quote reads) I now
want to go back to the quote. I have tried this
<%= link_to ''Back to