Code Duplication    Length = 10-12 lines in 2 locations

modules/sso.php 2 locations

@@ 385-396 (lines=12) @@
382
		 * to the WordPress.com login page AND  that the request to wp-login.php
383
		 * is not something other than login (Like logout!)
384
		 */
385
		if (
386
			$this->wants_to_login()
387
			&& Jetpack_SSO_Helpers::bypass_login_forward_wpcom()
388
		) {
389
			add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_redirect_hosts' ) );
390
			$this->maybe_save_cookie_redirect();
391
			$reauth = ! empty( $_GET['force_reauth'] );
392
			$sso_url = $this->get_sso_url_or_die( $reauth );
393
			JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' );
394
			wp_safe_redirect( $sso_url );
395
			exit;
396
		}
397
398
		if ( 'login' === $action ) {
399
			$this->display_sso_login_form();
@@ 410-419 (lines=10) @@
407
						'error_message' => 'identity_crisis'
408
					) );
409
					wp_die( __( "Error: This site's Jetpack connection is currently experiencing problems.", 'jetpack' ) );
410
				} else {
411
					$this->maybe_save_cookie_redirect();
412
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
413
					add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_redirect_hosts' ) );
414
					$reauth = ! empty( $_GET['force_reauth'] );
415
					$sso_url = $this->get_sso_url_or_die( $reauth );
416
					JetpackTracking::record_user_event( 'sso_login_redirect_success' );
417
					wp_safe_redirect( $sso_url );
418
					exit;
419
				}
420
			}
421
		}
422
	}