/** * Reset password */ public function actionReset($key) { /** @var \common\modules\user\models\User $user */ /** @var \common\modules\user\models\UserKey $userKey */ // check for valid userKey $userKey = Yii::$app->getModule("user")->model("UserKey"); $userKey = $userKey::findActiveByKey($key, $userKey::TYPE_PASSWORD_RESET); if (!$userKey) { return $this->render('reset', ["invalidKey" => true]); } // get user and set "reset" scenario $success = false; $user = Yii::$app->getModule("user")->model("User"); $user = $user::findOne($userKey->user_id); $user->setScenario("reset"); // load post data and reset user password if ($user->load(Yii::$app->request->post()) && $user->save()) { // consume userKey and set success = true $userKey->consume(); $success = true; } // render // return $this->render('reset', compact("user", "success")); return $this->render('@frontend/views/site/index', ['templateType' => 'col3', 'title' => Yii::t('user', 'Вход'), 'columnFirst' => ['top3News' => SiteBlock::getTop3News(), 'top6News' => SiteBlock::getTop6News(), 'subscribing' => SiteBlock::getSubscribingForm(), 'blog_column' => SiteBlock::getBlogPosts()], 'columnSecond' => ['forgot_block' => ['view' => 'reset', 'data' => compact('user', 'success')], 'short_news' => SiteBlock::getShortNews()], 'columnThird' => ['reviewNews' => SiteBlock::getPhotoVideoNews(), 'questionBlock' => SiteBlock::getQuestionBlock(), 'tournament' => SiteBlock::getTournamentTable()]]); }
/** * Url: / * @return mixed Content */ public function actionIndex() { return $this->render('@frontend/views/site/index', ['templateType' => 'col3', 'title' => 'Dynamomania.com. Сайт болельщиков Динамо Киев', 'columnFirst' => ['top3News' => SiteBlock::getTop3News(), 'top6News' => SiteBlock::getTop6News(), 'subscribing' => SiteBlock::getSubscribingForm(), 'banner1' => SiteBlock::getBanner(Banner::REGION_FIRST_COLUMN), 'blog_column' => SiteBlock::getBlogPosts()], 'columnSecond' => ['slider_matches' => SiteBlock::getMatchesSlider(), 'short_news' => SiteBlock::getshortNews(50, false)], 'columnThird' => ['questionBlock' => SiteBlock::getQuestionBlock(), 'banner1' => SiteBlock::getBanner(Banner::REGION_THIRD_COLUMN), 'tournament' => SiteBlock::getTournamentTable(), 'reviewNews' => SiteBlock::getPhotoVideoNews(), 'banner2' => SiteBlock::getBanner(Banner::REGION_THIRD_COLUMN), 'top200tags' => SiteBlock::getTop200Tags(), 'banner3' => SiteBlock::getBanner(Banner::REGION_THIRD_COLUMN)]]); }