• Resolved wesbeyrent

    (@wesbeyrent)


    I’d like to be able to prepopulate the password input field via a querystring parameter, so that I can provide a link to my website that includes the password.

    Alternatively, if I can bypass the password page by providing the password in a URL, what would be the best way to accomplish this?

    I understand the security concerns by implementing this, but securing my site is not that important to begin with.

    Thanks!

    https://www.ads-software.com/extend/plugins/password-protected/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I don;t intend to build that into the plugin by default, but using the existing hooks in the plugin it should be possible to bypass it by adding code to your functions.php file.

    I’ve not tried this, but something like this might work:

    function my_option_password_protected_status( $option ) {
    	global $Password_Protected;
    
    	//If the URl contains the query "?bypass=true"
    	if ( isset( $_GET['bypass'] ) && $_GET['bypass'] == 'true' ) {
    		// Set the cookie to say we're logged in
    		$Password_Protected->set_auth_cookie();
    		return false;
    	}
    	return $option;
    }
    add_filter( 'option_password_protected_status', 'my_option_password_protected_status' );
    Thread Starter wesbeyrent

    (@wesbeyrent)

    Thank you, Ben. It works perfectly.

    I will work on adding the ability to simply prepopulate the password textfield with a query string parameter and post back to this thread if I have any issues.

    If I can get that working, I’ll consider my question 100% resolved.

    Thanks again!

    There’s no hook to do it with PHP at present so you’d have to add it via JavaScript.

    Thread Starter wesbeyrent

    (@wesbeyrent)

    That’s what I thought. Thanks for the bypass help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pass password via querystring parameter’ is closed to new replies.