#104 - createNewPassword() wordlist in static

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43836 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-10-25 01:51:53 +00:00
parent efc69f3717
commit 423decf09b
2 changed files with 25 additions and 2 deletions

View File

@ -325,8 +325,8 @@ class Member extends DataObject {
* @return string Returns a random password.
*/
static function createNewPassword() {
if(file_exists('/usr/share/silverstripe/wordlist.txt')) {
$words = file('/usr/share/silverstripe/wordlist.txt');
if(file_exists(Security::get_word_list())) {
$words = file(Security::get_word_list());
list($usec, $sec) = explode(' ', microtime());
srand($sec + ((float) $usec * 100000));

View File

@ -50,6 +50,29 @@ class Security extends Controller {
* @var bool
*/
protected static $useSalt = true;
/**
* Location of word list to use for generating passwords
*
* @var string
*/
protected static $wordlist = '/usr/share/silverstripe/wordlist.txt';
/**
* Get location of word list file
*/
static function get_word_list() {
return Security::$wordlist;
}
/**
* Set location of word list file
*
* @param string $wordListFile Location of word list file
*/
static function set_word_list($wordListFile) {
Security::$wordlist = $wordListFile;
}
/**