mirror of
https://github.com/openvk/chandler.git
synced 2024-11-14 19:19:11 +03:00
UA and IP checks can now be disabled via extendedValidation option
This commit is contained in:
parent
60bbd5b8b5
commit
586aa99cd6
2 changed files with 10 additions and 1 deletions
|
@ -20,4 +20,5 @@ chandler:
|
|||
security:
|
||||
secret: ""
|
||||
csrfProtection: "permissive"
|
||||
extendedValidation: false
|
||||
sessionDuration: 14
|
||||
|
|
|
@ -27,6 +27,7 @@ class Authenticator
|
|||
->table("ChandlerTokens")
|
||||
->where($data)
|
||||
->fetch();
|
||||
|
||||
if(!$token) {
|
||||
$this->db->table("ChandlerTokens")->insert($data);
|
||||
$token = $this->db->table("ChandlerTokens")->where($data)->fetch();
|
||||
|
@ -68,9 +69,16 @@ class Authenticator
|
|||
"token" => $token,
|
||||
])
|
||||
->fetch();
|
||||
|
||||
if(!$token) return null;
|
||||
|
||||
if($token->ip === CONNECTING_IP && $token->ua === $_SERVER["HTTP_USER_AGENT"]) {
|
||||
$checksPassed = false;
|
||||
if(CHANDLER_ROOT_CONF["security"]["extendedValidation"])
|
||||
$checksPassed = $token->ip === CONNECTING_IP && $token->ua === $_SERVER["HTTP_USER_AGENT"];
|
||||
else
|
||||
$checksPassed = true;
|
||||
|
||||
if($checksPassed) {
|
||||
$su = $this->session->get("_su");
|
||||
$user = $this->db->table("ChandlerUsers")->get($su ?? $token->user);
|
||||
if(!$user) return null;
|
||||
|
|
Loading…
Reference in a new issue