Answer the question
In order to leave comments, you need to log in
How to implement a single registration and authorization form in Symfony 2?
Welcome all.
Initial situation:
1. On the site for the user, it is necessary to build a single form for implementation and authorization (remember-me is also implied) so that the user does not run through two different forms: register in the registration form, log in - in authorization. In other words: we need a 2 in 1 form.
2. The project is written in Symfony 2.3
3. Documentation and examples in Symfony 2 show how to create authorization separately and registration separately, I did not find anything about something unified and integral.
4. I began to dig this task in depth: for now, I think that you need to implement your method in the controller instead of the notorious method, which is indicated by the logic_check recommended by the documentation in security.yml:
...
form_login:
login_path: /account/login
check_path: /account/login_check
...
...
login_check:
pattern: /account/login_check
...
Answer the question
In order to leave comments, you need to log in
I would dig towards a custom UserProvider: symfony.com/doc/current/cookbook/security/custom_p...
public function loadUserByUsername($username)
{
// make a call to your webservice here
$userData = ...
// pretend it returns an array on success, false if there is no user
if ($userData) {
$password = '...';
// ...
return new WebserviceUser($username, $password, $salt, $roles);
}
// Тут создаем пользователя
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question