mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 01:18:37 +00:00
update validation
This commit is contained in:
parent
3cb27d7b2c
commit
32dbafa353
1 changed files with 25 additions and 25 deletions
|
|
@ -490,27 +490,27 @@ class Messaging extends Action
|
||||||
return match ($provider->getAttribute('provider')) {
|
return match ($provider->getAttribute('provider')) {
|
||||||
'mock' => new Mock('username', 'password'),
|
'mock' => new Mock('username', 'password'),
|
||||||
'twilio' => new Twilio(
|
'twilio' => new Twilio(
|
||||||
!empty($credentials['accountSid']) ? $credentials['accountSid'] : 'accountSid',
|
$credentials['accountSid'] ?? '',
|
||||||
!empty($credentials['authToken']) ? $credentials['authToken'] : 'authToken',
|
$credentials['authToken'] ?? '',
|
||||||
null,
|
null,
|
||||||
!empty($credentials['messagingServiceSid']) ? $credentials['messagingServiceSid'] : null
|
!empty($credentials['messagingServiceSid']) ? $credentials['messagingServiceSid'] : null
|
||||||
),
|
),
|
||||||
'textmagic' => new TextMagic(
|
'textmagic' => new TextMagic(
|
||||||
!empty($credentials['username']) ? $credentials['username'] : 'username',
|
$credentials['username'] ?? '',
|
||||||
!empty($credentials['apiKey']) ? $credentials['apiKey'] : 'apiKey'
|
$credentials['apiKey'] ?? ''
|
||||||
),
|
),
|
||||||
'telesign' => new Telesign(
|
'telesign' => new Telesign(
|
||||||
!empty($credentials['customerId']) ? $credentials['customerId'] : 'customerId',
|
$credentials['customerId'] ?? '',
|
||||||
!empty($credentials['apiKey']) ? $credentials['apiKey'] : 'apiKey'
|
$credentials['apiKey'] ?? ''
|
||||||
),
|
),
|
||||||
'msg91' => new Msg91(
|
'msg91' => new Msg91(
|
||||||
!empty($credentials['senderId']) ? $credentials['senderId'] : 'senderId',
|
$credentials['senderId'] ?? '',
|
||||||
!empty($credentials['authKey']) ? $credentials['authKey'] : 'authKey',
|
$credentials['authKey'] ?? '',
|
||||||
!empty($credentials['templateId']) ? $credentials['templateId'] : 'templateId'
|
$credentials['templateId'] ?? ''
|
||||||
),
|
),
|
||||||
'vonage' => new Vonage(
|
'vonage' => new Vonage(
|
||||||
!empty($credentials['apiKey']) ? $credentials['apiKey'] : 'apiKey',
|
$credentials['apiKey'] ?? '',
|
||||||
!empty($credentials['apiSecret']) ? $credentials['apiSecret'] : 'apiSecret'
|
$credentials['apiSecret'] ?? ''
|
||||||
),
|
),
|
||||||
default => null
|
default => null
|
||||||
};
|
};
|
||||||
|
|
@ -524,10 +524,10 @@ class Messaging extends Action
|
||||||
return match ($provider->getAttribute('provider')) {
|
return match ($provider->getAttribute('provider')) {
|
||||||
'mock' => new Mock('username', 'password'),
|
'mock' => new Mock('username', 'password'),
|
||||||
'apns' => new APNS(
|
'apns' => new APNS(
|
||||||
$credentials['authKey'] ?? 'authKey',
|
$credentials['authKey'] ?? '',
|
||||||
$credentials['authKeyId'] ?? 'authKeyId',
|
$credentials['authKeyId'] ?? '',
|
||||||
$credentials['teamId'] ?? 'teamId',
|
$credentials['teamId'] ?? '',
|
||||||
$credentials['bundleId'] ?? 'bundleId',
|
$credentials['bundleId'] ?? '',
|
||||||
$options['sandbox'] ?? false
|
$options['sandbox'] ?? false
|
||||||
),
|
),
|
||||||
'fcm' => new FCM(\json_encode($credentials['serviceAccountJSON'])),
|
'fcm' => new FCM(\json_encode($credentials['serviceAccountJSON'])),
|
||||||
|
|
@ -539,23 +539,23 @@ class Messaging extends Action
|
||||||
{
|
{
|
||||||
$credentials = $provider->getAttribute('credentials', []);
|
$credentials = $provider->getAttribute('credentials', []);
|
||||||
$options = $provider->getAttribute('options', []);
|
$options = $provider->getAttribute('options', []);
|
||||||
$apiKey = !empty($credentials['apiKey']) ? $credentials['apiKey'] : 'apiKey';
|
$apiKey = $credentials['apiKey'] ?? '';
|
||||||
|
|
||||||
return match ($provider->getAttribute('provider')) {
|
return match ($provider->getAttribute('provider')) {
|
||||||
'mock' => new Mock('username', 'password'),
|
'mock' => new Mock('username', 'password'),
|
||||||
'smtp' => new SMTP(
|
'smtp' => new SMTP(
|
||||||
!empty($credentials['host']) ? $credentials['host'] : 'host',
|
$credentials['host'] ?? '',
|
||||||
!empty($credentials['port']) ? $credentials['port'] : 25,
|
$credentials['port'] ?? 25,
|
||||||
!empty($credentials['username']) ? $credentials['username'] : 'username',
|
$credentials['username'] ?? '',
|
||||||
!empty($credentials['password']) ? $credentials['password'] : 'password',
|
$credentials['password'] ?? '',
|
||||||
!empty($options['encryption']) ? $options['encryption'] : 'encryption',
|
$options['encryption'] ?? '',
|
||||||
!empty($options['autoTLS']) ? $options['autoTLS'] : false,
|
$options['autoTLS'] ?? false,
|
||||||
!empty($options['mailer']) ? $options['mailer'] : 'mailer',
|
$options['mailer'] ?? '',
|
||||||
),
|
),
|
||||||
'mailgun' => new Mailgun(
|
'mailgun' => new Mailgun(
|
||||||
$apiKey,
|
$apiKey,
|
||||||
!empty($credentials['domain']) ? $credentials['domain'] : 'domain',
|
$credentials['domain'] ?? '',
|
||||||
!empty($credentials['isEuRegion']) ?? false
|
$credentials['isEuRegion'] ?? false
|
||||||
),
|
),
|
||||||
'sendgrid' => new Sendgrid($apiKey),
|
'sendgrid' => new Sendgrid($apiKey),
|
||||||
default => null
|
default => null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue