You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
metu.life/app/services/setup_local_account_service.rb

15 lines
324 B

class SetupLocalAccountService
def call(user, username)
user.build_account
user.account.username = username
user.account.domain = nil
keypair = OpenSSL::PKey::RSA.new(2048)
user.account.private_key = keypair.to_pem
user.account.public_key = keypair.public_key.to_pem
user.save!
end
end