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.
|
* @return string Returns a random password.
|
||||||
*/
|
*/
|
||||||
static function createNewPassword() {
|
static function createNewPassword() {
|
||||||
if(file_exists('/usr/share/silverstripe/wordlist.txt')) {
|
if(file_exists(Security::get_word_list())) {
|
||||||
$words = file('/usr/share/silverstripe/wordlist.txt');
|
$words = file(Security::get_word_list());
|
||||||
|
|
||||||
list($usec, $sec) = explode(' ', microtime());
|
list($usec, $sec) = explode(' ', microtime());
|
||||||
srand($sec + ((float) $usec * 100000));
|
srand($sec + ((float) $usec * 100000));
|
||||||
|
@ -50,6 +50,29 @@ class Security extends Controller {
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected static $useSalt = true;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user