Code Duplication    Length = 8-10 lines in 2 locations

modules/sso.php 2 locations

@@ 358-367 (lines=10) @@
355
			} else {
356
				if ( ( new Status() )->is_staging_site() ) {
357
					add_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'sso_not_allowed_in_staging' ) );
358
				} else {
359
					// Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect?
360
					add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
361
					$reauth = ! empty( $_GET['force_reauth'] );
362
					$sso_url = $this->get_sso_url_or_die( $reauth );
363
364
					$tracking->record_user_event( 'sso_login_redirect_success' );
365
					wp_safe_redirect( $sso_url );
366
					exit;
367
				}
368
			}
369
		} else if ( Jetpack_SSO_Helpers::display_sso_form_for_action( $action ) ) {
370
@@ 379-386 (lines=8) @@
376
			 * to the WordPress.com login page AND  that the request to wp-login.php
377
			 * is not something other than login (Like logout!)
378
			 */
379
			if ( Jetpack_SSO_Helpers::bypass_login_forward_wpcom() && $this->wants_to_login() ) {
380
				add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
381
				$reauth = ! empty( $_GET['force_reauth'] );
382
				$sso_url = $this->get_sso_url_or_die( $reauth );
383
				$tracking->record_user_event( 'sso_login_redirect_bypass_success' );
384
				wp_safe_redirect( $sso_url );
385
				exit;
386
			}
387
388
			$this->display_sso_login_form();
389
		}