Skip to content

Commit

Permalink
Merge pull request #2 from schmiddim/master
Browse files Browse the repository at this point in the history
Dissallow certain special chars - some PHP Projects do not support sp…
  • Loading branch information
Roderik van der Veer committed Feb 27, 2016
2 parents 71f6b10 + df7d22c commit 80f7009
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions PWGen.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,25 @@ private static function __static() {
}
}

/**
* Disallow certain special chars
* @param array $symbols
*/
public function blacklistSymbol(array $symbols )
{
foreach ($symbols as $symbol) {
if (!preg_match('/' . preg_quote($symbol) . '/', self::$pw_symbols)) {
return;
}
}
$symbolArray = str_split(self::$pw_symbols);
foreach ($symbols as $symbol) {
$index =array_search($symbol, $symbolArray);
unset($symbolArray[$index]);
}
self::$pw_symbols = implode('', $symbolArray);
}

/**
* Returns the last generated password. If there is none, a new one will be generated.
*/
Expand Down

0 comments on commit 80f7009

Please sign in to comment.