Code Duplication    Length = 10-12 lines in 2 locations

modules/sso.php 2 locations

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