public function create_token()
{
while (TRUE) {
// Create a random token
$token = text::random('alnum', 32);
// Make sure the token does not already exist
if (!Jelly::select('user_token')->where('token', '=', $token)->count()) {
// A unique token has been found
return $token;
}
}
}