Displaying 20 results from an estimated 4000 matches similar to: "Login form question"
2006 Aug 07
2
Bind variables error
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ?
I''m not sure why I"m getting this error ?
def self.authenticate(first_name, last_name, password)
user = User.find(:first, :conditions => [''first_name = ? AND
last_name = ?''])
if user.blank?
Digest::SHA256.hexdigest(password + user.password_salt) !=
user.password_hash
2006 Aug 07
3
wrong number of bind variables
I''m getting this error message since i moved alot of the database
logic to the model.
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ?
def self.authenticate(first_name, last_name, password)
user = User.find(:first, :conditions => [''first_name = ? AND
last_name = ?''])
if user.blank?
Digest::SHA256.hexdigest(password +
2006 Jul 27
2
Creating multiple objects from form data
I''m in the process of creating a sign up form for an online application.
The form collects account info, company info, and then info for an
administrative user.
The method looks like this:
def create
@account = Account.create!(params[:account])
@company = @account.companies.create!(params[:company])
@user = @company.users.create!(params[:user])
end
However, this inevitably fails
2006 Jul 07
13
Rails Recipes Book: Authentication
Hi,
The user/login management system in Chapter 31: Authenticating Your
Users and Chapter 32: Authorizing Users with Roles of Chad Fowler''s
Rails Recipes looks reasonable and adequate. However, when I ran the
Chapter 31 code, I get the following error:
Username or password invalid
And I am not even given the chance to sign in; that is, the signin form
does not appear at all.
Has
2006 Aug 04
1
Need a better undersanding of form helpers
perhaps someone can take a little time to give me a better
understanding of how to use form helpers.
Here is what I''m working with in my app:
user model - (the table where a user registers their information)
it contains the following fields -
first_name
last_name
email
account_type (currently set to string but will probably be a select
box with options)
password_salt (I''m
2006 Jun 09
18
Is IRB the ruby console ?
I''m running script/console but keep getting the message that irb.bat is not
recognized as an internal or external command, operable program or batch
file.
If it means anything I am running instant rails. I can invoke irb straight
forward.
TIA
Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Apr 21
1
Catch authentication result from a model in a controller
Im still following the authorization recipe from the book, now all works
fine but im getting trouble in how handle the model authorization
result, if the user and pass are correct, it goes to a welcome
screen(admin.rhtml) but if wrong the model prints a message in an ugly
exception like page "usr and pass not correct", i want to redirect the
user to the login
2006 Aug 07
1
Help please: database column not taking
I created a simple registration form. One column doesn''t seem to be
taking the input. I''ve yet to put in any validation or error
checking.
The column in the database is called ''level'' and is type ''int''
The controller method is fairly simple:
def register
c = User.new(params[:user])
c.save
redirect_to :controller =>
2006 Aug 02
3
Need help with registration page
I have most of my books open as I''m trying to create this app. Still
not sure how to make this work - hopefully some help / hints can get
me further.
First I used the "authorizing users" recipe from Rails Recipes. Though
I did add some more generic type of registration fields (email,
address, etc).
I want the registration form on the main page(index) of the site.
What I have
2006 Aug 07
2
Ugggh..another recipes question
sorry, because it seems that I need more explanation on this Rails
Recipes authorization -
I finally got the code working but after using the login I get this
back from Rails-
Routing Error
No url can be generated for the hash {}
I''m guessing it''s coming from the redirect-
def login
if request.post?
session[:user] = User.authenticate(params[:first_name],
2006 May 29
9
design recommendations for authenticating users with lots of different attributes..?
I''ve been struggling a bit trying to figure out the best way to
design/implement a system with authentication/authorization, and was
hoping some of you may be able to offer some advice..
At the moment, I have a system with 4 different types of users -
clients, administrators, sales_reps, and public_users. I''m using
"Authorizing Users with Roles" from the Rails Recipes
2006 Aug 03
5
Rails - forms
Currently I have a registration form that is built like this:
<label for="First name">First name</label>
<%= text_field "user", "first_name" %><br>
<label for="Last name">Last name</label>
<%= text_field "user", "last_name" %><br>
<label for="Email">Email</label>
2006 Aug 07
8
Rails Recipes question - authenticating users
Didn''t think I''d be back so quick with another question but here goes:
In this recipe for the signin or login (as I call it) there are these
two lines if the user authenticates correctly:
session[:user] = user.id
redirect_to :action => session[:intended_action],
:controller => session[:intended_controller]
So I''m not seeing anything in the way of an explanation
2006 Aug 12
7
Redirect back to last page?
I have a few pages where a user may do something (add tags, login, etc)
and I would like to redirect them back to the last page they were at
before calling that action. Is there an easy way to do this?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 14
7
SHA2 Issues
Hello all,
Thank you in advance for your help with this. I am trying to implement
the user authentication method from Ruby Recipes which calls for the use
of SHA 2. Here is the code for the password:
def password=(pass)
salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp
self.password_salt, self.password_hash = salt,
Digest::SHA256.hexdigest(pass + salt)
end
I open
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
2006 Aug 13
3
Render nothing; go nowhere
I am building an application that requires a C++ program to access the
Rails web application using POST. Now, I just added user authentication
to the mix and it has made things more interesting.
I''m using basic authentication as shown in the AWDWR and Rails Recipes
books. I can now get my C++ program to submit the user credentials to
the login/login page. All I want the login page
2006 Jun 19
6
SQL Search Qustion
I am working on writing a search method where a user can type a string
of words and I return all the objects that have fields that match all of
the words in one or a combination of fields.
Person
first_name
last_name
Pet
name
Person has_many :pets
I want to write some SQL so that if I search for "Tony AAAA" I will get
all the people who have Tony and AAA either in their
2006 Aug 16
5
validation on methods that aren''t part of the database.
using the Rails Recipes book, i went through the tutorial on setting up
authentication on a site. the tutorial was great, but it raises a few
questions.
the fields in the database are password_hash, and password_salt. the
tutorial creates another method for password that takes the value it was
given and hashes it and adds the 6 character salt at the end.
what if i want to perform validation
2006 Jul 17
19
updating model
hello,
i am writing a simple user login system.
when registering a user account, i have two field:
password
password_confirmation
which are validated using
validates_presence_of
validates_confirmation_of
and these are then used to generate a password hash which is stored in
my database
when i want to update the record (without changing the password and
entering new values for password and