Sha256: ebf0b771289c710e130a1f50615bc81f0cab4f5b1fb7762d8846db24f9d08ea1

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

# encoding: UTF-8

module Vines
  module Command
    class Unregister
      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

      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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vinesmod-0.4.5.2 lib/vines/command/unregister.rb
vinesmod-0.4.5 lib/vines/command/unregister.rb