Consolidate all the random code into a random helper that offers:

random::hash()
  random::string()
  random::percent()
  random::int()

So that we don't have lots of different ways to get random values all
over the code.  Follow-on to #1527.
This commit is contained in:
Bharat Mediratta
2010-12-15 14:57:00 -08:00
parent 45c63f4d11
commit cd48b89f31
17 changed files with 96 additions and 46 deletions

View File

@@ -51,7 +51,7 @@ class Password_Controller extends Controller {
$user_name = $form->reset->inputs["name"]->value;
$user = user::lookup_by_name($user_name);
if ($user && !empty($user->email)) {
$user->hash = md5(uniqid(mt_rand(), true));
$user->hash = random::hash();
$user->save();
$message = new View("reset_password.html");
$message->confirm_url = url::abs_site("password/do_reset?key=$user->hash");