fix(SMS): change the brand name of the sms

This commit is contained in:
SepehrYahyaee
2026-11-22 16:04:24 +03:30
parent 99aba7e0fd
commit e31e2c7be6
13 changed files with 347 additions and 42 deletions
+2
View File
@@ -6,6 +6,7 @@ The deployment selects `moalem` as its SMS provider. This is independent of the
```dotenv
SMS_PROVIDER=moalem
SMS_BRAND_NAME="سامانه خسارت اپکس"
MIC_SMS_TOKEN_URL=https://auth.mic.co.ir/connect/token
MIC_SMS_SEND_URL=https://api.mic.co.ir/sms/send
MIC_SMS_CLIENT_ID=<provided privately by MIC>
@@ -18,6 +19,7 @@ FAKE_OTP=false
- If the legacy `SMS` setting is nonempty, it overrides `SMS_PROVIDER`. Set it to `moalem` as well, or remove it. `moallem` is accepted as an alias; logs use `moalem`.
- Keep the existing `AUTH_SMS_TEMPLATE` and `AUTH_SMS_MESSAGE` settings for OTP text. Existing URL and `USER_BASE_PATH` settings continue controlling message links.
- `SMS_BRAND_NAME` controls the name in every SMS; unset or blank defaults to `یارا۷۲۴`. Custom OTP/database patterns can use `{brandName}`. See [SMS deployment branding](../sms-deployment-branding.md).
- Supply credentials privately through the server environment or secret store. The repository example contains no credentials. Restart API instances after changing configuration.
- Active Moalem deployments fail startup when required MIC credentials, HTTPS URLs or numeric settings are invalid. MIC settings do not block other SMS providers.
- Allow outbound HTTPS to `auth.mic.co.ir` and `api.mic.co.ir`. Redirects are disabled. The existing HTTP proxy configuration is reused.
+47
View File
@@ -0,0 +1,47 @@
# Deployment-specific SMS names
Set the public display name in the API deployment environment and restart the API:
```env
SMS_BRAND_NAME="سامانه خسارت اپکس"
```
The default for an absent, empty or whitespace-only value is `یارا۷۲۴`.
This name is independent of the Fanavaran tenant and SMS provider settings.
No database migration or frontend deployment is required.
Every locally rendered SMS carries this name: OTPs, invitations, field-expert
links, signature notices, document requests, case-review updates, Fanavaran
registration confirmations and plain messages loaded from `sms-texts`.
Messages without an embedded name receive the name on a final line. Existing
Persian/English Yara724 name spellings in message patterns are replaced when
rendered; stored patterns are not changed. URLs and inserted token values are
preserved.
Custom OTP and database message patterns can place the name explicitly:
```env
AUTH_SMS_MESSAGE="رمز ورود شما در {brandName}: {token}"
```
`{brandName}` is resolved from `SMS_BRAND_NAME`. The existing `{token}`,
`{token2}`, `{token3}` and `{token10}` placeholders retain their purposes.
Locally rendered deliveries and skipped test OTPs record the same rendered text
in the SMS audit. Kavenegar hosted lookups record a locally reconstructed text;
their actual body is controlled by the provider's approved template. Previously
stored SMS logs are historical records and are not modified.
## Provider behavior
- **Parsian and Moalem:** all templates are rendered locally; no provider-side
template changes are needed.
- **Kavenegar:** with the default name, existing hosted lookup templates continue
to work. With a custom name, application templates and OTPs are rendered locally
and sent through `sms/send.json` using the existing sender. The Kavenegar
account/sender must support plain-text delivery, including the intended
recipients. Hosted templates cannot have their fixed text changed by this
environment variable. Unknown external template identifiers continue to use
hosted lookup; all current application notifications have local templates.
Changing the display name does not change provider credentials, sender numbers,
template identifiers, user-panel links or the SMS destination numbers.