Skip to content

Commit

Permalink
[api] Drop password_crypted collumn of users table
Browse files Browse the repository at this point in the history
This attribute isn't used anywhere in our code.
  • Loading branch information
bgeuken committed Mar 16, 2017
1 parent 2193e49 commit c0431c9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/api/app/models/unregistered_user.rb
Expand Up @@ -84,7 +84,6 @@ def self.register(opts)
# password :string(100) default(""), not null
# password_hash_type :string(20) default(""), not null
# password_salt :string(10) default("1234512345"), not null
# password_crypted :string(64)
# adminnote :text(65535)
# state :string(11) default("unconfirmed")
# owner_id :integer
Expand Down
6 changes: 0 additions & 6 deletions src/api/app/models/user.rb
Expand Up @@ -144,10 +144,6 @@ def create_home_project
# generate a new 10-char long hash only Base64 encoded so things are compatible
self.password_salt = [Array.new(10){rand(256).chr}.join].pack('m')[0..9]

# vvvvvv added this to maintain the password list for lighttpd
write_attribute(:password_crypted, password.crypt('os'))
# ^^^^^^

# write encrypted password to object property
write_attribute(:password, hash_string(password))

Expand Down Expand Up @@ -368,7 +364,6 @@ def new_password?
# user.save
#
def update_password(pass)
self.password_crypted = hash_string(pass).crypt('os')
self.password = hash_string(pass)
end

Expand Down Expand Up @@ -1031,7 +1026,6 @@ def hash_string(value)
# password :string(100) default(""), not null
# password_hash_type :string(20) default(""), not null
# password_salt :string(10) default("1234512345"), not null
# password_crypted :string(64)
# adminnote :text(65535)
# state :string(11) default("unconfirmed")
# owner_id :integer
Expand Down
@@ -0,0 +1,9 @@
class DropPasswordCryptedFromUsers < ActiveRecord::Migration[5.0]
def up
remove_column :users, :password_crypted
end

def down
add_column :users, :password_crypted, :string
end
end
2 changes: 1 addition & 1 deletion src/api/db/structure.sql
Expand Up @@ -1077,7 +1077,6 @@ CREATE TABLE `users` (
`password` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '',
`password_hash_type` varchar(20) COLLATE utf8_bin NOT NULL DEFAULT 'md5',
`password_salt` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '1234512345',
`password_crypted` varchar(64) CHARACTER SET utf8 DEFAULT NULL,
`adminnote` text CHARACTER SET utf8,
`state` enum('unconfirmed','confirmed','locked','deleted','subaccount') COLLATE utf8_bin DEFAULT 'unconfirmed',
`owner_id` int(11) DEFAULT NULL,
Expand Down Expand Up @@ -1406,6 +1405,7 @@ INSERT INTO schema_migrations (version) VALUES
('20170306084558'),
('20170306105300'),
('20170315190919'),
('20170315200936'),
('21'),
('22'),
('23'),
Expand Down
11 changes: 0 additions & 11 deletions src/api/test/fixtures/users.yml
Expand Up @@ -9,7 +9,6 @@ Admin:
password: f2eb735aacb365155a6d0076434b73e9
password_hash_type: md5
password_salt: 6H2zF0vSjj
password_crypted: osQq6OKjF0f8I
state: "confirmed"
Iggy:
created_at: 2011-07-29 14:00:21.000000000 Z
Expand Down Expand Up @@ -99,7 +98,6 @@ deleted:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "deleted"
dmayr:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -112,7 +110,6 @@ dmayr:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "confirmed"
fred:
created_at: 2011-07-29 14:00:21.000000000 Z
Expand Down Expand Up @@ -168,7 +165,6 @@ maintenance_assi:
password: f021ce8ca85a51a5eb08d8b6e7cf82b1
password_hash_type: md5
password_salt: 0hY2gWMfcb
password_crypted: osAB47949pfHo
state: "confirmed"
maintenance_coord:
created_at: 2011-07-29 14:00:21.000000000 Z
Expand Down Expand Up @@ -214,7 +210,6 @@ user1:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "confirmed"
user2:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -227,7 +222,6 @@ user2:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "confirmed"
user3:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -240,7 +234,6 @@ user3:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "confirmed"
user4:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -253,7 +246,6 @@ user4:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "confirmed"
user5:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -266,7 +258,6 @@ user5:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "confirmed"
user6:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -279,7 +270,6 @@ user6:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: 2
unconfirmed_user:
created_at: 2012-01-16 13:36:00.000000000 Z
Expand All @@ -292,5 +282,4 @@ unconfirmed_user:
password: 8e7a61bc50e5b38543cbb890ce0c0c06
password_hash_type: md5
password_salt: Vibb8QsN4I
password_crypted: osEJSjdDGtlBY
state: "unconfirmed"

0 comments on commit c0431c9

Please sign in to comment.