/** * Activating the account based on the provided activation token. * @param string $token * @return \yii\web\Response */ public function actionActivate($token) { $model = User::findByActivationToken($token); if ($model) { $model->setScenario('token'); if ($model->activate()) { Cache::clearAfterActivate(); Log::info('Account activated', !empty($model->id) ? $model->id : '', __METHOD__); $this->success('Your account has been activated. You can sign in now.'); } else { Log::error('Error while activating account', !empty($model->id) ? $model->id : '', __METHOD__); $this->error('Sorry! There was some error while activating your account. Contact administrator about this problem.'); } return $this->module->goPodium(); } else { $this->error('The provided activation token is invalid or expired.'); return $this->module->goPodium(); } }
/** * Activating the account based on the provided activation token. * @param string $token * @return \yii\web\Response */ public function actionActivate($token) { if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) { $this->info(Yii::t('podium/flash', 'Please contact the administrator to activate your account.')); return $this->module->goPodium(); } $model = User::findByActivationToken($token); if (empty($model)) { $this->error(Yii::t('podium/flash', 'The provided activation token is invalid or expired.')); return $this->module->goPodium(); } $model->scenario = 'token'; if ($model->activate()) { Cache::clearAfter('activate'); Log::info('Account activated', $model->id, __METHOD__); $this->success(Yii::t('podium/flash', 'Your account has been activated. You can sign in now.')); } else { Log::error('Error while activating account', $model->id, __METHOD__); $this->error(Yii::t('podium/flash', 'Sorry! There was some error while activating your account. Contact administrator about this problem.')); } return $this->module->goPodium(); }