Answer the question
In order to leave comments, you need to log in
How to perform some action after successful user authorization and before redirect on Silex Symfony 2?
I just started working directly with Symfony components. I am interested in the question of how I can implement the following:
It is necessary to add a record to the database on the event of successful user authorization that he has just logged in. As far as I understand, for this you need to make a Handler (for example, CustomAuthenticationSuccessHandler)? How to implement it correctly? After digging through the forums, my head is already swollen, I can’t do it =(
Answer the question
In order to leave comments, you need to log in
Look towards Middleware
Like this:
$after = function (Request $request, Response $response, Application $app) {
// логика логирования
};
$app->post('/login', function () {
// ...
})
->after($after);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question