Code Duplication    Length = 10-12 lines in 2 locations

modules/sso.php 2 locations

@@ 358-369 (lines=12) @@
355
		 * to the WordPress.com login page AND  that the request to wp-login.php
356
		 * is not something other than login (Like logout!)
357
		 */
358
		if (
359
			$this->wants_to_login()
360
			&& Jetpack_SSO_Helpers::bypass_login_forward_wpcom()
361
		) {
362
			add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
363
			$this->maybe_save_cookie_redirect();
364
			$reauth = ! empty( $_GET['force_reauth'] );
365
			$sso_url = $this->get_sso_url_or_die( $reauth );
366
			JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' );
367
			wp_safe_redirect( $sso_url );
368
			exit;
369
		}
370
371
		if ( 'login' === $action ) {
372
			$this->display_sso_login_form();
@@ 383-392 (lines=10) @@
380
						'error_message' => 'identity_crisis'
381
					) );
382
					add_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'error_msg_identity_crisis' ) );
383
				} else {
384
					$this->maybe_save_cookie_redirect();
385
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
386
					add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
387
					$reauth = ! empty( $_GET['force_reauth'] );
388
					$sso_url = $this->get_sso_url_or_die( $reauth );
389
					JetpackTracking::record_user_event( 'sso_login_redirect_success' );
390
					wp_safe_redirect( $sso_url );
391
					exit;
392
				}
393
			}
394
		}
395
	}