Jump to content

Debugging external login handler


PlatonicMushroom

Recommended Posts

Posted

Currently I am trying to create a login handler using external database, the problem I am running into is that the username is the salt to the password hash.
so the encryptedPassword function needs to also get the username.

I'm trying to achieve this by adding the auth value field (read online this was the right value to pass).

Currently I am unable to execute print_r or echo functions so I could better analyze which values are set.
Does anyone know how I could easily output debug information?
 

/* If the password doesn't match, throw an exception */
		if ( !\IPS\Login::compareHashes( $this->encryptedPassword( $values['password'], $values['auth'] ), $result[ $this->settings['db_col_pass'] ] ) )
		{
			throw new \IPS\Login\Exception( 'login_err_bad_password', \IPS\Login\Exception::BAD_PASSWORD, NULL, $member );
		}

 

my modifications to encryptedPassword function.

	protected function encryptedPassword( $password, $username = null )
	{
		switch ( $this->settings['db_encryption'] )
		{
			case 'md5':
				return md5( $password );
				
			case 'sha1':
				return sha1( $password );
				
			case 'central':
				return md5( strtoupper( $username ) . strtoupper( $password ) );
			
			default:
				return $password;
		}
	}

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...