G
G
Greg Popov2016-04-22 15:14:11
Yii
Greg Popov, 2016-04-22 15:14:11

How to implement Alert in Yii2 with a request to activate an account from a mailbox?

Hello. Faced such a task, I do not understand what and where to write.
The problem is in the backend part, not in the output of the alert. You need to check the status in the database, and pass the value to the layout, if it matches the given one, then display the text asking you to activate your account.
Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-04-22
@Gregpopov

1. Create an email activation flag in the user database
2. In the USER model, create the isConfirm function (for example), which returns true or false
3. Create a Maincontroller controller, inherit from Controller, write a check in beforeAction in it, inherit all frontend controllers from maincontroller. I advise you to do authorization and registration in a separate controller and inherit it from Controller (conveniently)

if(Yii::$app->user->identity->isConfirm())
Yii::app()->session->addFlash('error', 'Срочно подтверди email, [email protected]ка');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question