Code Duplication    Length = 10-12 lines in 2 locations

modules/sso.php 2 locations

@@ 370-381 (lines=12) @@
367
		 * to the WordPress.com login page AND  that the request to wp-login.php
368
		 * is not something other than login (Like logout!)
369
		 */
370
		if (
371
			$this->wants_to_login()
372
			&& Jetpack_SSO_Helpers::bypass_login_forward_wpcom()
373
		) {
374
			add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_redirect_hosts' ) );
375
			$this->maybe_save_cookie_redirect();
376
			$reauth = ! empty( $_GET['force_reauth'] );
377
			$sso_url = $this->get_sso_url_or_die( $reauth );
378
			JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' );
379
			wp_safe_redirect( $sso_url );
380
			exit;
381
		}
382
383
		if ( 'login' === $action ) {
384
			$this->display_sso_login_form();
@@ 395-404 (lines=10) @@
392
						'error_message' => 'identity_crisis'
393
					) );
394
					wp_die( __( "Error: This site's Jetpack connection is currently experiencing problems.", 'jetpack' ) );
395
				} else {
396
					$this->maybe_save_cookie_redirect();
397
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
398
					add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_redirect_hosts' ) );
399
					$reauth = ! empty( $_GET['force_reauth'] );
400
					$sso_url = $this->get_sso_url_or_die( $reauth );
401
					JetpackTracking::record_user_event( 'sso_login_redirect_success' );
402
					wp_safe_redirect( $sso_url );
403
					exit;
404
				}
405
			}
406
		}
407
	}