mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
#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:
parent
efc69f3717
commit
423decf09b
@ -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));
|
||||
|
@ -51,6 +51,29 @@ class Security extends Controller {
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register that we've had a permission failure trying to view the given page
|
||||
|
Loading…
x
Reference in New Issue
Block a user