Skip to content

Commit

Permalink
Ensure there are no blank spaces or line breaks around the token
Browse files Browse the repository at this point in the history
Fixes #379.
  • Loading branch information
kasparsd committed Aug 26, 2020
1 parent ad02052 commit b68de52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion providers/class-two-factor-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ public function validate_authentication( $user ) {
return false;
}

return $this->validate_token( $user->ID, $_REQUEST['two-factor-email-code'] );
// Ensure there are no spaces or line breaks around the code.
$code = trim( sanitize_text_field( $_REQUEST['two-factor-email-code'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, handled by the core method already.

return $this->validate_token( $user->ID, $code );
}

/**
Expand Down

0 comments on commit b68de52

Please sign in to comment.