Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Julian45123

    (@julian45123)

    My code right now is like that:

    function myExlogHashAuthenticator($password, $hashFromDatabase, $username, $externalUserData) {
    	error_log('EXLOG Empieza el hook');
    	$hashedPassword = strtoupper(md5($password));
    	$staticKey = 'houdini';
    	
    	error_log('EXLOG Hashed pwd');
    	error_log(var_export($hashedPassword, true));
    	$flashClientHash = getLoginHash($hashedPassword, $staticKey);
    	error_log('EXLOG FLASH');
        error_log(var_export($flashClientHash, true));
    	$datbasePassword = password_hash($flashClientHash, PASSWORD_DEFAULT, [ 'cost' => 12 ]);
    	error_log('EXLOG $datbasePassword');
        error_log(var_export($datbasePassword, true));
    
    	echo "\n\r\n\r -> " . $datbasePassword . " <- \n\r\n\r";
    
    	function encryptPassword($password, $md5 = true) {
    		if($md5 !== false) {
    			$password = md5($password);
    		}
        
    		$hash = substr($password, 16, 16) . substr($password, 0, 16);
    		return $hash;
    	}
    	error_log('EXLOG password md5');
        error_log(var_export($password, true));
    	function getLoginHash($password, $staticKey) {        
    		$hash = encryptPassword($password, false);
    		$hash .= $staticKey;
    		$hash .= 'Y(02.>\'H}t":E1';
    		$hash = encryptPassword($hash);
        
    		return $hash;
    	}
    	error_log('EXLOG Comparison Values?');
        error_log(var_export($hash, true));
        error_log(var_export($hashFromDatabase, true));
        
        error_log('EXLOG VALID PASSWORD?');
        error_log(var_export($hash == $hashFromDatabase, true));
    
        error_log('EXLOG END >>>>>>>>>>>>>>>>>>>');
    	return $hash == $hashFromDatabase;	
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'myExlogHashAuthenticator', 10, 4);

    This error logs are supposed to appear wp-content/debug.log or in any other file? This is the debug options I have in wp_config.php:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );

    Thanks for your help.

    Thread Starter Julian45123

    (@julian45123)

    I also updated the code to this:

    function myExlogHashAuthenticator($password, $hashFromDatabase, $username, $externalUserData) {
    
    	$hashedPassword = strtoupper(md5($password));
    	$staticKey = 'houdini';
    
    	$flashClientHash = getLoginHash($hashedPassword, $staticKey);
    	$datbasePassword = password_hash($flashClientHash, PASSWORD_DEFAULT, [ 'cost' => 12 ]);
    
    	echo "\n\r\n\r -> " . $datbasePassword . " <- \n\r\n\r";
    
    	function encryptPassword($password, $md5 = true) {
    		if($md5 !== false) {
    			$password = md5($password);
    		}
        
    		$hash = substr($password, 16, 16) . substr($password, 0, 16);
    		return $hash;
    	}
    	function getLoginHash($password, $staticKey) {        
    		$hash = encryptPassword($password, false);
    		$hash .= $staticKey;
    		$hash .= 'Y(02.>\'H}t":E1';
    		$hash = encryptPassword($hash);
        
    		return $hash == $hashFromDatabase;
    	}
    	
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'myExlogHashAuthenticator', 10, 4);

    But still doesn’t work.

    Thread Starter Julian45123

    (@julian45123)

    Hi again,
    Thanks your keep helping me! I checked error.log and I have this code:`

    2020/04/18 16:19:33 [error] 27699#27699: *5903 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: role in /var/www/community/wp-content/plugins/external-login/login/authenticate.php on line 13
    PHP message: PHP Notice:  Undefined index: exlog_authenticated in /var/www/community/wp-content/plugins/external-login/login/authenticate.php on line 30
    PHP message: PHP Warning:  pg_query(): No PostgreSQL link opened yet in /var/www/community/wp-content/pg4wp/driver_pgsql.php on line 139
    PHP message: PHP Warning:  pg_last_error(): No PostgreSQL link opened yet in /var/www/community/wp-content/pg4wp/driver_pgsql.php on line 140
    PHP message: PHP Warning:  pg_last_error(): No PostgreSQL link opened yet in /var/www/community/wp-content/pg4wp/driver_pgsql.php on line 55" while reading response header from upstream, client: IP, server: MYWORDPRESSLINK, request: "POST /wp-login.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "MYWPLINK", referrer: "WPLINK/wp-login.php"
    2020/04/18 16:19:33 [error] 27699#27699: *5903 FastCGI sent in stderr: "PHP message: PHP Warning:  pg_query(): No PostgreSQL link opened yet in /var/www/community/wp-content/pg4wp/driver_pgsql.php on line 139

    Do you know what could be? Also, how do I check that the hook is on and working?
    Thanks.

    Thread Starter Julian45123

    (@julian45123)

    Hey @tbenyon,
    Thanks for your answers. I’ve developed this code:

    function myExlogHashAuthenticator($password, $hashFromDatabase, $username, $externalUserData) {
    
    	$hashedPassword = strtoupper(md5($password));
    	$staticKey = 'houdini';
    
    	$flashClientHash = getLoginHash($hashedPassword, $staticKey);
    	$datbasePassword = password_hash($flashClientHash, PASSWORD_DEFAULT, [ 'cost' => 12 ]);
    
    	echo "\n\r\n\r -> " . $datbasePassword . " <- \n\r\n\r";
    
        $password = md5($password);
        
        $hash = substr($password, 16, 16) . substr($password, 0, 16);
    
        $hash = encryptPassword($password, false);
        $hash .= $staticKey;
        $hash .= 'Y(02.>\'H}t":E1';
        $hash = encryptPassword($hash);
        
        return $hash == $hashFromDatabase;
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'myExlogHashAuthenticator', 10, 4);

    I’ve placed the code in my theme’s functions.php and it says invalid username and password. Can you help me? Do you see any error on the code?

    Thanks again,
    Julian.

    • This reply was modified 4 years, 11 months ago by Julian45123.
    Thread Starter Julian45123

    (@julian45123)

    Also, the passwords from the external database are generated as explained here: https://solero.github.io/password. Thanks again!

    • This reply was modified 4 years, 11 months ago by Julian45123.
    Thread Starter Julian45123

    (@julian45123)

    Okay, and what I have to set so its exactly like Nisarg?
    Thanks.

    Thread Starter Julian45123

    (@julian45123)

    Hi!
    Yes! Now I can comment on the pages.
    Thanks!!!

    Thread Starter Julian45123

    (@julian45123)

    Thread Starter Julian45123

    (@julian45123)

    Hello,
    Now I’m in a laptop. I do it Screenshot. But in the page there isn’t the comment form Screenschot.
    Thanks.

    Thread Starter Julian45123

    (@julian45123)

    Hello,
    I can’t see it. Screenshot
    Thanks.

    Thread Starter Julian45123

    (@julian45123)

    Hello daftduke,
    I’m at the phone but I don’t have the option Discussion on the page. I have allow the Allow People to Post Comments on New Articles’.
    See this Screenshots of a page: S1 y S2.
    Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)