search for: password_salt

Displaying 20 results from an estimated 28 matches for "password_salt".

2009 Nov 14
3
authlogic fails on existing accounts when crypted_password is blank
I recently ran a migration to add the following to an existing user model: t.string "crypted_password" t.string "password_salt" t.string "persistence_token" There is an existing (cleartext) password field, but authlogic doesn''t seem to be reading that on existing accounts. As a result, all logins for existing accounts fail. How can I get authlogic to either use the cleartext passwords, or to...
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
...led, here are my code: #model----------------------------------------------------- require ''digest/sha2'' class User < ActiveRecord::Base validates_uniqueness_of :username 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 def self.authenticate(username, password) user = User.find(:first, :conditions => [''username = ?'', username]) if user.blank? || Digest::SHA256.hexdigest(password +...
2012 Mar 22
1
Rspec not loading fixtures
...irectories: spec/fixtures/partners.yml - which contains 2 yaml records: sponsor: id: 1 username: rtv email: rocky at example.com crypted_password: "c8e5b51b237344fe0e72539af0cac7197f094a5e933ffacf6e7fa612363c5933f520710c6427ac31fc4c68a2d7bb48eae601c74b96e7838f9ca1a0740b67576a" password_salt: "Y4PPzYx2ert3vC0OhEMo" name: Rocky organization: Rock The Vote url: http://rockthevote.com address: 123 Wherever city: Washington state_id: 9 zip_code: 20001 phone: 555-555-1234 survey_question_1_en: "What school did you go to?" survey_question_2_en: "W...
2006 Aug 07
2
Bind variables error
...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 raise "Username or password invalid" end user end end should it be user = User.find(:first, :second, :conditions ................ Or would it be something else ? Stuart
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 Aug 07
3
wrong number of bind variables
...ng 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 + user.password_salt) != user.password_hash raise "Username or password invalid" end user end end I''m basically copying this out of Rails Recipes so not sure where the error is. Stuart
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username and password, my setup is firstname, lastname, password. I seemed to be gramatically challenged and not sure how to set up the parameter list. Can anyone offer up a suggestion. The book shows the method starting like: if request.post? user = User.find(:first, :conditions => [''username = ?'' ,
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 on the password that is entered when a user signs up? first, i want to make sure that the user entered one in the fir...
2006 Jun 04
1
Problem with instance variables
...nsole: >> july = User.new(:user_name => "july", :password => "secret", :password_confir mation => "secret") => #<User:0x358e3e0 @password_confirmation="secret", @attributes={"ip2"=>nil, "a ctive_user"=>0, "password_salt"=>"W9C7g8i+", "validateip"=>true, "ip2_updated"=> nil, "password_hash"=>"75412fccdfc4dc313215913bf2789b67f6a23315", "user_name"=>" july", "ip1_updated"=>nil, "ip1"=>nil, "email...
2006 Apr 02
1
Fixtures For Logging In
...ing to write some integration tests for my app and am having some troubles getting past the initial login. Here is what my fixture looks like users.yml user_001: id: "7" login: testuser001, email: testuser001@example.com, state: 2, password: b78d41e7ccb8da412f4f66f754121667, password_salt: 78cKRniDIo, password_hash_type: md5 I took the password and the salt out of the database from another test entry that I made so I''m assuming that it should work in this example too. Unfortunately it doesn''t. Instead of logging in correctly, I get rejected. Any ideas why this...
2012 Jun 11
0
Using AuthLogic
Hello, I''m trying to use the authlogic to make my login in my app. The problem is when I change my user model. user model: class User < ActiveRecord::Base attr_accessible :crypted_password, :email, :password_salt, :persistence_token, :username acts_as_authentic end create_users migration class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :username t.string :email t.string :crypted_password t.string :password_salt t.string :pe...
2006 Aug 07
1
Help please: database column not taking
...%></label> In the user model, following along with Rails Recipes I recreated the method of salt and hash (this is working fine) I''ll put it here anyway in case it means something: 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 don''t see anything that sticks out yet it leaves the field blank after creating a new row. ?? TIA Stuart
2006 Apr 21
4
Problem with the Authorization recipe
...roblem comes when i try to assign a password to a user in the console, here is the output: >> justin = User.create(:username => "justin") => #<User:0x3c9cd38 @errors=#<ActiveRecord::Errors:0x3c9b730 @errors={}, @base=#<User:0x3c9cd38 ...>>, @attributes={"password_salt"=>nil, "username"=>"justin", "id"=>4, "password_hash"=>nil}, @new_record=false> >> justin.password = "secret" NameError: uninitialized constant Digest::SHA2 from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/acti...
2006 Aug 02
3
Need help with registration page
...ast none of my own) 2- a member controller (again no methods there) 3- a member model which contains the password stuff, hash and salt , so here is that code: class Member < ActiveRecord::Base 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 end 4- In the view in "main" I put in: %= render :partial => "member/register" %></td> 5- so obviously I created the _register.rhtml partial. The nice thing is domainname/main pulls up t...
2006 Aug 04
1
Need a better undersanding of form helpers
...anding 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 assuming these would be hidden) password_hash ( " ) controller main / welcome def welcome end For now all welcome does is pull up the main/welcome.rhtml page In welcome.rhtml all I have is one line: <%= render :partial => &q...
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
2006 Apr 14
7
SHA2 Issues
...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 a console and can create a user but when I try to add a password it says that the constant 256 is not initialized. I have changed the Digest::SHA256 to Digest::SHA2 to no avail. I am using (on Windows - development...
2011 Jun 11
1
Having a problem adding a foreign key
...create_table "users", :force => true do |t| t.string "email", :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "password_salt", :default => "", :null => false t.string "reset_password_token" t.string "remember_token" t.datetime "remember_created_at" t.integer "sign_in_count", :default => 0 t.datetime...
2006 May 29
9
design recommendations for authenticating users with lots of different attributes..?
...and it''s working well, the only problem I''m having is the following: I have a Users table which contains pretty much the minimum amount of information required to allow users to login: def self.up create_table :users do |t| t.column :username, :string t.column :password_salt, :string t.column :password_hash, :string t.column :created_at, :datetime t.column :updated_at, :datetime t.column :last_login_date, :datetime end The problem is that some users (such as sales reps), need many more attributes than are provided by the User table, such as...