当前位置: 首页>>代码示例>>PHP>>正文


PHP Terminus::promptSecret方法代码示例

本文整理汇总了PHP中Terminus::promptSecret方法的典型用法代码示例。如果您正苦于以下问题:PHP Terminus::promptSecret方法的具体用法?PHP Terminus::promptSecret怎么用?PHP Terminus::promptSecret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Terminus的用法示例。


在下文中一共展示了Terminus::promptSecret方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * Log in as a user
  *
  *  ## OPTIONS
  * [<email>]
  * : Email address to log in as.
  *
  * [--password=<value>]
  * : Log in non-interactively with this password. Useful for automation.
  *
  * [--machine-token=<value>]
  * : Authenticate using an Auth0 token
  *
  * [--debug]
  * : dump call information when logging in.
  */
 public function login($args, $assoc_args)
 {
     // Try to login using a machine token, if provided.
     if (isset($assoc_args['machine-token']) || empty($args) && isset($_SERVER['TERMINUS_MACHINE_TOKEN'])) {
         $token = $_SERVER['TERMINUS_MACHINE_TOKEN'];
         if (isset($assoc_args['machine-token'])) {
             $token = $assoc_args['machine-token'];
         }
         $this->auth->logInViaMachineToken($token);
     } else {
         // Otherwise, do a normal email/password-based login.
         if (empty($args)) {
             if (isset($_SERVER['TERMINUS_USER'])) {
                 $email = $_SERVER['TERMINUS_USER'];
             } else {
                 $email = Terminus::prompt('Your email address?', null);
             }
         } else {
             $email = $args[0];
         }
         if (isset($assoc_args['password'])) {
             $password = $assoc_args['password'];
         } else {
             $password = Terminus::promptSecret('Your dashboard password (input will not be shown)');
         }
         $this->auth->logInViaUsernameAndPassword($email, $password);
     }
     $this->log()->debug(get_defined_vars());
     Terminus::launchSelf('art', array('fist'));
 }
开发者ID:blueprintmrk,项目名称:cli,代码行数:46,代码来源:auth.php

示例2: login

 /**
  * Log in as a user
  *
  *  ## OPTIONS
  * [<email>]
  * : Email address to log in as.
  *
  * [--password=<value>]
  * : Log in non-interactively with this password. Useful for automation.
  * [--session=<value>]
  * : Authenticate using an existing session token
  * [--debug]
  * : dump call information when logging in.
  */
 public function login($args, $assoc_args)
 {
     # First try to login using a session token if provided
     if (isset($assoc_args['session'])) {
         $this->log()->info("Validating session token");
         $data = $this->doLoginFromSessionToken($assoc_args['session']);
         if ($data != FALSE) {
             if (array_key_exists("debug", $assoc_args)) {
                 $this->_debug(get_defined_vars());
             }
             $this->log()->info("Logged in as " . $data['email']);
             Terminus::launchSelf("art", array("fist"));
         } else {
             $this->failure('Login failed!');
         }
         return;
     }
     # Otherwise do a normal email/password-based login
     if (empty($args)) {
         if (isset($_SERVER['TERMINUS_USER'])) {
             $email = $_SERVER['TERMINUS_USER'];
         } else {
             $email = Terminus::prompt("Your email address?", NULL);
         }
     } else {
         $email = $args[0];
     }
     if (Utils\isValidEmail($email)) {
         if (!isset($assoc_args['password'])) {
             $password = Terminus::promptSecret('Your dashboard password (input will not be shown)');
         } else {
             $password = $assoc_args['password'];
         }
         $this->log()->info("Logging in as {$email}");
         $data = $this->doLogin($email, $password);
         if ($data != FALSE) {
             if (array_key_exists("debug", $assoc_args)) {
                 $this->_debug(get_defined_vars());
             }
             Terminus::launchSelf("art", array("fist"));
         } else {
             $this->failure('Login Failed!');
         }
     } else {
         $this->failure('Invalid email address');
     }
 }
开发者ID:andrefy,项目名称:cli,代码行数:61,代码来源:auth.php

示例3: lock

 /**
   * Lock an environment to prevent changes
   *
   * ## OPTIONS
   *
   * <info|add|remove>
   * : action to execute ( i.e. info, add, remove )
   *
   * [--site=<site>]
   * : site name
   *
   * [--env=<env>]
   * : site environment
   *
   * [--username=<username>]
   * : your username
   *
   * [--password=<password>]
   * : your password
   *
 **/
 function lock($args, $assoc_args)
 {
     $action = array_shift($args);
     $site = $this->sites->get(Input::sitename($assoc_args));
     $env = $site->environments->get(Input::env($assoc_args, 'env'));
     switch ($action) {
         case 'info':
             $info = $env->lockinfo();
             $this->output()->outputRecord($info);
             break;
         case 'add':
             $this->log()->info('Creating new lock on {site}-{env}', array('site' => $site->get('name'), 'env' => $env->get('id')));
             if (!isset($assoc_args['username'])) {
                 $username = Terminus::prompt('Username for the lock');
             } else {
                 $username = $assoc_args['username'];
             }
             if (!isset($assoc_args['password'])) {
                 $password = Terminus::promptSecret('Password for the lock');
             } else {
                 $password = $assoc_args['password'];
             }
             $workflow = $env->lock(array('username' => $username, 'password' => $password));
             $workflow->wait();
             break;
         case 'remove':
             $this->log()->info('Removing lock from {site}-{env}', array('site' => $site->get('name'), 'env' => $env->get('id')));
             $workflow = $env->unlock();
             $workflow->wait();
             break;
     }
     if (isset($workflow)) {
         $this->workflowOutput($workflow);
     }
 }
开发者ID:RobLoach,项目名称:cli,代码行数:56,代码来源:site.php


注:本文中的Terminus::promptSecret方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。