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( 'Jetpack_SSO_Helpers', '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();
@@ 397-406 (lines=10) @@
394
			} else {
395
				if ( Jetpack::is_staging_site() ) {
396
					add_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'sso_not_allowed_in_staging' ) );
397
				} else {
398
					$this->maybe_save_cookie_redirect();
399
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
400
					add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
401
					$reauth = ! empty( $_GET['force_reauth'] );
402
					$sso_url = $this->get_sso_url_or_die( $reauth );
403
					JetpackTracking::record_user_event( 'sso_login_redirect_success' );
404
					wp_safe_redirect( $sso_url );
405
					exit;
406
				}
407
			}
408
		}
409
	}