diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 6d78e275cc21d2b67c0aa0fef8e350f5526241f0..48d5117f4a47ec27a6c9868cfd1db627936166af 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -66,6 +66,7 @@ class AccountController extends Controller { $this->config = $config; $this->urlGenerator = $urlGenerator; $this->logger = $logger; + $this->request = $request; } /** @@ -159,8 +160,8 @@ class AccountController extends Controller { $this->session->remove(self::SESSION_USERNAME_CHECK); $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); - - $this->userService->addUsernameToCommonDataStore($username); + $ipAddress = $this->request->getRemoteAddress(); + $this->userService->addUsernameToCommonDataStore($username, $ipAddress, $recoveryEmail); $response->setStatus(200); $response->setData(['success' => true]); diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 8fb5b220fac41751c94041005da22c1593d6d500..fea70cb843591954529eb5296fe8f1037c282044 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -420,10 +420,12 @@ class UserService { * If the operation fails, an exception will be thrown. * * @param string $username The username to add to the common data store. + * @param string $ipAddress IP Address of user + * @param string $recoveryEmail A recovery Email of user * * @throws AddUsernameToCommonStoreException If an error occurs while adding the username to the common data store. */ - public function addUsernameToCommonDataStore(string $username) : void { + public function addUsernameToCommonDataStore(string $username, string $ipAddress, string $recoveryEmail) : void { $commonServicesURL = $this->apiConfig['commonServicesURL']; $commonApiVersion = $this->apiConfig['commonApiVersion']; @@ -434,7 +436,9 @@ class UserService { $url = $commonServicesURL . $endpoint ; $params = [ - 'username' => $username + 'username' => $username, + 'ipAddress' => $ipAddress, + 'recoveryEmail' => $recoveryEmail ]; $token = $this->apiConfig['commonServicesToken'];