From c0431c9dfcb692e96474614433a829403046011b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Geuken?= Date: Wed, 15 Mar 2017 21:11:20 +0100 Subject: [PATCH] [api] Drop password_crypted collumn of users table This attribute isn't used anywhere in our code. --- src/api/app/models/unregistered_user.rb | 1 - src/api/app/models/user.rb | 6 ------ ...20170315200936_drop_password_crypted_from_users.rb | 9 +++++++++ src/api/db/structure.sql | 2 +- src/api/test/fixtures/users.yml | 11 ----------- 5 files changed, 10 insertions(+), 19 deletions(-) create mode 100644 src/api/db/migrate/20170315200936_drop_password_crypted_from_users.rb diff --git a/src/api/app/models/unregistered_user.rb b/src/api/app/models/unregistered_user.rb index a71c53602d3..062ed854f4b 100644 --- a/src/api/app/models/unregistered_user.rb +++ b/src/api/app/models/unregistered_user.rb @@ -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 diff --git a/src/api/app/models/user.rb b/src/api/app/models/user.rb index a147251da5f..cb8dc573b1e 100644 --- a/src/api/app/models/user.rb +++ b/src/api/app/models/user.rb @@ -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)) @@ -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 @@ -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 diff --git a/src/api/db/migrate/20170315200936_drop_password_crypted_from_users.rb b/src/api/db/migrate/20170315200936_drop_password_crypted_from_users.rb new file mode 100644 index 00000000000..83e7bad7ecd --- /dev/null +++ b/src/api/db/migrate/20170315200936_drop_password_crypted_from_users.rb @@ -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 diff --git a/src/api/db/structure.sql b/src/api/db/structure.sql index e34d78c4f0d..1aac87848e7 100644 --- a/src/api/db/structure.sql +++ b/src/api/db/structure.sql @@ -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, @@ -1406,6 +1405,7 @@ INSERT INTO schema_migrations (version) VALUES ('20170306084558'), ('20170306105300'), ('20170315190919'), +('20170315200936'), ('21'), ('22'), ('23'), diff --git a/src/api/test/fixtures/users.yml b/src/api/test/fixtures/users.yml index a7129757c8a..33819e30115 100644 --- a/src/api/test/fixtures/users.yml +++ b/src/api/test/fixtures/users.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -292,5 +282,4 @@ unconfirmed_user: password: 8e7a61bc50e5b38543cbb890ce0c0c06 password_hash_type: md5 password_salt: Vibb8QsN4I - password_crypted: osEJSjdDGtlBY state: "unconfirmed"