Sha256: 1219d3c5a323ec59fd441a1a6cbef1034d3ee4ed3ebd45ebf3b4d3edba1d1287

Contents?: true

Size: 851 Bytes

Versions: 54

Compression:

Stored size: 851 Bytes

Contents

require "vmc/cli/user/base"

module VMC::User
  class Create < Base
    desc "Create a user"
    group :admin, :user, :hidden => true
    input :email, :desc => "User email", :argument => :optional
    input :password, :desc => "User password"
    input :verify, :desc => "Repeat password"
    def create_user
      email = input[:email]
      password = input[:password]

      if !force? && password != input[:verify]
        fail "Passwords don't match."
      end

      with_progress("Creating user") do
        client.register(email, password)
      end
    end

    alias_command :add_user, :create_user

    private

    def ask_email
      ask("Email")
    end

    def ask_password
      ask("Password", :echo => "*", :forget => true)
    end

    def ask_verify
      ask("Verify Password", :echo => "*", :forget => true)
    end
  end
end

Version data entries

54 entries across 54 versions & 4 rubygems

Version Path
vmc-0.5.0.rc4 lib/vmc/cli/user/create.rb
vmc-0.5.0.rc3 lib/vmc/cli/user/create.rb
vmc-0.5.0.rc2 lib/vmc/cli/user/create.rb
vmc-0.5.0.rc1 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.12 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.11 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.10 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.7 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.6 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.5 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.4 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.3 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.2 lib/vmc/cli/user/create.rb
vmc-0.5.0.beta.1 lib/vmc/cli/user/create.rb