Ejemplo n.º 1
1
 public function actionIndex($url)
 {
     $model = Page::findOne(['url' => $url]);
     if (!$model) {
         Alert::add('Strona nie została znaleziona', Alert::TYPE_ERROR);
         return $this->goHome();
     }
     return $this->render('index', ['model' => $model]);
 }
Ejemplo n.º 2
0
 /**
  * @param string $url
  * @return string
  */
 public function actionIndex($url)
 {
     $model = Group::findOne(['url' => $url]);
     if (!$model) {
         Alert::add(Yii::t('msg', 'Page not found.'), Alert::TYPE_ERROR);
         return $this->goHome();
     }
     return $this->render('index', ['model' => $model]);
 }
Ejemplo n.º 3
0
 public function actionUpdate($id = null)
 {
     /** @var User $model */
     $model = User::findOne(Yii::$app->user->getIdentity()->id);
     $model->setScenario('update');
     if ($model->load(Yii::$app->request->post())) {
         if ($model->newPassword) {
             $model->setPassword($model->newPassword);
         }
         if ($model->save()) {
             Alert::add(Yii::t('msg', 'Operation completed successfully.'));
         }
     }
     return $this->render('update', ['model' => $model]);
 }
Ejemplo n.º 4
0
 /**
  * Resets password.
  *
  * @param string $token
  * @return mixed
  * @throws BadRequestHttpException
  */
 public function actionResetPassword($token)
 {
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         throw new BadRequestHttpException($e->getMessage());
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Alert::add(Yii::t('msg', 'New password was saved. Now you can log in.'));
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }