/** * Зберегти гостя як юзера в БД */ public function saveAsUser() { $user = new User(); $user->login = $this->login; $user->password = $this->password; $user->firstname = $this->firstname; $user->secondname = $this->secondname; $user->patronymic = $this->patronymic; $user->email = $this->email; $user->gender = $this->gender; $user->birth_date = $this->birth_date; $user->reg_date = $this->reg_date; $user->is_active = false; $user->last_activity = $this->last_activity; if (!$user->login) { $user->login = CMS\User::generateRandomPassword(); } if (!$user->password) { $user->password = CMS\User::generateRandomPassword(); } $user->password = CMS\User::criptPassword($user->password); $user->save(); $this->setting('id', $user->id); return $user; }