diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-12-15 14:57:00 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-12-15 14:57:00 -0800 |
commit | cd48b89f3166e7fa732b5cb06d33fba018af9127 (patch) | |
tree | 9ad981df0d736dc186463aac4676fdba2bc232b8 /modules/rest/helpers/rest_event.php | |
parent | 45c63f4d118bfc99924edb8685442035349af6db (diff) |
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.
Diffstat (limited to 'modules/rest/helpers/rest_event.php')
-rw-r--r-- | modules/rest/helpers/rest_event.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/rest/helpers/rest_event.php b/modules/rest/helpers/rest_event.php index 4d7a4a1b..9e241bd0 100644 --- a/modules/rest/helpers/rest_event.php +++ b/modules/rest/helpers/rest_event.php @@ -43,7 +43,7 @@ class rest_event { static function user_add_form_admin_completed($user, $form) { $key = ORM::factory("user_access_key"); $key->user_id = $user->id; - $key->access_key = md5($user->name . time() . mt_rand()); + $key->access_key = random::hash($user->name); $key->save(); } @@ -64,7 +64,7 @@ class rest_event { if (!$key->loaded()) { $key->user_id = $user->id; - $key->access_key = md5($user->name . time() . mt_rand()); + $key->access_key = random::hash($user->name); $key->save(); } @@ -93,7 +93,7 @@ class rest_event { if (!$key->loaded()) { $key->user_id = $data->user->id; - $key->access_key = md5($data->user->name . time() . mt_rand()); + $key->access_key = random::hash($data->user->name); $key->save(); } $view->rest_key = $key->access_key; |