This commit is contained in:
2026-09-13 15:35:58 +03:30
parent 6439a91218
commit 602da7f860
13 changed files with 186 additions and 18 deletions
+14 -1
View File
@@ -22,7 +22,20 @@ export class SmsService {
const raw = (
this.config.get<string>('SMS_ENABLED', 'true') ?? 'true'
).toLowerCase();
return raw === '1' || raw === 'true' || raw === 'yes';
const flagOn = raw === '1' || raw === 'true' || raw === 'yes';
if (!flagOn) return false;
return this.hasUsableSecret();
}
private hasUsableSecret(): boolean {
const secretKey = this.config.get<string>('SMS_SECRET_KEY')?.trim() ?? '';
if (!secretKey) return false;
const placeholders = new Set([
'your-sms-secret-key',
'کلید-پیامک',
'change-me',
]);
return !placeholders.has(secretKey);
}
async send(to: string, message: string): Promise<SmsSendResult> {