From 5d385c9a9d1e43d2dda9858f56aba717d50d9bfe Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 22 Jun 2023 17:54:09 -0700 Subject: [PATCH] Fix phone verification secret in events & payload The secret in events & payload should match the secret sent to messaging. --- app/controllers/api/account.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 49c5ef3376..73a96bdbd4 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -2438,7 +2438,6 @@ App::post('/v1/account/verification/phone') $roles = Authorization::getRoles(); $isPrivilegedUser = Auth::isPrivilegedUser($roles); $isAppUser = Auth::isAppUser($roles); - $verificationSecret = Auth::tokenGenerator(); $secret = Auth::codeGenerator(); $expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM); @@ -2474,13 +2473,13 @@ App::post('/v1/account/verification/phone') ->setParam('userId', $user->getId()) ->setParam('tokenId', $verification->getId()) ->setPayload($response->output( - $verification->setAttribute('secret', $verificationSecret), + $verification->setAttribute('secret', $secret), Response::MODEL_TOKEN )) ; // Hide secret for clients - $verification->setAttribute('secret', ($isPrivilegedUser || $isAppUser) ? $verificationSecret : ''); + $verification->setAttribute('secret', ($isPrivilegedUser || $isAppUser) ? $secret : ''); $response ->setStatusCode(Response::STATUS_CODE_CREATED)