Code Duplication    Length = 8-9 lines in 2 locations

modules/sso.php 2 locations

@@ 368-376 (lines=9) @@
365
			} else {
366
				if ( Jetpack::is_staging_site() ) {
367
					add_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'sso_not_allowed_in_staging' ) );
368
				} else {
369
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
370
					add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
371
					$reauth = ! empty( $_GET['force_reauth'] );
372
					$sso_url = $this->get_sso_url_or_die( $reauth );
373
					JetpackTracking::record_user_event( 'sso_login_redirect_success' );
374
					wp_safe_redirect( $sso_url );
375
					exit;
376
				}
377
			}
378
		} else if ( Jetpack_SSO_Helpers::display_sso_form_for_action( $action ) ) {
379
@@ 388-395 (lines=8) @@
385
			 * to the WordPress.com login page AND  that the request to wp-login.php
386
			 * is not something other than login (Like logout!)
387
			 */
388
			if ( Jetpack_SSO_Helpers::bypass_login_forward_wpcom() && $this->wants_to_login() ) {
389
				add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
390
				$reauth = ! empty( $_GET['force_reauth'] );
391
				$sso_url = $this->get_sso_url_or_die( $reauth );
392
				JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' );
393
				wp_safe_redirect( $sso_url );
394
				exit;
395
			}
396
397
			$this->display_sso_login_form();
398
		}