Commit e1f0d09c authored by Thomas Citharel's avatar Thomas Citharel 🌲

Add a default picture for new accounts, in order to disable Gravatar

parent 52ff566c
......@@ -254,6 +254,23 @@ class AsyncAccountGrav extends AbstractMakeAccount implements AsyncAccountInterf
$this->checkAccount();
$admin = $this->siteUser->isAdmin();
$fs = new Filesystem();
/**
* Eventutally create the avatars folder
*/
$avatarsPath = $this->accountsPath . '/' . $this->site->getSubdomain() . '/user/accounts/avatars/';
if (!$fs->exists($avatarsPath)) {
$fs->mkdir($avatarsPath);
}
/**
* Copy avatar
*/
$avatarPath = 'user/accounts/avatars/xVTJub3GlASrgzw.jpg';
$fs->copy($this->enginePath . '/' . $avatarPath, $avatarsPath . 'xVTJub3GlASrgzw.jpg');
$userData = [
'hashed_password' => password_hash($this->siteUser->getPassword(), PASSWORD_DEFAULT),
'email' => $this->user->getEmail(),
......@@ -284,6 +301,14 @@ class AsyncAccountGrav extends AbstractMakeAccount implements AsyncAccountInterf
],
'fullname' => $this->siteUser->getUsername(),
'state' => 'enabled',
'avatar' => [
$avatarPath => [
'name' => $this->siteUser->getUsername() . '.jpg',
'type' => 'image/jpeg',
'size' => 62518,
'path' => $avatarPath
]
]
];
$yamlData = Yaml::dump($userData, 3);
file_put_contents($this->accountsPath . '/' . $this->site->getSubdomain() . '/user/accounts/' . $this->siteUser->getUsername() . '.yaml', $yamlData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment