#347 Only pass fields that are known to be in the User Model

This commit is contained in:
Bill Heaton
2019-09-13 22:13:23 -07:00
parent f9d8ebaaa7
commit 1bfc576dcc

View File

@ -102,9 +102,14 @@ class RegistrationController extends Controller
if ($form->load(Yii::$app->request->post()) && $form->validate()) { if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$this->trigger(FormEvent::EVENT_BEFORE_REGISTER, $event); $this->trigger(FormEvent::EVENT_BEFORE_REGISTER, $event);
/** @var User $user */ /** @var User $user */
$user = $this->make(User::class, [], $form->attributes); $user = $this->make(User::class, [],
$user->setScenario('register'); [ 'email' => $form->attributes['email'],
'username' => $form->attributes['username'],
'password' => $form->attributes['password']
]); $user->setScenario('register');
$mailService = MailFactory::makeWelcomeMailerService($user); $mailService = MailFactory::makeWelcomeMailerService($user);
if ($this->make(UserRegisterService::class, [$user, $mailService])->run()) { if ($this->make(UserRegisterService::class, [$user, $mailService])->run()) {