Permalink
Browse files

bad updates

  • Loading branch information...
treamous committed Apr 12, 2011
1 parent 5aabf1b commit 23112d8614529ec02354fc3829394aab6e87bde5
@@ -8,8 +8,8 @@ class Newuser < ActiveRecord::Base
validates :first_name, :presence => true, :length => { :maximum => 25 }
validates :last_name, :presence => true, :length => { :maximum => 50 }
- validates :username, :length => { :within => 8..25 }, :uniqueness => true
- validates :signature, :length => { :within => 8..25 }, :uniqueness => true
+ validates :username, :presence => true, :length => { :within => 5..25 }, :uniqueness => true
+ validates :signature, :presence => true, :length => { :within => 8..25 }
validates :state, :presence => true
validates :age, :presence => true
validates :interest, :presence => true
@@ -9,8 +9,8 @@ class User < ActiveRecord::Base
validates :first_name, :presence => true, :length => { :maximum => 25 }
validates :last_name, :presence => true, :length => { :maximum => 50 }
- validates :username, :presence => true, :length => { :within => 8..25 }, :uniqueness => true
- validates :signature, :length => { :within => 8..25 }, :uniqueness => true
+ validates :username, :presence => true, :length => { :within => 5..25 }, :uniqueness => true
+ validates :signature, :presence => true, :length => { :within => 8..25 }
validates :state, :presence => true
validates :age, :presence => true
validates :interest, :presence => true
@@ -53,6 +53,11 @@ def self.hash_with_salt(password="", salt="")
Digest::SHA1.hexdigest("Put #{salt} on the #{password}")
end
+ # Get default signature value
+ def self.def_sig()
+ "username#{Time.now}"
+ end
+
private
def create_hashed_password
@@ -1,9 +1,9 @@
class ChangeSignUser < ActiveRecord::Migration
def self.up
- change_column("users", "signature", :string, :default => :username)
+ #change_column("users", "signature", :string, :default => :username)
end
def self.down
- change_column_default("users", "signature", nil)
+ #change_column_default("users", "signature", nil)
end
end
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110411072242) do
+ActiveRecord::Schema.define(:version => 20110412062849) do
create_table "petitions", :force => true do |t|
t.string "title", :limit => 100, :null => false
@@ -37,7 +37,7 @@
t.string "username"
t.string "first_name", :limit => 40, :default => ""
t.string "last_name", :limit => 40, :default => ""
- t.string "signature", :default => "username"
+ t.string "signature"
end
add_index "users", ["signature"], :name => "index_users_on_signature"
@@ -7,4 +7,4 @@
# Mayor.create(:name => 'Daley', :city => cities.first)
User.create(:state => "MI",:age => "98", :interest => "None", :affiliation => "None", :password => "admin123", :username => "admin123", :signature => "admin123", :salt => User.make_salt("admin123"), :hashed_password => User.hash_with_salt("admin123", User.make_salt("admin123")), :email => "admin123@example.com", :first_name => "admin123", :last_name => "NoName")
-User.create(:state => "AZ",:age => "1", :interest => "None", :affiliation => "None", :password => "mjca1234", :username => "mjca1234", :salt => User.make_salt("mjca1234"), :hashed_password => User.hash_with_salt("mjca1234", User.make_salt("mjca1234")), :email => "mjca1234@example.com", :first_name => "mjca1234", :last_name => "NoName")
+User.create(:state => "AZ",:age => "1", :interest => "None", :affiliation => "None", :password => "mjca1234", :username => "mjca1234", :signature => "mjca1234", :salt => User.make_salt("mjca1234"), :hashed_password => User.hash_with_salt("mjca1234", User.make_salt("mjca1234")), :email => "mjca1234@example.com", :first_name => "mjca1234", :last_name => "NoName")

0 comments on commit 23112d8

Please sign in to comment.