Bypass email activation when admin creates user via API

This commit is contained in:
Toby Zerner 2015-12-29 11:02:07 +10:30
parent 595d715b1d
commit 341ffaced5
2 changed files with 8 additions and 2 deletions

View File

@ -124,6 +124,10 @@ class RegisterUserHandler
}
}
if ($actor->isAdmin()) {
$user->activate();
}
$this->events->fire(
new UserWillBeSaved($user, $actor, $data)
);

View File

@ -352,9 +352,11 @@ class User extends AbstractModel
*/
public function activate()
{
$this->is_activated = true;
if ($this->is_activated !== true) {
$this->is_activated = true;
$this->raise(new UserWasActivated($this));
$this->raise(new UserWasActivated($this));
}
return $this;
}