agent: Add more Rust code examples, update TODO check (#28737)

Release Notes:

- N/A
This commit is contained in:
Thomas Mickley-Doyle 2025-04-15 11:52:08 -05:00 committed by GitHub
parent d0f806456c
commit b1e4e6048a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 142 additions and 2 deletions

View file

@ -0,0 +1,3 @@
url = "https://github.com/dani-garcia/vaultwarden.git"
revision = "3a1f1bae002bebf26ce3a38b879c1ba26529af1e"
language_extension = "rs"

View file

@ -0,0 +1,6 @@
1. Refactors the `register_verification_email` logic to generate the JWT verification token earlier in the control flow, reducing duplication and improving readability.
2. Improves conditional logic for sending verification emails by only querying the database when mail should be sent, reducing unnecessary operations.
3. Refines the user existence check to specifically filter for users that have a `private_key`, adding stricter criteria before skipping email sending.
4. Preserves existing timing attack mitigation by retaining randomized sleep behavior when user exists but an email is not sent.
5. Ensures the email is sent only if appropriate, preserving previous behavior while streamlining logic and improving maintainability.
6. Removes redundant code paths and unnecessary reassignments, improving clarity without affecting functionality.

View file

@ -0,0 +1 @@
I want to refactor the `register_verification_email` function to streamline how verification emails are handled. Currently, the code checks if a user exists and then sends an email or returns early. Id like to move the JWT token generation to the top of the function to avoid duplication. Then, if mail sending is enabled, the code should check for the user, but only send the verification email if the user exists and has a `private_key` (otherwise it should send the email). Keep the random sleep logic for timing mitigation in the branch where no email is sent. Remove the old duplicated token generation logic and any redundant conditionals, while ensuring the core behavior and response flow stays the same.