Skip to content

Commit

Permalink
Add test for FFCNR authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetrakern committed Feb 3, 2025
1 parent 9e4b409 commit 6208455
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 161 deletions.
2 changes: 1 addition & 1 deletion css/settings.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions includes/functions/requests/_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,7 @@ function ffcnr_load_child_theme_functions() {
if ( $action === 'auth' ) {
require_once __DIR__ . '/_auth.php';
}

if ( $action === 'test' ) {
require_once __DIR__ . '/_test.php';
}
19 changes: 19 additions & 0 deletions includes/functions/requests/_test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

// No direct access!
defined( 'ABSPATH' ) OR exit;

// Try to get current user
$user = ffcnr_get_current_user();

// Report
header( 'Content-Type: text/html; charset=utf-8' );
header( 'HTTP/1.1 200 OK' );

if ( $user === 0 ) {
echo 'FFCNR is not working for unknown, turn it off or try to fix it.';
} else {
echo 'FFCNR is working, all good.';
}

exit;
1 change: 1 addition & 0 deletions includes/functions/settings/_settings_page_general.php
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,7 @@
)
);
?>
<p class="inset-paragraph"><a href="<?php echo fictioneer_get_ffcnr_url(); ?>?action=test" target="_blank" rel="noopener"><?php _e( 'Test FFCNR authentication', 'fictioneer' ); ?></a></p>
</div>

<div class="fictioneer-card__row">
Expand Down
Loading

0 comments on commit 6208455

Please sign in to comment.