dyndns/app/Component/Config/File.php

30 lines
737 B
PHP
Raw Permalink Normal View History

2019-08-10 14:34:53 +00:00
<?php
namespace App\Component\Config;
class File implements \App\Component\Config\IConfig
{
/*
* config from file
*/
private $config;
public function __construct()
{
$this->config = json_decode(file_get_contents(storage_path(getenv("DYNDNS_CONFIG_FILE"))), true);
}
public function validateUser($username, $password, $domain) : bool
{
foreach ($this->config["accounts"] as $account) {
if($account["username"] == $username) {
if($account["password"] == $password) {
if($account["domain"] == $domain) {
return true;
}
}
}
}
return false;
}
}