/** * Creates inherited user account. */ public function init() { parent::init(); if (!Yii::$app->user->isGuest) { if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) { $user = User::findMe(); if (empty($user)) { $new = new User(); $new->setScenario('installation'); $new->inherited_id = Yii::$app->user->id; $new->status = User::STATUS_ACTIVE; $new->role = User::ROLE_MEMBER; $new->timezone = User::DEFAULT_TIMEZONE; if ($new->save()) { $this->success(Yii::t('podium/flash', 'Hey! Your new forum account has just been automatically created! Go to {link} to complement it.', ['link' => Html::a(Yii::t('podium/view', 'Profile'))])); Cache::clearAfterActivate(); Log::info('Inherited account created', $new->id, __METHOD__); } else { throw new Exception(Yii::t('podium/view', 'There was an error while creating inherited user account. Podium can not run with the current configuration. Please contact administrator about this problem.')); } } elseif ($user->status == User::STATUS_BANNED) { return $this->redirect(['default/ban']); } } else { $user = Yii::$app->user->identity; } if ($user && !empty($user->timezone)) { Yii::$app->formatter->timeZone = $user->timezone; } } }
/** * Creates inherited user account. */ public function init() { parent::init(); if (!Yii::$app->user->isGuest) { if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) { $user = User::findMe(); if (empty($user)) { $new = new User(); $new->setScenario('installation'); $new->inherited_id = Yii::$app->user->id; $new->status = User::STATUS_ACTIVE; $new->role = User::ROLE_MEMBER; $new->timezone = User::DEFAULT_TIMEZONE; if ($new->save()) { $this->success(Yii::t('podium/flash', Messages::ACCOUNT_INHERITED, ['link' => Html::a(Yii::t('podium/layout', 'Profile'))])); Cache::clearAfterActivate(); Log::info('Inherited account created', $new->id, __METHOD__); } else { throw new Exception(Yii::t('podium/view', Messages::ACCOUNT_INHERITED_ERROR)); } } elseif ($user->status == User::STATUS_BANNED) { return $this->redirect(['default/ban']); } } else { $user = Yii::$app->user->identity; } if ($user && !empty($user->timezone)) { Yii::$app->formatter->timeZone = $user->timezone; } } }
/** * Performs new post creation and subscription. * If previous post in thread has got the same author posts are merged. * @param Post $previous previous post * @return boolean * @throws Exception * @since 0.2 */ public function podiumNew($previous = null) { $transaction = static::getDb()->beginTransaction(); try { $id = null; if (!empty($previous) && $previous->author_id == User::loggedId()) { $previous->content .= '<hr>' . $this->content; $previous->edited = 1; $previous->touch('edited_at'); if ($previous->save()) { $previous->markSeen(); $previous->thread->touch('edited_post_at'); $id = $previous->id; $thread = $previous->thread; } } else { if ($this->save()) { $this->markSeen(); $this->forum->updateCounters(['posts' => 1]); $this->thread->updateCounters(['posts' => 1]); $this->thread->touch('new_post_at'); $this->thread->touch('edited_post_at'); $id = $this->id; $thread = $this->thread; } } if (empty($id)) { throw new Exception('Saved Post ID missing'); } Subscription::notify($thread->id); if ($this->subscribe && !$thread->subscription) { $subscription = new Subscription(); $subscription->user_id = User::loggedId(); $subscription->thread_id = $thread->id; $subscription->post_seen = Subscription::POST_SEEN; $subscription->save(); } $transaction->commit(); Cache::clearAfter('newPost'); Log::info('Post added', $id, __METHOD__); return true; } catch (Exception $e) { $transaction->rollBack(); Log::error($e->getMessage(), null, __METHOD__); } return false; }
/** * Prepares notification email. * @param integer $thread */ public static function notify($thread) { if (is_numeric($thread) && $thread > 0) { $email = Content::find()->where(['name' => 'email-sub'])->limit(1)->one(); if ($email) { $topic = $email->topic; $content = $email->content; } else { $topic = Messages::EMAIL_SUB_TITLE; $content = Messages::EMAIL_SUB_BODY; } $forum = Config::getInstance()->get('name'); $subs = static::find()->where(['thread_id' => (int) $thread, 'post_seen' => self::POST_SEEN]); foreach ($subs->each() as $sub) { $sub->post_seen = self::POST_NEW; if ($sub->save()) { if (!empty($sub->user->email)) { if (Email::queue($sub->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['default/last', 'id' => $sub->thread_id], true), Url::to(['default/last', 'id' => $sub->thread_id], true)), $content)), $sub->user_id)) { Log::info('Subscription notice link queued', $sub->user_id, __METHOD__); } else { Log::error('Error while queuing subscription notice link', $sub->user_id, __METHOD__); } } else { Log::error('Error while queuing subscription notice link - no email set', $sub->user_id, __METHOD__); } } } } }
/** * Updates friend status for the user. * @return boolean * @since 0.2 */ public function updateFriend() { try { if ($this->isBefriendedBy(User::loggedId())) { Yii::$app->db->createCommand()->delete('{{%podium_user_friend}}', 'user_id = :uid AND friend_id = :iid', [':uid' => User::loggedId(), ':iid' => $this->id])->execute(); Log::info('User unfriended', $this->id, __METHOD__); } else { Yii::$app->db->createCommand()->insert('{{%podium_user_friend}}', ['user_id' => User::loggedId(), 'friend_id' => $this->id])->execute(); Log::info('User befriended', $this->id, __METHOD__); } Cache::getInstance()->deleteElement('user.friends', $this->id); return true; } catch (Exception $e) { Log::error($e->getMessage(), null, __METHOD__); } return false; }
/** * Updating the forums order. * @return string|\yii\web\Response */ public function actionSortForum() { if (Yii::$app->request->isAjax) { if (User::can(Rbac::PERM_UPDATE_FORUM)) { $modelId = Yii::$app->request->post('id'); $modelCategory = Yii::$app->request->post('category'); $new = Yii::$app->request->post('new'); if (is_numeric($modelId) && is_numeric($modelCategory) && is_numeric($new) && $modelId > 0 && $modelCategory > 0 && $new >= 0) { $moved = Forum::findOne((int) $modelId); $movedCategory = Category::findOne((int) $modelCategory); if ($moved && $modelCategory && $moved->category_id == $movedCategory->id) { $query = (new Query())->from(Forum::tableName())->where('id != :id AND category_id = :cid')->params([':id' => $moved->id, ':cid' => $movedCategory->id])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->indexBy('id'); $next = 0; $newSort = -1; try { foreach ($query->each() as $id => $forum) { if ($next == (int) $new) { $newSort = $next; $next++; } Yii::$app->db->createCommand()->update(Forum::tableName(), ['sort' => $next], 'id = :id', [':id' => $id])->execute(); $next++; } if ($newSort == -1) { $newSort = $next; } $moved->sort = $newSort; if (!$moved->save()) { return Html::tag('span', Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign']) . ' ' . Yii::t('podium/view', "Sorry! We can not save new forums' order."), ['class' => 'text-danger']); } else { Log::info('Forums orded updated', $moved->id, __METHOD__); return Html::tag('span', Html::tag('span', '', ['class' => 'glyphicon glyphicon-ok-circle']) . ' ' . Yii::t('podium/view', "New forums' order has been saved."), ['class' => 'text-success']); } } catch (Exception $e) { Log::error($e->getMessage(), null, __METHOD__); return Html::tag('span', Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign']) . ' ' . Yii::t('podium/view', "Sorry! We can not save new forums' order."), ['class' => 'text-danger']); } } else { return Html::tag('span', Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign']) . ' ' . Yii::t('podium/view', 'Sorry! We can not find Forum with this ID.'), ['class' => 'text-danger']); } } else { return Html::tag('span', Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign']) . ' ' . Yii::t('podium/view', 'Sorry! Sorting parameters are wrong.'), ['class' => 'text-danger']); } } else { return Html::tag('span', Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign']) . ' ' . Yii::t('podium/view', 'You are not allowed to perform this action.'), ['class' => 'text-danger']); } } else { return $this->redirect(['admin/forums']); } }
/** * Sets new categories order. * @param integer $order new category sorting order number * @return boolean * @throws Exception * @since 0.2 */ public function newOrder($order) { try { $next = 0; $newSort = -1; $query = (new Query())->from(Category::tableName())->where('id != :id')->params([':id' => $this->id])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->indexBy('id'); foreach ($query->each() as $id => $forum) { if ($next == $order) { $newSort = $next; $next++; } Yii::$app->db->createCommand()->update(Category::tableName(), ['sort' => $next], 'id = :id', [':id' => $id])->execute(); $next++; } if ($newSort == -1) { $newSort = $next; } $this->sort = $newSort; if (!$this->save()) { throw new Exception('Categories order saving error'); } Log::info('Categories orded updated', $this->id, __METHOD__); return true; } catch (Exception $e) { Log::error($e->getMessage(), null, __METHOD__); } return false; }
/** * Performs post report sending to moderators. * @param Post $post reported post * @return boolean * @since 0.2 */ public function podiumReport($post = null) { try { if (empty($post)) { throw new Exception('Reported post missing'); } $package = []; $mods = $post->forum->mods; foreach ($mods as $mod) { if ($mod != User::loggedId()) { $package[] = [User::loggedId(), $mod, Yii::t('podium/view', 'Complaint about the post #{id}', ['id' => $post->id]), $this->content . '<hr>' . Html::a(Yii::t('podium/view', 'Direct link to this post'), ['default/show', 'id' => $post->id]) . '<hr>' . '<strong>' . Yii::t('podium/view', 'Post contents') . '</strong><br><div class="blockquote">' . $post->content . '</div>', Message::STATUS_REMOVED, Message::STATUS_NEW, time(), time()]; } } if (empty($package)) { throw new Exception('No one to send report to'); } Yii::$app->db->createCommand()->batchInsert(Message::tableName(), ['sender_id', 'receiver_id', 'topic', 'content', 'sender_status', 'receiver_status', 'created_at', 'updated_at'], array_values($package))->execute(); Cache::getInstance()->delete('user.newmessages'); Log::info('Post reported', $post->id, __METHOD__); return true; } catch (Exception $e) { Log::error($e->getMessage(), null, __METHOD__); } return false; }
/** * Ignoring the user of given ID. * @param integer $id * @return \yii\web\Response */ public function actionIgnore($id = null) { if (!Yii::$app->user->isGuest) { try { $model = User::find()->where(['and', ['id' => (int) $id], ['!=', 'status', User::STATUS_REGISTERED]])->limit(1)->one(); if (empty($model)) { $this->error(Yii::t('podium/flash', 'Sorry! We can not find Member with this ID.')); } elseif ($model->id == User::loggedId()) { $this->error(Yii::t('podium/flash', 'Sorry! You can not ignore your own account.')); } elseif ($model->id == User::ROLE_ADMIN) { $this->error(Yii::t('podium/flash', 'Sorry! You can not ignore Administrator.')); } else { if ($model->isIgnoredBy(User::loggedId())) { Yii::$app->db->createCommand()->delete('{{%podium_user_ignore}}', 'user_id = :uid AND ignored_id = :iid', [':uid' => User::loggedId(), ':iid' => $model->id])->execute(); Log::info('User unignored', !empty($model->id) ? $model->id : '', __METHOD__); $this->success(Yii::t('podium/flash', 'User has been unignored.')); } else { Yii::$app->db->createCommand()->insert('{{%podium_user_ignore}}', ['user_id' => User::loggedId(), 'ignored_id' => $model->id])->execute(); Log::info('User ignored', !empty($model->id) ? $model->id : '', __METHOD__); $this->success(Yii::t('podium/flash', 'User has been ignored.')); } } } catch (Exception $e) { $this->error(Yii::t('podium/flash', 'Sorry! There was some error while performing this action.')); Log::error($e->getMessage(), null, __METHOD__); } } return $this->redirect(['members/index']); }
/** * Prepares notification email. * @param integer $thread */ public static function notify($thread) { if (is_numeric($thread) && $thread > 0) { $forum = Config::getInstance()->get('name'); $email = Content::fill(Content::EMAIL_SUBSCRIPTION); $subs = static::find()->where(['thread_id' => $thread, 'post_seen' => self::POST_SEEN]); foreach ($subs->each() as $sub) { $sub->post_seen = self::POST_NEW; if ($sub->save()) { if ($email !== false && !empty($sub->user->email)) { if (Email::queue($sub->user->email, str_replace('{forum}', $forum, $email->topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['default/last', 'id' => $sub->thread_id], true), Url::to(['default/last', 'id' => $sub->thread_id], true)), $email->content)), $sub->user_id)) { Log::info('Subscription notice link queued', $sub->user_id, __METHOD__); } else { Log::error('Error while queuing subscription notice link', $sub->user_id, __METHOD__); } } else { Log::error('Error while queuing subscription notice link - no email set', $sub->user_id, __METHOD__); } } } } }
/** * Performs thread pin / unpin. * @return boolean * @since 0.2 */ public function podiumPin() { $this->pinned = !$this->pinned; if ($this->save()) { Log::info($this->pinned ? 'Thread pinned' : 'Thread unpinned', $this->id, __METHOD__); return true; } return false; }
/** * Prepares notification email. * @param integer $thread */ public static function notify($thread) { if (is_numeric($thread) && $thread > 0) { $email = Content::find()->where(['name' => 'email-sub'])->limit(1)->one(); if ($email) { $topic = $email->topic; $content = $email->content; } else { $topic = 'New post in subscribed thread at {forum}'; $content = '<p>There has been new post added in the thread you are subscribing. Click the following link to read the thread.</p><p>{link}</p><p>See you soon!<br>{forum}</p>'; } $forum = Config::getInstance()->get('name'); $subs = static::find()->where(['thread_id' => (int) $thread, 'post_seen' => self::POST_SEEN]); foreach ($subs->each() as $sub) { $sub->post_seen = self::POST_NEW; if ($sub->save()) { if (!empty($sub->user->email)) { if (Email::queue($sub->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['default/last', 'id' => $sub->thread_id], true), Url::to(['default/last', 'id' => $sub->thread_id], true)), $content)), $sub->user_id)) { Log::info('Subscription notice link queued', $sub->user_id, __METHOD__); } else { Log::error('Error while queuing subscription notice link', $sub->user_id, __METHOD__); } } else { Log::error('Error while queuing subscription notice link - no email set', $sub->user_id, __METHOD__); } } } } }
/** * Updating the module configuration. * @return string|\yii\web\Response */ public function actionSettings() { $model = new ConfigForm(); $data = Yii::$app->request->post('ConfigForm'); if ($data) { if (User::can(Rbac::PERM_CHANGE_SETTINGS)) { if ($model->update($data)) { Log::info('Settings updated', null, __METHOD__); $this->success(Yii::t('podium/flash', 'Settings have been updated.')); return $this->refresh(); } else { $this->error(Yii::t('podium/flash', "One of the setting's values is too long (255 characters max).")); } } else { $this->error(Yii::t('podium/flash', 'You are not allowed to perform this action.')); } } return $this->render('settings', ['model' => $model]); }
/** * Reporting the post of given category ID, forum ID, thread ID, own ID and slug. * @param integer $cid * @param integer $fid * @param integer $tid * @param integer $pid * @param string $slug * @return string|\yii\web\Response */ public function actionReport($cid = null, $fid = null, $tid = null, $pid = null, $slug = null) { if (!Yii::$app->user->isGuest) { if (!is_numeric($cid) || $cid < 1 || !is_numeric($fid) || $fid < 1 || !is_numeric($tid) || $tid < 1 || !is_numeric($pid) || $pid < 1 || empty($slug)) { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.')); return $this->redirect(['default/index']); } $category = Category::findOne((int) $cid); if (!$category) { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.')); return $this->redirect(['default/index']); } else { $forum = Forum::find()->where(['id' => (int) $fid, 'category_id' => $category->id])->limit(1)->one(); if (!$forum) { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.')); return $this->redirect(['default/index']); } else { $thread = Thread::find()->where(['id' => (int) $tid, 'category_id' => $category->id, 'forum_id' => $forum->id, 'slug' => $slug])->limit(1)->one(); if (!$thread) { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.')); return $this->redirect(['default/index']); } else { $post = Post::find()->where(['id' => (int) $pid, 'forum_id' => $forum->id, 'thread_id' => $thread->id])->limit(1)->one(); if (!$post) { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.')); return $this->redirect(['default/index']); } else { if ($post->author_id == User::loggedId()) { $this->info(Yii::t('podium/flash', 'You can not report your own post. Please contact the administrator or moderators if you have got any concerns regarding your post.')); return $this->redirect(['default/thread', 'cid' => $category->id, 'fid' => $forum->id, 'id' => $thread->id, 'slug' => $thread->slug]); } else { $model = new Message(); $model->setScenario('report'); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { try { $mods = $forum->getMods(); $package = []; foreach ($mods as $mod) { if ($mod != User::loggedId()) { $package[] = ['sender_id' => User::loggedId(), 'receiver_id' => $mod, 'topic' => Yii::t('podium/view', 'Complaint about the post #{id}', ['id' => $post->id]), 'content' => $model->content . '<hr>' . Html::a(Yii::t('podium/view', 'Direct link to this post'), ['default/show', 'id' => $post->id]) . '<hr>' . '<strong>' . Yii::t('podium/view', 'Post contents') . '</strong><br><blockquote>' . $post->content . '</blockquote>', 'sender_status' => Message::STATUS_REMOVED, 'receiver_status' => Message::STATUS_NEW, 'created_at' => time(), 'updated_at' => time()]; } } if (!empty($package)) { Yii::$app->db->createCommand()->batchInsert(Message::tableName(), ['sender_id', 'receiver_id', 'topic', 'content', 'sender_status', 'receiver_status', 'created_at', 'updated_at'], array_values($package))->execute(); Cache::getInstance()->delete('user.newmessages'); Log::info('Post reported', $post->id, __METHOD__); $this->success(Yii::t('podium/flash', 'Thank you for your report. The moderation team will take a look at this post.')); return $this->redirect(['default/thread', 'cid' => $category->id, 'fid' => $forum->id, 'id' => $thread->id, 'slug' => $thread->slug]); } else { $this->warning(Yii::t('podium/flash', 'Apparently there is no one we can send this report to except you and you are already reporting it so...')); } } catch (Exception $e) { Log::error($e->getMessage(), null, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There was an error while notifying the moderation team. Contact administrator about this problem.')); } } } return $this->render('report', ['model' => $model, 'category' => $category, 'forum' => $forum, 'thread' => $thread, 'post' => $post]); } } } } } } else { $this->warning(Yii::t('podium/flash', 'Please sign in to report the post.')); return $this->redirect(['account/login']); } }
/** * Sending the account password reset link. * @return string|\yii\web\Response */ public function actionReset() { if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) { $this->info(Yii::t('podium/flash', 'Please contact the administrator to reset your account password.')); return $this->module->goPodium(); } $model = new ReForm(); if ($model->load(Yii::$app->request->post())) { if ($model->reset()) { $email = Content::find()->where(['name' => 'email-pass'])->limit(1)->one(); if ($email) { $topic = $email->topic; $content = $email->content; } else { $topic = Messages::EMAIL_PASS_TITLE; $content = Messages::EMAIL_PASS_BODY; } $forum = Config::getInstance()->get('name'); if (!empty($model->email)) { if (Email::queue($model->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/password', 'token' => $model->user->password_reset_token], true), Url::to(['account/password', 'token' => $model->user->password_reset_token], true)), $content)), !empty($model->user->id) ? $model->user->id : null)) { Log::info('Password reset link queued', $model->user->id, __METHOD__); $this->success(Yii::t('podium/flash', 'The password reset link has been sent to your e-mail address.')); } else { Log::error('Error while queuing password reset link', $model->user->id, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There was some error while sending you the password reset link. Contact administrator about this problem.')); } } else { Log::error('Error while queuing password reset link - no email set', $model->user->id, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There is no e-mail address saved with your account. Contact administrator about resetting password.')); } return $this->module->goPodium(); } else { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the account with that user name or e-mail address.')); } } return $this->render('reset', ['model' => $model]); }
/** * Updating the forum details. * @return string|\yii\web\Response */ public function actionForum() { $model = Meta::find()->where(['user_id' => User::loggedId()])->limit(1)->one(); if (empty($model)) { $model = new Meta(); } if ($model->load(Yii::$app->request->post())) { $model->user_id = User::loggedId(); $uploadAvatar = false; $path = Yii::getAlias('@webroot/avatars'); $avatar = UploadedFile::getInstance($model, 'image'); if ($avatar) { $folderExists = true; if (!file_exists($path)) { if (!FileHelper::createDirectory($path)) { $folderExists = false; Log::error('Error while creating avatars folder', null, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There was an error while creating the avatars folder. Contact administrator about this problem.')); } } if ($folderExists) { if (!empty($model->avatar)) { if (!unlink($path . DIRECTORY_SEPARATOR . $model->avatar)) { Log::error('Error while deleting old avatar image', null, __METHOD__); } } $model->avatar = Yii::$app->security->generateRandomString() . '.' . $avatar->getExtension(); $uploadAvatar = true; } } if ($model->save()) { if ($uploadAvatar) { if (!$avatar->saveAs($path . DIRECTORY_SEPARATOR . $model->avatar)) { Log::error('Error while saving avatar image', null, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There was an error while uploading the avatar image. Contact administrator about this problem.')); } } Log::info('Profile updated', $model->id, __METHOD__); $this->success(Yii::t('podium/flash', 'Your profile details have been updated.')); return $this->refresh(); } else { $model->current_password = null; } } return $this->render('forum', ['model' => $model, 'user' => User::findMe()]); }
/** * Sending the account password reset link. * @return string|\yii\web\Response */ public function actionReset() { if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) { $this->info(Yii::t('podium/flash', 'Please contact the administrator to reset your account password.')); return $this->module->goPodium(); } $model = new ReForm(); if ($model->load(Yii::$app->request->post())) { if ($model->reset()) { $email = Content::find()->where(['name' => 'email-pass'])->limit(1)->one(); if ($email) { $topic = $email->topic; $content = $email->content; } else { $topic = '{forum} password reset link'; $content = '<p>{forum} Password Reset</p><p>You are receiving this e-mail because someone has started the process of changing the account password at {forum}.<br>If this person is you open the following link in your Internet browser and follow the instructions on screen.</p><p>{link}</p><p>If it was not you just ignore this e-mail.</p><p>Thank you!<br>{forum}</p>'; } $forum = Config::getInstance()->get('name'); if (!empty($model->email)) { if (Email::queue($model->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/password', 'token' => $model->user->password_reset_token], true), Url::to(['account/password', 'token' => $model->user->password_reset_token], true)), $content)), !empty($model->user->id) ? $model->user->id : null)) { Log::info('Password reset link queued', $model->user->id, __METHOD__); $this->success(Yii::t('podium/flash', 'The password reset link has been sent to your e-mail address.')); } else { Log::error('Error while queuing password reset link', $model->user->id, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There was some error while sending you the password reset link. Contact administrator about this problem.')); } } else { Log::error('Error while queuing password reset link - no email set', $model->user->id, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There is no e-mail address saved with your account. Contact administrator about resetting password.')); } return $this->module->goPodium(); } else { $this->error(Yii::t('podium/flash', 'Sorry! We can not find the account with that user name or e-mail address.')); } } return $this->render('reset', ['model' => $model]); }