Class: Vines::Command::Register
- Inherits:
-
Object
- Object
- Vines::Command::Register
- Defined in:
- lib/vines/command/register.rb
Instance Method Summary collapse
Instance Method Details
#create_user(domain, jid, password) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/vines/command/register.rb', line 15 def create_user(domain, jid, password) user = User.new(jid: [jid, domain].join('@'), password: BCrypt::Password.create(password).to_s) storage = Storage::Local.new { dir(Config.instance.storage(domain).dir) } storage.save_user(user) puts "Created user #{user.jid} with password #{password}" end |
#run(opts) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/vines/command/register.rb', line 6 def run(opts) raise 'vines register <login> <password> <domain>' unless opts[:args].size == 3 require opts[:config] login, password, domain = opts[:args] create_user(domain, login, password) end |