_setPasswordSalt(); } public static function getInstance() { $className = get_called_class(); if( self::$_instance == null ) { self::$_instance = new $className(); } return self::$_instance; } public function auth( $login, $password ) { // TODO: Implement auth($username, $password) method. $this->_setPassword($password); $this->_setUsername($login); if(!array_key_exists('auth', $_SESSION)) { $user_password = Pdo::query("SELECT DES_DECRYPT(user_pass, '".Config::getInstance()->getConfig()["SECURITY"]["password_hash"]."') AS pass FROM user WHERE user_login = '".$login."';"); if( $user_password["pass"] == $password ) { $_SESSION['auth']['login'] = $login; return true; } else { return false; } } } /** * @return string */ protected function getPasswordSalt() { return $this->_password_salt; } /** * @param string $password_salt */ private function _setPasswordSalt( ) { $this->_password_salt = $this->getConfig()[self::NIBIRU_SECURITY]; } /** * @return string */ protected function getUsername() { return $this->_username; } /** * @param string $username */ private function _setUsername( $username ) { $this->_username = $username; } /** * @return string */ protected function getPassword() { return $this->_password; } /** * @param string $password */ private function _setPassword( $password ) { $this->_password = $password; } }