TWSD-799 - Web UI to deliver the authentication QR code via email.
Review Request #1002 — Created Aug. 6, 2025 and submitted
| Information | |
|---|---|
| shuinvy | |
| AG | |
| rel_ag_9_4_5 | |
| TWSD-799 | |
| Reviewers | |
| evalin, jasonchou, milliechou, peteryeh, timlai, timsu | |
Use schedule to send QR code Email of OTP third-party key instead of send all Email one time
- Add my process to crontab to run the process every 1 mins
- Create config file for send Email process (send_otp_qrcode.php)
The files are in /tmp
The status is:
create: New email added or use want to resend again
resend: The batch is reached (100 emails for example), and this email is 101 or over 100, then set it to resend.
send: The email is sent, no need to send again.
The numbers meaning:
const RETRY_INTERVAL = 120; // seconds (One account can send OTP only once in this interval)
const EXPIRE_INTERVAL = 86400; // seconds (If this email keep not sent or resend in 1 day, then just remove it.)
const SEND_COMPLETE_EXPIRE = 1200; // seconds (After this time, the sent OTP will be considered expired.)
const MAX_RETRY = 3; // If the email retry 3 times and still failed, then remove from config file.
const BATCH_SIZE = 100; // Number of accounts to process in one batch, that means you can send 100 emails in schedule, and then remain emails should wait for next schedule.- The PHP for process to be executed by crontab, and the mechanism is in Flowchart (Flow chart for schedule function).
I also write log to debug the process.- There is background execute issue if I only call CLI, so I send output to /tmp/backend_mail.
- The log format is:
[DEBUG][{date_time}] Send OTP QR Code Email to: {my_email}, for account: {my_account} [{my_shell_id}] [{my_vsite_name}]
Such as:
[DEBUG][2025-08-06 07:12:01] Send OTP QR Code Email to: aaa@test.com, for account: bbb [array] [localdb]- Because the function is changed, I rename the function and modified the code for
class.cliWrap_vLocalDBAccounts.php
You can check the logic in Flowchart (Flow chart for schedule settings)
