Commit 6cac7c61 by Alexander Makarov

Removed Yii::$app->getParam usage

parent 97917e65
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
return [ return [
'adminEmail' => 'admin@example.com', 'adminEmail' => 'admin@example.com',
'supportEmail' => 'support@example.com', 'supportEmail' => 'support@example.com',
'user.passwordResetTokenExpire' => 3600,
]; ];
...@@ -82,7 +82,7 @@ class User extends ActiveRecord implements IdentityInterface ...@@ -82,7 +82,7 @@ class User extends ActiveRecord implements IdentityInterface
*/ */
public static function findByPasswordResetToken($token) public static function findByPasswordResetToken($token)
{ {
$expire = \Yii::$app->getParam('user.passwordResetTokenExpire', 3600); $expire = \Yii::$app->params['user.passwordResetTokenExpire'];
$parts = explode('_', $token); $parts = explode('_', $token);
$timestamp = (int)end($parts); $timestamp = (int)end($parts);
if ($timestamp + $expire < time()) { if ($timestamp + $expire < time()) {
......
...@@ -87,7 +87,7 @@ class SiteController extends Controller ...@@ -87,7 +87,7 @@ class SiteController extends Controller
public function actionContact() public function actionContact()
{ {
$model = new ContactForm; $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.'); Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
return $this->refresh(); return $this->refresh();
} else { } else {
......
...@@ -43,7 +43,7 @@ class PasswordResetRequestForm extends Model ...@@ -43,7 +43,7 @@ class PasswordResetRequestForm extends Model
$user->generatePasswordResetToken(); $user->generatePasswordResetToken();
if ($user->save()) { if ($user->save()) {
return \Yii::$app->mail->compose('passwordResetToken', ['user' => $user]) 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) ->setTo($this->email)
->setSubject('Password reset for ' . \Yii::$app->name) ->setSubject('Password reset for ' . \Yii::$app->name)
->send(); ->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