From 423decf09b23e49a342afeb3e525fdf79e20b7fc Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Thu, 25 Oct 2007 01:51:53 +0000 Subject: [PATCH] #104 - createNewPassword() wordlist in static git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43836 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- security/Member.php | 4 ++-- security/Security.php | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/security/Member.php b/security/Member.php index 4133aad8e..f8cbcad48 100644 --- a/security/Member.php +++ b/security/Member.php @@ -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)); diff --git a/security/Security.php b/security/Security.php index ad772b56a..997fade87 100644 --- a/security/Security.php +++ b/security/Security.php @@ -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; + } /**