Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings validation to import #777

Merged
merged 4 commits into from
Feb 6, 2020

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Feb 3, 2020

Description

  • Add validation to imported settings JSON
  • Change the following validation methods to accept only the new options array as a first parameter; existing saved options values are used as fallbacks:
    • WP_Auth0_Admin_Advanced->basic_validation()
    • WP_Auth0_Admin_Advanced->migration_ws_validation()
    • WP_Auth0_Admin_Advanced->migration_ips_validation()
    • WP_Auth0_Admin_Appearance->basic_validation()
    • WP_Auth0_Admin_Basic->basic_validation()
    • WP_Auth0_Admin_Features->basic_validation()
  • Rename WP_Auth0_Admin_Advanced::loginredirection_validation() to WP_Auth0_Admin_Advanced->validate_login_redirect() and changed the signature to accept the new and previous values instead of arrays.

Note to reviewers: vast majority of the changes here are renaming and changing the method signatures.

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@joshcanhelp joshcanhelp force-pushed the add-settings-validation-to-import branch 2 times, most recently from 83a29ab to 0216fd4 Compare February 3, 2020 22:57
@@ -73,7 +73,9 @@ public function init_admin() {
register_setting(
$this->a0_options->get_options_name() . '_basic',
$this->a0_options->get_options_name(),
[ $this, 'input_validator' ]
[
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third argument as a callable was a backwards-compatible change. Now accepts an array:

https://developer.wordpress.org/reference/functions/register_setting/

@joshcanhelp joshcanhelp force-pushed the add-settings-validation-to-import branch 2 times, most recently from 1afee68 to 2a9117d Compare February 4, 2020 00:55
@joshcanhelp joshcanhelp force-pushed the add-settings-validation-to-import branch from 2a9117d to 2142081 Compare February 4, 2020 01:06
@joshcanhelp joshcanhelp added this to the 4.0.0 milestone Feb 4, 2020
@joshcanhelp joshcanhelp marked this pull request as ready for review February 4, 2020 01:19
@joshcanhelp joshcanhelp requested a review from a team February 4, 2020 01:19
@jimmyjames jimmyjames requested review from jimmyjames and removed request for a team February 6, 2020 17:38
@joshcanhelp joshcanhelp merged commit 33ad34d into master Feb 6, 2020
@joshcanhelp joshcanhelp deleted the add-settings-validation-to-import branch February 6, 2020 20:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants