bug fixing
This commit is contained in:
parent
e6f8660d78
commit
6cd7af5fd0
@ -18,23 +18,12 @@ use yii\web\UnauthorizedHttpException;
|
|||||||
|
|
||||||
/** @noinspection PhpUnused */
|
/** @noinspection PhpUnused */
|
||||||
|
|
||||||
class LoginController extends Controller
|
class LoginController extends RestController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function behaviors()
|
protected function getOptionalActions()
|
||||||
{
|
{
|
||||||
$behaviors = parent::behaviors();
|
return ['login'];
|
||||||
|
|
||||||
$behaviors['corsFilter'] = [
|
|
||||||
'class' => CorsCustom::class,
|
|
||||||
'cors' => [
|
|
||||||
// restrict access to
|
|
||||||
'Origin' => ['https://botondfitness.hu'],
|
|
||||||
// Allow credentials (cookies, authorization headers, etc.) to be exposed to the browser
|
|
||||||
'Access-Control-Allow-Credentials' => true,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
return $behaviors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,26 +20,11 @@ class RestController extends Controller
|
|||||||
{
|
{
|
||||||
$behaviors = parent::behaviors();
|
$behaviors = parent::behaviors();
|
||||||
|
|
||||||
$auth = $behaviors['authenticator'];
|
|
||||||
unset($behaviors['authenticator']);
|
|
||||||
|
|
||||||
$behaviors['corsFilter'] = [
|
|
||||||
'class' => Cors::class,
|
|
||||||
'cors' => [
|
|
||||||
'Origin' => ['https://botondfitness.hu'],
|
|
||||||
'Access-Control-Request-Method' => ['POST', 'GET', 'OPTIONS'],
|
|
||||||
'Access-Control-Allow-Headers' => ['*'],
|
|
||||||
'Access-Control-Expose-Headers' => ['*']
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$behaviors['authenticator'] = $auth;
|
|
||||||
$behaviors['authenticator'] = [
|
$behaviors['authenticator'] = [
|
||||||
'class' => JwtHttpBearerAuth::class,
|
'class' => JwtHttpBearerAuth::class,
|
||||||
'auth' => [$this, 'auth'],
|
'auth' => [$this, 'auth'],
|
||||||
'optional' => $this->getOptionalActions(),
|
'optional' => $this->getOptionalActions(),
|
||||||
];
|
];
|
||||||
$behaviors['authenticator']['except'] = ['options'];
|
|
||||||
|
|
||||||
return $behaviors;
|
return $behaviors;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user