/**
  * @param bool $performValidation
  *
  * @return bool
  */
 public function sendEmail($performValidation = true)
 {
     if ($performValidation and !$this->validate()) {
         return false;
     }
     $this->user->generateConfirmationToken();
     $this->user->save(false);
     return Yii::$app->mailer->compose('/mail/password-recovery-mail', ['user' => $this->user])->setTo($this->email)->setFrom(['*****@*****.**' => 'Helpdesk'])->setSubject(Yii::t('app', 'Password reset for') . ' ' . Yii::$app->name)->send();
 }
Пример #2
0
 /**
  * Creates a new SysUser model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SysUser();
     $model->scenario = 'create';
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         \Yii::$app->getSession()->setFlash('success', Yii::t('app', 'User succesfully created!'));
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }