forked from GNUsocial/gnu-social
Replace common_good_random with common_random_hexstr
This commit is contained in:
@@ -187,7 +187,7 @@ class AnonymousFavePlugin extends Plugin
|
||||
list($proxy, $ip) = common_client_ip();
|
||||
|
||||
// IP + time + random number should help to avoid collisions
|
||||
$baseNickname = $ip . '-' . time() . '-' . common_good_rand(5);
|
||||
$baseNickname = $ip . '-' . time() . '-' . common_random_hexstr(5);
|
||||
|
||||
$profile = new Profile();
|
||||
$profile->nickname = $baseNickname;
|
||||
|
@@ -34,7 +34,7 @@ class CasloginAction extends Action
|
||||
phpCAS::handleLogoutRequests();
|
||||
phpCAS::forceAuthentication();
|
||||
global $casTempPassword;
|
||||
$casTempPassword = common_good_rand(16);
|
||||
$casTempPassword = common_random_hexstr(16);
|
||||
$user = common_check_user(phpCAS::getUser(), $casTempPassword);
|
||||
if (!$user) {
|
||||
// TRANS: Server error displayed when trying to log in with incorrect username or password.
|
||||
|
@@ -436,7 +436,7 @@ class FacebookfinishloginAction extends Action
|
||||
if ($response->isOk()) {
|
||||
|
||||
// seems to always be jpeg, but not sure
|
||||
$tmpname = "facebook-avatar-tmp-" . common_good_rand(4);
|
||||
$tmpname = "facebook-avatar-tmp-" . common_random_hexstr(4);
|
||||
|
||||
$ok = file_put_contents(
|
||||
Avatar::path($tmpname),
|
||||
|
@@ -114,7 +114,7 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
|
||||
}
|
||||
$registration_data['nickname'] = $nickname;
|
||||
//set the database saved password to a random string.
|
||||
$registration_data['password']=common_good_rand(16);
|
||||
$registration_data['password']=common_random_hexstr(16);
|
||||
return User::register($registration_data);
|
||||
}else{
|
||||
//user isn't in ldap, so we cannot register him
|
||||
|
@@ -31,7 +31,7 @@ class OMBOAuthDataStore extends OAuthDataStore
|
||||
if (!$con) {
|
||||
$con = new Consumer();
|
||||
$con->consumer_key = $consumer_key;
|
||||
$con->seed = common_good_rand(16);
|
||||
$con->seed = common_random_hexstr(16);
|
||||
$con->created = common_sql_now();
|
||||
if (!$con->insert()) {
|
||||
return null;
|
||||
@@ -78,8 +78,8 @@ class OMBOAuthDataStore extends OAuthDataStore
|
||||
{
|
||||
$t = new Token();
|
||||
$t->consumer_key = $consumer->key;
|
||||
$t->tok = common_good_rand(16);
|
||||
$t->secret = common_good_rand(16);
|
||||
$t->tok = common_random_hexstr(16);
|
||||
$t->secret = common_random_hexstr(16);
|
||||
$t->type = 0; // request
|
||||
$t->state = 0; // unauthorized
|
||||
$t->created = common_sql_now();
|
||||
@@ -107,8 +107,8 @@ class OMBOAuthDataStore extends OAuthDataStore
|
||||
common_debug('request token found.', __FILE__);
|
||||
$at = new Token();
|
||||
$at->consumer_key = $consumer->key;
|
||||
$at->tok = common_good_rand(16);
|
||||
$at->secret = common_good_rand(16);
|
||||
$at->tok = common_random_hexstr(16);
|
||||
$at->secret = common_random_hexstr(16);
|
||||
$at->type = 1; // access
|
||||
$at->created = common_sql_now();
|
||||
if (!$at->insert()) {
|
||||
|
@@ -251,9 +251,9 @@ class FeedSub extends Managed_DataObject
|
||||
protected function doSubscribe($mode)
|
||||
{
|
||||
$orig = clone($this);
|
||||
$this->verify_token = common_good_rand(16);
|
||||
$this->verify_token = common_random_hexstr(16);
|
||||
if ($mode == 'subscribe') {
|
||||
$this->secret = common_good_rand(32);
|
||||
$this->secret = common_random_hexstr(32);
|
||||
}
|
||||
$this->sub_state = $mode;
|
||||
$this->update($orig);
|
||||
|
@@ -132,7 +132,7 @@ class HubSub extends Managed_DataObject
|
||||
{
|
||||
assert($mode == 'subscribe' || $mode == 'unsubscribe');
|
||||
|
||||
$challenge = common_good_rand(32);
|
||||
$challenge = common_random_hexstr(32);
|
||||
$params = array('hub.mode' => $mode,
|
||||
'hub.topic' => $this->topic,
|
||||
'hub.challenge' => $challenge);
|
||||
|
@@ -121,7 +121,7 @@ class Realtime_channel extends Managed_DataObject
|
||||
$channel->arg2 = $arg2;
|
||||
$channel->audience = 1;
|
||||
|
||||
$channel->channel_key = common_good_rand(16); // 128-bit key, 32 hex chars
|
||||
$channel->channel_key = common_random_hexstr(16); // 128-bit key, 32 hex chars
|
||||
|
||||
$channel->created = common_sql_now();
|
||||
$channel->modified = $channel->created;
|
||||
|
Reference in New Issue
Block a user