mirror of
https://github.com/getgrav/grav.git
synced 2026-03-17 01:51:08 +01:00
Fixed user avatar file is not being randomized
This commit is contained in:
@@ -18,6 +18,7 @@ use Grav\Common\Page\Medium\MediumFactory;
|
||||
use Grav\Common\User\Authentication;
|
||||
use Grav\Common\User\Interfaces\UserInterface;
|
||||
use Grav\Common\User\Traits\UserTrait;
|
||||
use Grav\Common\Utils;
|
||||
use Grav\Framework\File\Formatter\JsonFormatter;
|
||||
use Grav\Framework\File\Formatter\YamlFormatter;
|
||||
use Grav\Framework\Flex\FlexDirectory;
|
||||
@@ -621,6 +622,14 @@ class User extends FlexObject implements UserInterface, MediaManipulationInterfa
|
||||
$data = null;
|
||||
}
|
||||
|
||||
$settings = $this->getBlueprint()->schema()->getProperty($field);
|
||||
|
||||
// Generate random name if required
|
||||
if ($settings['random_name'] ?? false) {
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$data['name'] = $filename = Utils::generateRandomString(15) . '.' . $extension;
|
||||
}
|
||||
|
||||
// For shared media folder we need to keep path for backwards compatibility.
|
||||
$folder = $this->getMediaFolder();
|
||||
if ($this->_loadMedia) {
|
||||
|
||||
Reference in New Issue
Block a user