Code Duplication    Length = 10-12 lines in 2 locations

modules/sso.php 2 locations

@@ 378-389 (lines=12) @@
375
		 * to the WordPress.com login page AND  that the request to wp-login.php
376
		 * is not something other than login (Like logout!)
377
		 */
378
		if (
379
			$this->wants_to_login()
380
			&& Jetpack_SSO_Helpers::bypass_login_forward_wpcom()
381
		) {
382
			add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
383
			$this->maybe_save_cookie_redirect();
384
			$reauth = ! empty( $_GET['force_reauth'] );
385
			$sso_url = $this->get_sso_url_or_die( $reauth );
386
			JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' );
387
			wp_safe_redirect( $sso_url );
388
			exit;
389
		}
390
391
		if ( 'login' === $action ) {
392
			$this->display_sso_login_form();
@@ 403-412 (lines=10) @@
400
						'error_message' => 'identity_crisis'
401
					) );
402
					add_filter( 'login_message', array( $this, 'error_msg_identity_crisis' ) );
403
				} else {
404
					$this->maybe_save_cookie_redirect();
405
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
406
					add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
407
					$reauth = ! empty( $_GET['force_reauth'] );
408
					$sso_url = $this->get_sso_url_or_die( $reauth );
409
					JetpackTracking::record_user_event( 'sso_login_redirect_success' );
410
					wp_safe_redirect( $sso_url );
411
					exit;
412
				}
413
			}
414
		}
415
	}