Beispiel #1
0
 public function testSettingsFromArray()
 {
     $potentialpost = ["wordlist" => ["BOB"], "numWords" => 3, "seperator" => "#"];
     $sett = new GeneratorSettings();
     $sett->setFromArray($potentialpost);
     $gen = new PassGenerator($sett);
     $pass = $gen->generate();
     $this->assertEquals($pass, "BOB#BOB#BOB", "Cannot set from array: " . $pass);
 }
Beispiel #2
0
			<div class="row">
				<div class="col-md-1 sides">
				</div>
				<div class="col-md-10 content">


					<div class="page-header">
						<h1>
							xkcd Password Generator
						</h1>
					</div>


					<?php 
require_once "src/autoload.php";
$settings = new GeneratorSettings();
$settings->setFromArray($_GET);
$valid = $settings->isValid();
// ALERT for invalid settings
if (!$valid) {
    echo '
							<div class="alert alert-warning">
								Options don\'t seem to be valid. <br />';
    foreach ($settings->getInvalids() as $msg) {
        echo $msg . "<br />";
    }
    echo '
								Passphrases will be made from default settings.
							</div>';
    // Set to default setting
    $settings = new GeneratorSettings();