/**
  * Initializes key password prompt
  *
  * @param enigma_error $status Error object with key info
  * @param array        $params Optional prompt parameters
  */
 function password_prompt($status, $params = array())
 {
     $data = $status->getData('missing');
     if (empty($data)) {
         $data = $status->getData('bad');
     }
     $data = array('keyid' => key($data), 'user' => $data[key($data)]);
     if (!empty($params)) {
         $data = array_merge($params, $data);
     }
     if ($this->rc->action == 'send') {
         $this->rc->output->command('enigma_password_request', $data);
     } else {
         $this->rc->output->set_env('enigma_password_request', $data);
     }
     // add some labels to client
     $this->rc->output->add_label('enigma.enterkeypasstitle', 'enigma.enterkeypass', 'save', 'cancel');
     $this->add_css();
     $this->add_js();
 }
Beispiel #2
0
 /**
  * Initializes key password prompt
  *
  * @param enigma_error $status Error object with key info
  * @param array        $params Optional prompt parameters
  */
 function password_prompt($status, $params = array())
 {
     $data = $status->getData('missing');
     if (empty($data)) {
         $data = $status->getData('bad');
     }
     $keyid = key($data);
     $data = array('keyid' => $params['keyid'] ?: $keyid, 'user' => $data[$keyid]);
     // With GnuPG 2.1 user name may not be specified (e.g. on private
     // key export), we'll get the key information and set the name appropriately
     if ($keyid && $params['keyid'] && strpos($data['user'], $keyid) !== false) {
         $key = $this->enigma->engine->get_key($params['keyid']);
         if ($key && $key->name) {
             $data['user'] = $key->name;
         }
     }
     if (!empty($params)) {
         $data = array_merge($params, $data);
     }
     if (preg_match('/^(send|plugin.enigmaimport|plugin.enigmakeys)$/', $this->rc->action)) {
         $this->rc->output->command('enigma_password_request', $data);
     } else {
         $this->rc->output->set_env('enigma_password_request', $data);
     }
     // add some labels to client
     $this->rc->output->add_label('enigma.enterkeypasstitle', 'enigma.enterkeypass', 'save', 'cancel');
     $this->add_css();
     $this->add_js();
 }