N
N
nepster-web2014-05-15 17:50:05
Yii
nepster-web, 2014-05-15 17:50:05

Yii2 - is there an event "after successful" and "after unsuccessful" validation?


I am doing a behavior and there is a need for events: "after successful" and "after not unsuccessful" validation

ActiveRecord::EVENT_AFTER_VALIDATE 
            ActiveRecord::EVENT_BEFORE_VALIDATE

I need to do the following:
If the user successfully logs in to the site (successful validation of the login and password), then we record it in the history of visits.
If the user does not authorize on the site (incorrect login and / or password), then we record it in the history of suspicious actions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaximAL, 2014-05-15
@nepster-web

All this can be hung up on `afterValidate` and choose where to write, already there.
You can also write a log in the validator of the correct login and password.
Although, offhand, writing to the database from the validator does not look like a very good idea.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question