2amigos / yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
https://github.com/2amigos/yii2-usuario
Other
292 stars 140 forks source link

/user/registration/register does not always show registration errors #532

Closed edegaudenzi closed 4 months ago

edegaudenzi commented 7 months ago

What steps will reproduce the problem?

End-user tries to register a new account through a custom register.php view that only requires the username field.

What is the expected result?

Given both username and email fields are required, the page should reload showing a pop-up error reporting: "email is a required field" or something.

What do you get instead?

The page reloads showing absolutely no sign of any error at all.

edegaudenzi commented 7 months ago

Problem is in 2amigos/yii2-usuario/src/User/Controller/RegistrationController::actionRegister():

the if ($form->load(Yii::$app->request->post()) && $form->validate()) { only evaluates when True; we need there an else statement that sets a flash message like: Yii::$app->session->setFlash('danger', $form->getErrorSummary(false));

edegaudenzi commented 4 months ago

I've just submitted a PR, it looks something like this: image