frontend/app/models/user.rb in meroku-2.0.7 vs frontend/app/models/user.rb in meroku-2.0.8
- old
+ new
@@ -3,10 +3,19 @@
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :publickeys
+
+ after_commit :make_user, on: [:create]
before_save do
self.token = SecureRandom.hex if !self.token
+ end
+
+ def make_user
+ Rails.logger.debug "DB8 user.rb:.make_user() called"
+ system(%Q[sudo adduser --disabled-password --gecos "" #{token}])
+ system(%Q[sudo -u #{token} mkdir /home/#{token}/.ssh/])
+ system(%Q[sudo -u #{token} touch /home/#{token}/.ssh/authorized_keys])
end
end