diff --git a/CHANGELOG.md b/CHANGELOG.md index a586a3e..d07156c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ v1.6 - Fix FLEXIAPI-192 Add DotEnv configuration to allow the expiration of tokens and codes in the app - Fix FLEXIAPI-196 Add a phone validation system by country code with configuration panels and related tests and documentation - Fix FLEXIAPI-203 Implement domain based Linphone configuration, add documentation, complete API endpoints, complete provisioning XML +- Fix FLEXIAPI-208 Add SMS templates documentation v1.5 --- diff --git a/README.md b/README.md index 7d42541..3231437 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,17 @@ You can also seed the tables with test accounts for the liblinphone test suite w php artisan accounts:seed /path/to/accounts.json +## SMS templates + +To send SMS to the USA some providers need to validate their templates before transfering them, see [Sending SMS messages to the USA - OVH](https://help.ovhcloud.com/csm/en-ie-sms-sending-sms-to-usa?id=kb_article_view&sysparm_article=KB0051359). + +Here are the currently used SMS templates in the app to declare in your provider panel: + +- Recovery code: `Your #APP_NAME# creation code is #CODE#` +- Validation code: `Your #APP_NAME# recovery code is #CODE#` +- Validation code: `Your #APP_NAME# validation code is #CODE#` +- Validation code with expiration: `Your #APP_NAME# validation code is #CODE#. The code is available for #CODE_MINUTES# minutes` + ## Custom email templaces Some email templates can be customized. diff --git a/flexiapi/app/Services/AccountService.php b/flexiapi/app/Services/AccountService.php index 17a6c34..e55aceb 100644 --- a/flexiapi/app/Services/AccountService.php +++ b/flexiapi/app/Services/AccountService.php @@ -241,8 +241,14 @@ class AccountService Log::channel('events')->info('Account Service: Account phone change requested by SMS', ['id' => $account->identifier]); + $message = 'Your ' . config('app.name') . ' validation code is ' . $phoneChangeCode->code . '.'; + + if (config('app.recovery_code_expiration_minutes') > 0) { + $message .= ' The code is available for ' . config('app.recovery_code_expiration_minutes') . ' minutes'; + } + $ovhSMS = new OvhSMS(); - $ovhSMS->send($request->get('phone'), 'Your ' . config('app.name') . ' validation code is ' . $phoneChangeCode->code); + $ovhSMS->send($request->get('phone'), $message); } public function updatePhone(Request $request): ?Account @@ -381,10 +387,10 @@ class AccountService { $account = $this->recoverAccount($account); - $message = 'Your ' . config('app.name') . ' validation code is ' . $account->recovery_code . ' .'; + $message = 'Your ' . config('app.name') . ' validation code is ' . $account->recovery_code . '.'; if (config('app.recovery_code_expiration_minutes') > 0) { - $message .= 'The code is available for ' . config('app.recovery_code_expiration_minutes') . ' minutes'; + $message .= ' The code is available for ' . config('app.recovery_code_expiration_minutes') . ' minutes'; } $ovhSMS = new OvhSMS();