Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| SSO_AJAX_Handler | |
0.00% |
0 / 11 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| login | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| legacyLogin | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace NewfoldLabs\WP\Module\SSO; |
| 4 | |
| 5 | class SSO_AJAX_Handler { |
| 6 | |
| 7 | /** |
| 8 | * Set up AJAX handlers. |
| 9 | */ |
| 10 | public function __construct() { |
| 11 | |
| 12 | $actions = [ |
| 13 | SSO_Helpers::ACTION => 'login', |
| 14 | SSO_Helpers_Legacy::ACTION => 'legacyLogin', |
| 15 | ]; |
| 16 | |
| 17 | foreach ( $actions as $action => $methodName ) { |
| 18 | add_action( "wp_ajax_{$action}", [ $this, $methodName ] ); |
| 19 | add_action( "wp_ajax_nopriv_{$action}", [ $this, $methodName ] ); |
| 20 | } |
| 21 | |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Handle SSO login attempts. |
| 26 | */ |
| 27 | public function login() { |
| 28 | SSO_Helpers::handleLogin( htmlspecialchars( strip_tags( filter_input( INPUT_GET, 'token' ) ) ) ); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Handle legacy SSO login attempts. |
| 33 | */ |
| 34 | public function legacyLogin() { |
| 35 | |
| 36 | $nonce = htmlspecialchars( strip_tags( filter_input( INPUT_GET, 'nonce' ) ) ); |
| 37 | $salt = htmlspecialchars( strip_tags( filter_input( INPUT_GET, 'salt' ) ) ); |
| 38 | |
| 39 | SSO_Helpers_Legacy::handleLegacyLogin( $nonce, $salt ); |
| 40 | } |
| 41 | |
| 42 | } |