public function actionDetails()
    {
        $model = User::findMe();
        if (empty($model)) {
            return $this->redirect(['account/login']);
        }

        $model->scenario = Podium::getInstance()->userComponent !== true ? 'accountInherit' : 'account';
        $model->currentPassword = null;
        $previous_new_email = $model->new_email;
        if (empty($model->username)) {
            $model->username = 'user_' . $model->id;
        }

        if ($model->load(Yii::$app->request->post())) {
            if ($model->validate()) {
                if ($model->saveChanges()) {
                    if ($previous_new_email != $model->new_email) {
                        $forum = $this->module->podiumConfig->get('name');
                        $email = Content::fill(Content::EMAIL_NEW);
                        if ($email !== false && Email::queue(
                                $model->new_email,
                                str_replace('{forum}', $forum, $email->topic),
                                str_replace('{forum}', $forum, str_replace('{link}', Html::a(
                                        Url::to(['account/new-email', 'token' => $model->email_token], true),
                                        Url::to(['account/new-email', 'token' => $model->email_token], true)
                                    ), $email->content)),
                                !empty($model->id) ? $model->id : null
                            )) {
                            Log::info('New email activation link queued', $model->id, __METHOD__);
                            $this->success(Yii::t('podium/flash', 'Your account has been updated but your new e-mail address is not active yet. Click the activation link that will be sent to your new e-mail address in few minutes.'));
                        } else {
                            Log::error('Error while queuing new email activation link', $model->id, __METHOD__);
                            $this->warning(Yii::t('podium/flash', 'Your account has been updated but your new e-mail address is not active yet. Unfortunately there was some error while sending you the activation link. Contact administrator about this problem.'));
                        }
                    } else {
                        Log::info('Details updated', $model->id, __METHOD__);
                        $this->success(Yii::t('podium/flash', 'Your account has been updated.'));
                    }
                    return $this->refresh();
                }
            }
        }
        $model->currentPassword = null;
        return $this->render('details', ['model' => $model]);
    }