L
L
Leonid Groshev2017-01-20 14:32:39
symfony
Leonid Groshev, 2017-01-20 14:32:39

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

1 answer(s)
A
anton_lazarev, 2017-01-27
@otezvikentiy

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 question

Ask a Question

731 491 924 answers to any question