Sha256: 2400a6947a97032910fdfb91574082ecd8d2acf0f69dbbdc9b54e7fb15ee0790

Contents?: true

Size: 941 Bytes

Versions: 36

Compression:

Stored size: 941 Bytes

Contents

require "cf/cli/user/base"

module CF::User
  class Register < Base
    def precondition; end

    desc "Create a user and log in"
    group :admin, :user
    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
      email = input[:email]
      password = input[:password]

      validate_password!(password)

      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_password
      ask("Password", :echo => "*", :forget => true)
    end

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

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
cf-5.4.7 lib/cf/cli/user/register.rb
cf-5.4.7.rc1 lib/cf/cli/user/register.rb
cf-5.4.5 lib/cf/cli/user/register.rb
cf-5.4.4 lib/cf/cli/user/register.rb
trucker-cli-0.0.3 lib/cf/cli/user/register.rb
cf-5.4.3 lib/cf/cli/user/register.rb
cf-5.4.2 lib/cf/cli/user/register.rb
trucker-cli-0.0.2 lib/cf/cli/user/register.rb
trucker-cli-0.0.1 lib/cf/cli/user/register.rb
cf-5.4.1 lib/cf/cli/user/register.rb
cf-5.4.1.rc1 lib/cf/cli/user/register.rb
cf-5.4.0 lib/cf/cli/user/register.rb
cf-5.3.1 lib/cf/cli/user/register.rb
cf-5.3.0 lib/cf/cli/user/register.rb
cf-5.2.2 lib/cf/cli/user/register.rb
cf-5.2.1.rc15 lib/cf/cli/user/register.rb
cf-5.2.1.rc14 lib/cf/cli/user/register.rb
cf-5.2.1.rc13 lib/cf/cli/user/register.rb
cf-5.2.1.rc12 lib/cf/cli/user/register.rb
cf-5.2.1.rc11 lib/cf/cli/user/register.rb