2016-09-18 09:41:51 -05:00
|
|
|
# frozen_string_literal: true
|
2016-08-27 21:40:21 -05:00
|
|
|
class Account < ApplicationRecord
|
2016-08-28 10:32:26 -05:00
|
|
|
serialize :password, CryptSerializer
|
2016-09-18 11:16:35 -05:00
|
|
|
|
|
|
|
validates :username, presence: true
|
|
|
|
validates :password, presence: true
|
2016-09-28 22:12:55 -05:00
|
|
|
validates :home_folder, presence: true
|
2016-09-28 22:48:17 -05:00
|
|
|
validates :contact_email, presence: true, email_format: true
|
2016-10-06 20:10:36 -05:00
|
|
|
|
|
|
|
after_commit :update_vsftpd_files
|
|
|
|
|
|
|
|
def update_vsftpd_files
|
|
|
|
vsftp = FtpConfig.new
|
|
|
|
vsftp.build_password_list Account.all
|
|
|
|
vsftp.build_user_configs self
|
|
|
|
end
|
2016-08-27 21:40:21 -05:00
|
|
|
end
|