WordPress.org

Ready to get started?Download WordPress

Forums

Remove Dashboard Access
Only works on FQDNs (4 posts)

1 star
  1. Matt Lowe
    Member
    Posted 9 months ago #

    elseif ( ! preg_match( '|^\S+://\S+\.\S+.+$|', $options['redirect_url'] ) )

    That is far from sufficient as a URL regex. Consider, for example, the URL http://localhost/~squelch which is perfectly valid. As a developer I need to test things before they go live.

    It's a shame as this looks like it could be a good solution. If/when this gets fixed I'll be more than happy to revise my rating.

  2. Drew Jaynes (DrewAPicture)
    Volunteer Moderator
    Plugin Author

    Posted 9 months ago #

    Hi Matt,

    I agree with you on the regex. In fact, looking back at it, I'm not really sure why I added it in.

    I'm thinking it was because I managed to lock myself out of the Dashboard while testing it because of a poorly-formed URL. The only way to remedy that, of course, was to force loggedout=true and/or delete the cookie for the test user.

    So in short, the regex will be going away in the next version — 1.3 — which should be out soon. I'm just wrapping up a couple of other requested features. I'll post back here when that's released.

  3. Matt Lowe
    Member
    Posted 9 months ago #

    Nice one, I look forward to seeing the new version! And apologies for the somewhat confrontational tone, I was having a REALLY bad day!

  4. Drew Jaynes (DrewAPicture)
    Volunteer Moderator
    Plugin Author

    Posted 9 months ago #

    We all have them, no worries. I'd forgotten what it's like to test on localhost without mapped domains. For instance, I test on localhost trunk and latest builds mapped to URLs like trunk.dev and 35.dev ;)

    I'll probably just simplify sans regex:

    $redirect_url = empty( $options['redirect_url'] ) ? home_url() : esc_url_raw( $options['redirect_url'] );
    $options['redirect_url'] = $redirect_url;

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.