Code Duplication    Length = 8-9 lines in 2 locations

modules/sso.php 2 locations

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