@@ -21,6 +21,7 @@ const {
2121 beforeSmsSent,
2222 HttpsError,
2323} = require ( "firebase-functions/identity" ) ;
24+ const { defineString} = require ( 'firebase-functions/params' ) ;
2425const admin = require ( "firebase-admin" ) ;
2526
2627admin . initializeApp ( ) ;
@@ -85,10 +86,13 @@ exports.checkEmailDomain = beforeEmailSent((event) => {
8586 // Only users of a specific domain can receive emails.
8687 if ( ! email ) {
8788 // Throw an HttpsError so that Firebase Auth rejects the email sending.
88- throw new HttpsError ( "invalid-argument" , "No email was found in the CloudEvent" ) ;
89+ throw new HttpsError ( "invalid-argument" ,
90+ "No email was found in the CloudEvent" ) ;
8991 }
9092 if ( ! email . endsWith ( "@acme.com" ) ) {
91- throw new HttpsError ( "permission-denied" , "Only users from the acme.com domain can authenticate" ) ;
93+ throw new HttpsError ( "permission-denied" ,
94+ "Only users from the acme.com domain can " +
95+ "authenticate" ) ;
9296 }
9397 // [END v2emailHttpsError]
9498} ) ;
@@ -113,9 +117,10 @@ exports.checkPhoneNumber = beforeSmsSent((event) => {
113117 // [START v2smsHttpsError]
114118 if ( ! phoneNumber ) {
115119 // Throw an HttpsError so that Firebase Auth rejects the SMS sending.
116- throw new HttpsError ( "invalid-argument" , "No phone number was found in the CloudEvent" ) ;
120+ throw new HttpsError ( "invalid-argument" ,
121+ "No phone number was found in the CloudEvent" ) ;
117122 }
118-
123+
119124 // Only users of a specific region can receive SMS.
120125 if ( ! phoneNumber . startsWith ( intlPrefixNumber . value ( ) ) ) {
121126 // Throw an HttpsError so that Firebase Auth rejects the SMS sending.
0 commit comments