Commit 6cac7c61 by Alexander Makarov

Removed Yii::$app->getParam usage

parent 97917e65
......@@ -2,4 +2,5 @@
return [
'adminEmail' => 'admin@example.com',
'supportEmail' => 'support@example.com',
'user.passwordResetTokenExpire' => 3600,
];
......@@ -82,7 +82,7 @@ class User extends ActiveRecord implements IdentityInterface
*/
public static function findByPasswordResetToken($token)
{
$expire = \Yii::$app->getParam('user.passwordResetTokenExpire', 3600);
$expire = \Yii::$app->params['user.passwordResetTokenExpire'];
$parts = explode('_', $token);
$timestamp = (int)end($parts);
if ($timestamp + $expire < time()) {
......
......@@ -87,7 +87,7 @@ class SiteController extends Controller
public function actionContact()
{
$model = new ContactForm;
if ($model->load($_POST) && $model->contact(Yii::$app->getParam('adminEmail'))) {
if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
return $this->refresh();
} else {
......
......@@ -43,7 +43,7 @@ class PasswordResetRequestForm extends Model
$user->generatePasswordResetToken();
if ($user->save()) {
return \Yii::$app->mail->compose('passwordResetToken', ['user' => $user])
->setFrom([\Yii::$app->getParam('supportEmail') => \Yii::$app->name . ' robot'])
->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])
->setTo($this->email)
->setSubject('Password reset for ' . \Yii::$app->name)
->send();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment