#345, #346, #347 ReCaptcha fixes

This commit is contained in:
Bill Heaton
2019-09-20 12:44:40 -07:00
parent 1bfc576dcc
commit 2d71ff95f9
3 changed files with 61 additions and 24 deletions

View File

@ -88,6 +88,9 @@ class RegistrationController extends Controller
];
}
/**
* {@inheritdoc}
*/
public function actionRegister()
{
if (!$this->module->enableRegistration) {
@ -104,12 +107,18 @@ class RegistrationController extends Controller
$this->trigger(FormEvent::EVENT_BEFORE_REGISTER, $event);
/** @var User $user */
$user = $this->make(User::class, [],
[ 'email' => $form->attributes['email'],
'username' => $form->attributes['username'],
'password' => $form->attributes['password']
]); $user->setScenario('register');
// Create a temporay $user so we can get the attributes, then get
// the intersection between the $form fields and the $user fields.
$user = $this->make(User::class, [] );
$fields = array_intersect_key($form->attributes, $user->attributes);
// Becomes password_hash
$fields['password'] = $form['password'];
$user = $this->make(User::class, [], $fields );
$user->setScenario('register');
$mailService = MailFactory::makeWelcomeMailerService($user);
if ($this->make(UserRegisterService::class, [$user, $mailService])->run()) {
@ -138,6 +147,9 @@ class RegistrationController extends Controller
return $this->render('register', ['model' => $form, 'module' => $this->module]);
}
/**
* {@inheritdoc}
*/
public function actionConnect($code)
{
/** @var SocialNetworkAccount $account */
@ -179,6 +191,9 @@ class RegistrationController extends Controller
);
}
/**
* {@inheritdoc}
*/
public function actionConfirm($id, $code)
{
/** @var User $user */
@ -215,6 +230,9 @@ class RegistrationController extends Controller
);
}
/**
* {@inheritdoc}
*/
public function actionResend()
{
if ($this->module->enableEmailConfirmation === false) {