Class: Vines::Command::Unregister
- Inherits:
-
Object
- Object
- Vines::Command::Unregister
- Defined in:
- lib/vines/command/unregister.rb
Instance Method Summary collapse
Instance Method Details
#delete_user(domain, jid, password) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/vines/command/unregister.rb', line 15 def delete_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/unregister.rb', line 6 def run(opts) raise 'vines unregister <login> <password> <domain>' unless opts[:args].size == 3 require opts[:config] login, password, domain = opts[:args] delete_user(domain, login, password) end |