|
5052 | 5052 | contentType: ContentType::JSON, |
5053 | 5053 | )) |
5054 | 5054 | ->label('abuse-limit', 10) |
5055 | | - ->label('abuse-key', 'userId:{userId},ip:{ip}') |
| 5055 | + ->label('abuse-key', 'url:{url},userId:{userId}') |
5056 | 5056 | ->param('phrase', false, new Boolean(), 'Toggle for security phrase. If enabled, email will be sent with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.', true) |
5057 | 5057 | ->inject('request') |
5058 | 5058 | ->inject('response') |
|
5089 | 5089 | '$id' => ID::unique(), |
5090 | 5090 | 'userId' => $user->getId(), |
5091 | 5091 | 'userInternalId' => $user->getSequence(), |
5092 | | - 'type' => TOKEN_TYPE_VERIFICATION, |
| 5092 | + 'type' => TOKEN_TYPE_VERIFICATION_OTP, |
5093 | 5093 | 'secret' => $proofForCode->hash($secret), |
5094 | 5094 | 'expire' => $expire, |
5095 | 5095 | 'userAgent' => $request->getUserAgent('UNKNOWN'), |
|
5236 | 5236 | recipient: $user->getAttribute('email'), |
5237 | 5237 | name: $user->getAttribute('name') ?? '', |
5238 | 5238 | subject: $subject, |
5239 | | - template: MAIL_TEMPLATE_OTP, |
| 5239 | + template: MAIL_TEMPLATE_OTP_VERIFICATION, |
5240 | 5240 | bodyTemplate: $bodyTemplate, |
5241 | 5241 | body: $body, |
5242 | 5242 | preview: $preview, |
|
5284 | 5284 | contentType: ContentType::JSON, |
5285 | 5285 | )) |
5286 | 5286 | ->label('abuse-limit', 10) |
5287 | | - ->label('abuse-key', 'userId:{param-userId}') |
| 5287 | + ->label('abuse-key', 'url:{url},userId:{param-userId}') |
5288 | 5288 | ->param('userId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'User ID.', false, ['dbForProject']) |
5289 | 5289 | ->param('secret', '', new Text(256), 'Valid verification OTP code.') |
5290 | 5290 | ->inject('response') |
|
5301 | 5301 | throw new Exception(Exception::USER_NOT_FOUND); |
5302 | 5302 | } |
5303 | 5303 |
|
5304 | | - $verifiedToken = $profile->tokenVerify(TOKEN_TYPE_VERIFICATION, $secret, $proofForCode); |
| 5304 | + $verifiedToken = $profile->tokenVerify(TOKEN_TYPE_VERIFICATION_OTP, $secret, $proofForCode); |
5305 | 5305 |
|
5306 | 5306 | if (!$verifiedToken) { |
5307 | 5307 | throw new Exception(Exception::USER_INVALID_TOKEN); |
|
5325 | 5325 |
|
5326 | 5326 | $response->dynamic($verificationDocument, Response::MODEL_TOKEN); |
5327 | 5327 | }); |
5328 | | - |
0 commit comments