apps/encryption/lib/Crypto/EncryptAll.php
/**
	 * output one-time encryption passwords
	 */
output one-time encryption passwords
output one - time encryption passwords
protected function outputPasswords() {
		$table = new Table($this->output);
		$table->setHeaders(array('Username', 'Private key password'));
		$newPasswords = array();
		$unchangedPasswords = array();
		foreach ($this->userPasswords as $uid => $password) {
			if (empty($password)) {
				$unchangedPasswords[] = $uid;
			} else {
				$newPasswords[] = [$uid, $password];
			}
		}
		if (empty($newPasswords)) {
			$this->output->writeln("\nAll users already had a key-pair, no further action needed.\n");
			return;
		}
		$table->setRows($newPasswords);
		$table->render();
		if (!empty($unchangedPasswords)) {
			$this->output->writeln("\nThe following users already had a key-pair which was reused without setting a new password:\n");
			foreach ($unchangedPasswords as $uid) {
				$this->output->writeln("    $uid");
			}
		}
		$this->writePasswordsToFile($newPasswords);
		$this->output->writeln('');
		$question = new ConfirmationQuestion('Do you want to send the passwords directly to the users by mail? (y/n) ', false);
		if ($this->questionHelper->ask($this->input, $this->output, $question)) {
			$this->sendPasswordsByMail();
		}
	}
protected function outputPasswords ( ) { $ table = new Table ( $ this -> output ) ; $ table -> setHeaders ( array ( 'Username' , 'Private key password' ) ) ; $ newPasswords = array ( ) ; $ unchangedPasswords = array ( ) ; foreach ( $ this -> userPasswords as $ uid => $ password ) { if ( empty ( $ password ) ) { $ unchangedPasswords [ ] = $ uid ; } else { $ newPasswords [ ] = [ $ uid , $ password ] ; } } if ( empty ( $ newPasswords ) ) { $ this -> output -> writeln ( " \n All users already had a key-pair, no further action needed. \n " ) ; return ; } $ table -> setRows ( $ newPasswords ) ; $ table -> render ( ) ; if ( ! empty ( $ unchangedPasswords ) ) { $ this -> output -> writeln ( " \n The following users already had a key-pair which was reused without setting a new password: \n " ) ; foreach ( $ unchangedPasswords as $ uid ) { $ this -> output -> writeln ( " $ uid " ) ; } } $ this -> writePasswordsToFile ( $ newPasswords ) ; $ this -> output -> writeln ( '' ) ; $ question = new ConfirmationQuestion ( 'Do you want to send the passwords directly to the users by mail? (y/n) ' , false ) ; if ( $ this -> questionHelper -> ask ( $ this -> input , $ this -> output , $ question ) ) { $ this -> sendPasswordsByMail ( ) ; } }
output one-time encryption passwords
output one - time encryption passwords
//create rows