Sha256: 4a4d578b62998b6964f27bf689d8d4a52c6c100337e1adedbccf4df0f8f9dc22

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

require "vmc/cli/start/base"

module VMC::Start
  class Register < Base
    desc "Create a user and log in"
    group :start, :hidden => true
    input :email, :desc => "Desired email", :argument => :optional
    input :password, :desc => "Desired password"
    input :verify, :desc => "Repeat password"
    input :login, :desc => "Automatically log in?", :default => true
    def register
      show_context

      email = input[:email]
      password = input[:password]

      if !force? && password != input[:verify]
        fail "Passwords do not match."
      end

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

      if input[:login]
        invoke :login, :username => email, :password => password
      end
    end

    private

    def ask_email
      ask("Email")
    end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vmc-0.5.0.beta.5 lib/vmc/cli/start/register.rb
vmc-0.5.0.beta.4 lib/vmc/cli/start/register.rb
vmc-0.5.0.beta.3 lib/vmc/cli/start/register.rb
vmc-0.5.0.beta.2 lib/vmc/cli/start/register.rb
vmc-0.5.0.beta.1 lib/vmc/cli/start/register.rb