Browse Source

Auth service fix

master
Egorka 6 years ago
parent
commit
f9b833ac36
  1. 6
      backend/controllers/AuthController.php

6
backend/controllers/AuthController.php

@ -13,12 +13,12 @@ use DomainException;
class AuthController extends Controller class AuthController extends Controller
{ {
private $_auth_service; private $auth_service;
public function __construct($id, $module, AuthService $service, $config = []) public function __construct($id, $module, AuthService $service, $config = [])
{ {
parent::__construct($id, $module, $config); parent::__construct($id, $module, $config);
$this->_auth_service = $service; $this->auth_service = $service;
} }
/** /**
@ -69,7 +69,7 @@ class AuthController extends Controller
$form = new LoginForm(); $form = new LoginForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) { if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try { try {
$user = $this->_auth_service->auth($form); $user = $this->auth_service->auth($form);
Yii::$app->user->login(new Identity($user), $form->rememberMe ? 3600 * 24 * 30 : 0); Yii::$app->user->login(new Identity($user), $form->rememberMe ? 3600 * 24 * 30 : 0);
return $this->goBack(); return $this->goBack();

Loading…
Cancel
Save