Displaying 20 results from an estimated 137 matches for "password_confirmation".
2007 Dec 04
10
Unexpected message on :attr_accessor
This may be a dumb noob issue, but I haven''t found any answers while seaching
the forum--
I have a controller method
def edit
@user = User.find params[:id]
@user.password_confirmation = @user.password
end
The User class has an "attr_accessor :password_confirmation" definition (so
"password_confirmation" doesn''t exist in the users table). My spec has the
following
it "should find User on GET to users/edit/:id" do
User.should_receiv...
2005 Oct 14
7
validates_confirmation_of not working
Hello, I''m having a weird problem in my user model. For the
change_password method I have the following:
def change_password(oldpass, newpass, confirmation)
oldpass = self.class.myhash(oldpass)
reload
passhash = self.password
self.password = newpass
self.password_confirmation = confirmation
if valid? and oldpass == passhash
save!
else
# valid? method clears errors so we have to call this after it
errors.add_to_base ''Invalid current password'' unless oldpass == passhash
false
end
end
I also have validates_confirmat...
2006 Mar 29
5
How to skip password validation when updating other fields?
Besides the hashed password, which is saved to db, I have two
password-attributes in my User model:
attr_accessor :password, :password_confirmation
I have validations on these attributes, and I need them to work both on
create and update, since I have pages for changing and resetting the
password.
Now when I want to update just the user''s login name, I guess I have the
next options:
1)
user = User.find(session[:user_id])
user.lo...
2006 Jun 16
0
rake spec controller test output hideus.
...is no small
matter when the object is a HTTP request response.
Here is the example of the spec.
specify "should not allow new users without the correct fields" do
post :signup, :user => { :login => "newbob", :password => "newpassword",
:password_confirmation => "wrong" , :email => "newbob@mcbob.com"}
response.should.be.success
response.session[:user].should.be.nil
User.find_by_login("newbob").should.be.nil
end
And here is the actual error it gives me to "help". I think this
amount should rath...
2010 Aug 18
2
auth logic - password confirmation
...;%= f.text_field :username %>
</p>
<p>
<%= f.label :email %><br />
<%= f.text_field :email %>
</p>
<p>
<%= f.label :password %><br />
<%= f.password_field :password %>
</p>
<p>
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %>
</p>
<p><%= f.submit %></p>
<% end %>
I am following this railscast here
http://media.railscasts.com/videos/160_authlogic.mov
Half way he changes password_field and also ads password_confir...
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 password_confirmation), using t...
2007 Oct 23
11
validates_confirmation_of not working?
...-----------------------------------------
require ''digest/sha1''
class User < ActiveRecord::Base
belongs_to :profile
belongs_to :company
validates_presence_of :username, :email, :address1, :city, :state,
:zip
validates_uniqueness_of :username, :email
attr_accessor :password_confirmation
validates_confirmation_of :password
validates_format_of :email, :with => /^[_a-z0
-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0 -9-]+)*(\.[a-z]{2,4})$/i
def validate
errors.add_to_base("Missing Password") if hashed_password.blank?
end
def self.authenticate(username, passwor...
2008 Dec 10
1
Oddness with fieldnames containing an underscore
...e come across an oddity when trying to write a
scenario to create a user.
Scenario: Register new user
Given I am on the new user page
And I fill in "login" with "fredf"
And I fill in "password" with "somepassword"
And I fill in "password_confirmation" with "somepassword"
And I select "Mr" from "title"
And I fill in "given_names" with "Fred"
And I fill in "surname" with "Flintstone"
And I fill in "email" with "fredf at rocks.com"...
2010 Jul 18
0
password_confirmation
In Railscasts episode regarding "Authlogic"
http://railscasts.com/episodes/160-authlogic, at 5:39, it adds a
password confirmation field, and calls it :password_confirmation
Is :password_confirmation part of the Authlogic or can be used
originally with Rails?
Thanks.
--
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 rubyo...
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
...ize_user
@booboo = FactoryGirl.create(:subdomain, name: "booboo")
@coocoo = FactoryGirl.create(:subdomain, name: "coocoo")
FactoryGirl.create(:user, subdomain_id: @booboo[:id], email:
"user.doe-PV5Ro7/Mrj4@public.gmane.org", password: "UkZaHWcy", password_confirmation:
"UkZaHWcy")
end
def teardown
User.delete_all
Subdomain.delete_all
end
test "should_save_user_with_duplicated_email_in_another_scoped_subdomain"
do
user = FactoryGirl.build(:user, subdomain_id: @coocoo[:id], email:
"user.doe-PV5Ro7/Mrj4@public.gmane....
2006 Jul 27
2
Creating multiple objects from form data
...#39;t be
blank, Last name can''t be blank, Email address can''t be blank"
However, values for user are present in the request parameters:
*Parameters*: {"company"=>{"name"=>"poop", "account_id"=>29},
"user"=>{"password_confirmation"=>"poop", "username"=>"poop",
"company_id"=>29, "time_zone"=>"International Date Line West",
"first_name"=>"poop", "password"=>"poop", "last_name"=>"poop"...
2006 Nov 06
4
Confirmation fields on forms
I am unsure how to use a confirmation only field in my forms. The
perfect example is when registering a user, you want them to type their
password twice but you only want to have one record for it.
The form fields;
user[password]
user[password_confirmation]
form posted;
user = User.new @params[:user]
Error is thrown because there is no method for password_confirmation.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ru...
2012 May 24
0
Ruby on Rails Tutorial Chapter 6 RSpec tests failing
...[0m [31mrspec ./spec/models/
user_spec.rb:101[0m [36m# User return value of authenticate method
with invalid password [0m Slave(1) run done!
---------------------------------------------------
Here is the user Model:
class User < ActiveRecord::Base
attr_accessible :name, :email, :password, :password_confirmation
attr_accessor :password, :password_confirmation
has_secure_password
before_save { |user| user.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with:
VA...
2006 Jan 20
0
Problem with updating model
I trying to update DATE type field in MySQL but such errors occurs
errors:
password_confirmation:
- "can''t be blank"
birthday:
- "can''t be blank"
Spending hours on that, I cann''t find the reason
But I''ve filled "login" "password" "password_confirmation" and
"birthday" fields right....
2006 Oct 26
0
Recipes authentication & validates_presence_of
I''ve implemented Rails Recipe #31, Authentication, and I found that
validating password and password_confirmation just doesn’t work while
the method ‘password=(pass)’ is in the mix, but I need that for the
salt/hashing, no?
If I don’t use validations, the password gets hashed, salted and stored
in the database fine. I can login with same username/password.
However, if I want to validate user input (who wo...
2008 Jun 20
15
before_save model callback rspec testing
hi all,
i''m learning rspec and i can''t figure out how to test if a callback is
executed in a model.
my model code is:
class User < ActiveRecord::Base
before_save :encrypt_password
...
def encrypt(password)
self.class.encrypt(password, salt)
end
thanks a lot,
cs.
--
Posted via http://www.ruby-forum.com/.
2008 Feb 14
4
How do I access this parameter?
...;
<%= text_field ''user'', ''login'' %></p>
<p><label for="user_password">Password</label><br/>
<%= password_field ''user'', ''password'' %></p>
<p><label for="password_confirmation">Confirm Password</label><br/>
<%= password_field ''user'', ''password_confirmation'' %></p>
<% end -%>
My question is, on the controller end, how do I access the parameter
for login and password? I thought it would be params[...
2008 Jun 29
3
Working around/with Restful Authentication
...te action:
before_save :encrypt_password
before_create :make_activation_code
But for some reason when I try to create a user programmatically in
the controller like this:
User.new(:email => ''user-n8tE+Mx9DRM@public.gmane.org'', :password =>
''123456'', :password_confirmation => ''123456'')
Nothing happens. I get a user that I can''t save:
> u = User.new(:email => ''user-n8tE+Mx9DRM@public.gmane.org'', :password => ''123456'', :password_confirmation => ''123456'')
=> #<User id...
2006 Feb 27
4
update_attribute with Validation?
...ndividual attributes with
validation? update_attribute disables the validation checks in the
record model, so I''m wondering if there''s a workaround for this.
In my application, I want to allow the user to update some or all the
attributes without having to enter :password and :password_confirmation,
both of which are subject to validation.
Boram
--
Posted via http://www.ruby-forum.com/.
2006 Jan 20
8
validates_confirmation_of not working
is there any special requirement for validates_confirmation_of ? I am
trying to make sure 2 passwords are equal (cleanly the rails way)..
In my view i have two fields with id user[password] and
user[password_confirmation].
in the model i have
validates_confirmation_of :password, :message =>"Passwords do not match "
Am i missing something here ?
thanks
adam