/** * Changing the account password with provided token. * @param string $token * @return string|\yii\web\Response */ public function actionPassword($token) { if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) { $this->info(Yii::t('podium/flash', 'Please contact the administrator to change your account password.')); return $this->module->goPodium(); } $model = User::findByPasswordResetToken($token); if ($model) { $model->setScenario('passwordChange'); if ($model->load(Yii::$app->request->post()) && $model->changePassword()) { Log::info('Password changed', $model->id, __METHOD__); $this->success(Yii::t('podium/flash', 'Your account password has been changed.')); return $this->module->goPodium(); } else { return $this->render('password', ['model' => $model]); } } else { $this->error(Yii::t('podium/flash', 'The provided password reset token is invalid or expired.')); return $this->module->goPodium(); } }
/** * Changing the account password with provided token. * @param string $token * @return string|\yii\web\Response */ public function actionPassword($token) { $model = User::findByPasswordResetToken($token); if ($model) { $model->setScenario('passwordChange'); if ($model->load(Yii::$app->request->post()) && $model->changePassword()) { Log::info('Password changed', !empty($model->id) ? $model->id : '', __METHOD__); $this->success('Your account password has been changed.'); return $this->module->goPodium(); } else { return $this->render('password', ['model' => $model]); } } else { $this->error('The provided password reset token is invalid or expired.'); return $this->module->goPodium(); } }