目前已经能够通过OAuth登录,现在想要使用PHP自动创建无邮箱的用户并登录,但并不成功
// $this->users为UserRepository $this->authenticator为SessionAuthenicator $this->events为Dispatcher
// class AuthController implements RequestHandlerInterface
$user = $this->users->findByIdentification($suggestions['id']);
if ($user == null) {
$user = User::register("用户名", "", "随机密码");
}
$user->touch();
$user->is_email_confirmed = true;
$user->activate();
$user->save();
$token = RememberAccessToken::generate($user->id);
$token->touch($request);
$session = $request->getAttribute("session");
$this->authenticator->logIn($session, $token);
$this->events->dispatch(new LoggedIn($user, $token)); //此行报错 Call to undefined method Flarum\User\Event\LoggedIn::__invoke()