diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index 374ce9a9a..3582d0387 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -124,14 +124,21 @@ class User extends Data public function save() { $file = $this->file(); + if ($file) { + $username = $this->get('username'); + + if (!$file->filename()) { + $locator = Grav::instance()['locator']; + $file->filename($locator->findResource('account://') . DS . strtolower($username) . YAML_EXT); + } + // if plain text password, hash it and remove plain text if ($this->password) { $this->hashed_password = Authentication::create($this->password); unset($this->password); } - $username = $this->get('username'); unset($this->username); $file->save($this->items); $this->set('username', $username);