Exemplo n.º 1
0
 public function loginDestination()
 {
     /** @var DestinationAccount $model */
     $model = DestinationAccount::find()->where(['email' => $this->username])->one();
     if (!is_null($model) && $model->password == $this->password) {
         return $model;
     } else {
         $this->addError('password', Yii::t('app', 'Incorrect User or Password'));
         return null;
     }
 }
Exemplo n.º 2
0
 public function actionForgotPassword()
 {
     $this->layout = 'login';
     $model = new AdminLoginForm();
     $show = 'login';
     $username = Yii::$app->request->post('username');
     /** @var DestinationAccount $destination */
     $destination = DestinationAccount::find()->where(['email' => $username])->one();
     if (!is_null($destination)) {
         $destination->generateEmailForgotPassword();
         StoreUtils::sendPendingEmails();
         $model->username = $destination->email;
         Yii::$app->session->setFlash('general-info', Yii::t('app', 'An email with the information you requested was successfully sent to {email}', ['email' => $destination->email]));
     } else {
         $show = 'password';
         Yii::$app->session->setFlash('password-error', Yii::t('app', 'The email address you provided could not be found'));
     }
     return $this->render('login', ['model' => $model, 'show' => $show]);
 }