summaryrefslogtreecommitdiff
path: root/modules/rest
diff options
context:
space:
mode:
Diffstat (limited to 'modules/rest')
-rw-r--r--modules/rest/helpers/rest.php2
-rw-r--r--modules/rest/helpers/rest_event.php6
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index 58943700..9406e209 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -104,7 +104,7 @@ class rest_Core {
if (!$key->loaded()) {
$key->user_id = identity::active_user()->id;
- $key->access_key = md5(md5(uniqid(mt_rand(), true) . access::private_key()));
+ $key->access_key = md5(random::hash() . access::private_key());
$key->save();
}
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;