| @@ 100-116 (lines=17) @@ | ||
| 97 | * |
|
| 98 | * @return void |
|
| 99 | */ |
|
| 100 | public function execute(Observer $observer) |
|
| 101 | { |
|
| 102 | if ($this->isTwoFactorEnabled() === false) { |
|
| 103 | return; |
|
| 104 | } |
|
| 105 | ||
| 106 | if ($this->shouldTheUserBeRedirected() === false) { |
|
| 107 | return; |
|
| 108 | } |
|
| 109 | ||
| 110 | if ($this->areWeOnANonRedirectingPage() === true) { |
|
| 111 | return; |
|
| 112 | } |
|
| 113 | ||
| 114 | $controller = $observer->getEvent()->getData('response'); |
|
| 115 | $this->redirectToAuthenticationPage($controller); |
|
| 116 | } |
|
| 117 | ||
| 118 | private function isTwoFactorEnabled() |
|
| 119 | { |
|
| @@ 131-147 (lines=17) @@ | ||
| 128 | * |
|
| 129 | * @return void |
|
| 130 | */ |
|
| 131 | public function execute(Observer $observer) |
|
| 132 | { |
|
| 133 | if ($this->customerAdmin->isTwoFactorEnabled() !== true) { |
|
| 134 | return; |
|
| 135 | } |
|
| 136 | ||
| 137 | if ($this->shouldTheCustomerBeRedirected() === false) { |
|
| 138 | return; |
|
| 139 | } |
|
| 140 | ||
| 141 | if ($this->hasTwoFactorBeenChecked() === true) { |
|
| 142 | return; |
|
| 143 | } |
|
| 144 | ||
| 145 | $controller = $observer->getEvent()->getData('response'); |
|
| 146 | $this->redirectToTwoFactorCheck($controller); |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * This checks to see if the customer is on a page that shouldn't be redirected, if we actually have a customer, and |
|