| @@ 75-92 (lines=18) @@ | ||
| 72 | * ) |
|
| 73 | * @throws Exception |
|
| 74 | */ |
|
| 75 | public function lostPasswordAction() |
|
| 76 | { |
|
| 77 | $email = $this->getParam('email'); |
|
| 78 | ||
| 79 | $user = $this->userService->findUserByEmail($email); |
|
| 80 | if (!$user) { |
|
| 81 | $this->sendJsonResponse(['error' => UserException::USER_NOT_FOUND], 404); |
|
| 82 | return; |
|
| 83 | } |
|
| 84 | ||
| 85 | if ($user->getState()->getValue() == State::STATE_UNACTIVATED) { |
|
| 86 | $this->sendJsonResponse(['error' => UserException::USER_UNACTIVATED], 400); |
|
| 87 | return; |
|
| 88 | } |
|
| 89 | ||
| 90 | $link = $this->userService->generateEmailLink($user); |
|
| 91 | $this->sendJsonObjectResponse($link); |
|
| 92 | } |
|
| 93 | ||
| 94 | ||
| 95 | ||
| @@ 180-197 (lines=18) @@ | ||
| 177 | * ) |
|
| 178 | * @throws Exception |
|
| 179 | */ |
|
| 180 | public function resendActivationAction() |
|
| 181 | { |
|
| 182 | $email = $this->getParam('email'); |
|
| 183 | ||
| 184 | $user = $this->userService->findUserByEmail($email); |
|
| 185 | if (!$user) { |
|
| 186 | $this->sendJsonResponse(['error' => UserException::USER_NOT_FOUND], 404); |
|
| 187 | return; |
|
| 188 | } |
|
| 189 | ||
| 190 | if ($user->getState()->getValue() == State::STATE_ACTIVATED) { |
|
| 191 | $this->sendJsonResponse(['error' => UserException::USER_ACTIVATED], 400); |
|
| 192 | return; |
|
| 193 | } |
|
| 194 | ||
| 195 | $link = $this->userService->generateEmailLink($user); |
|
| 196 | $this->sendJsonObjectResponse($link); |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * Register as a new user. Returns an email link token. |
|