Use random and unique session id
This commit is contained in:
parent
2632387517
commit
544991cab3
@ -35,7 +35,7 @@ class Session {
|
|||||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`) VALUES (?, ?, ?, ?) ');
|
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`) VALUES (?, ?, ?, ?) ');
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'es_id' => self::getSessionId(),
|
'es_id' => self::getUniqueSessionId(),
|
||||||
'genesis_url' => $genesis,
|
'genesis_url' => $genesis,
|
||||||
'genesis_hash' => $hash,
|
'genesis_hash' => $hash,
|
||||||
'owner' => \OCP\User::getUser()
|
'owner' => \OCP\User::getUser()
|
||||||
@ -48,8 +48,12 @@ class Session {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getSessionId(){
|
protected static function getUniqueSessionId(){
|
||||||
return (string) time();
|
do {
|
||||||
|
$id = \OC_Util::generate_random_bytes(30);
|
||||||
|
} while (self::getSession($id));
|
||||||
|
|
||||||
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user