コード例 #1
0
 /**
  * @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
ファイル: SysUserSearch.php プロジェクト: reuhtte/yii2-admin
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SysUser::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'temp_pswd_flag' => $this->temp_pswd_flag, 'last_pswd_reset' => $this->last_pswd_reset, 'active' => $this->active, 'is_account' => $this->is_account, 'deleted' => $this->deleted, 'creation_date' => $this->creation_date, 'last_update' => $this->last_update, 'idsys_creator' => $this->idsys_creator, 'idsys_updater' => $this->idsys_updater]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'next_pswd_reset', $this->next_pswd_reset])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'activation_token', $this->activation_token])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: SysUser.php プロジェクト: reuhtte/yii2-admin
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSysUsers0()
 {
     return $this->hasMany(SysUser::className(), ['idsys_updater' => 'id']);
 }
コード例 #4
0
ファイル: SysAccessLog.php プロジェクト: reuhtte/yii2-admin
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdsysUser()
 {
     return $this->hasOne(SysUser::className(), ['id' => 'idsys_user']);
 }
コード例 #5
0
 /**
  * Finds the SysUser model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SysUser the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SysUser::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }