@@ -2146,49 +2146,42 @@ export class PasswordPolicyAuthConfig implements PasswordPolicyConfig {
21462146 ) ;
21472147 }
21482148 }
2149- if ( typeof options . constraints . requireUppercase !== undefined &&
2149+ if ( typeof options . constraints . requireUppercase !== ' undefined' &&
21502150 ! validator . isBoolean ( options . constraints . requireUppercase ) ) {
21512151 throw new FirebaseAuthError (
21522152 AuthClientErrorCode . INVALID_CONFIG ,
21532153 '"PasswordPolicyConfig.constraints.requireUppercase" must be a boolean.' ,
21542154 ) ;
21552155 }
2156- if ( typeof options . constraints . requireLowercase !== undefined &&
2156+ if ( typeof options . constraints . requireLowercase !== ' undefined' &&
21572157 ! validator . isBoolean ( options . constraints . requireLowercase ) ) {
21582158 throw new FirebaseAuthError (
21592159 AuthClientErrorCode . INVALID_CONFIG ,
21602160 '"PasswordPolicyConfig.constraints.requireLowercase" must be a boolean.' ,
21612161 ) ;
21622162 }
2163- if ( typeof options . constraints . requireNonAlphanumeric !== undefined &&
2163+ if ( typeof options . constraints . requireNonAlphanumeric !== ' undefined' &&
21642164 ! validator . isBoolean ( options . constraints . requireNonAlphanumeric ) ) {
21652165 throw new FirebaseAuthError (
21662166 AuthClientErrorCode . INVALID_CONFIG ,
21672167 '"PasswordPolicyConfig.constraints.requireNonAlphanumeric"' +
21682168 ' must be a boolean.' ,
21692169 ) ;
21702170 }
2171- if ( typeof options . constraints . requireNumeric !== undefined &&
2171+ if ( typeof options . constraints . requireNumeric !== ' undefined' &&
21722172 ! validator . isBoolean ( options . constraints . requireNumeric ) ) {
21732173 throw new FirebaseAuthError (
21742174 AuthClientErrorCode . INVALID_CONFIG ,
21752175 '"PasswordPolicyConfig.constraints.requireNumeric" must be a boolean.' ,
21762176 ) ;
21772177 }
2178- if ( ! validator . isNumber ( options . constraints . minLength ) ) {
2178+ if ( typeof options . constraints . minLength === 'undefined' ) {
2179+ options . constraints . minLength = 6 ;
2180+ } else if ( ! validator . isNumber ( options . constraints . minLength ) ) {
21792181 throw new FirebaseAuthError (
21802182 AuthClientErrorCode . INVALID_CONFIG ,
21812183 '"PasswordPolicyConfig.constraints.minLength" must be a number.' ,
21822184 ) ;
2183- }
2184- if ( ! validator . isNumber ( options . constraints . maxLength ) ) {
2185- throw new FirebaseAuthError (
2186- AuthClientErrorCode . INVALID_CONFIG ,
2187- '"PasswordPolicyConfig.constraints.maxLength" must be a number.' ,
2188- ) ;
2189- }
2190- if ( options . constraints . minLength === undefined ) {
2191- options . constraints . minLength = 6 ;
21922185 } else {
21932186 if ( ! ( options . constraints . minLength >= 6
21942187 && options . constraints . minLength <= 30 ) ) {
@@ -2199,8 +2192,13 @@ export class PasswordPolicyAuthConfig implements PasswordPolicyConfig {
21992192 ) ;
22002193 }
22012194 }
2202- if ( options . constraints . maxLength === undefined ) {
2195+ if ( typeof options . constraints . maxLength === ' undefined' ) {
22032196 options . constraints . maxLength = 4096 ;
2197+ } else if ( ! validator . isNumber ( options . constraints . maxLength ) ) {
2198+ throw new FirebaseAuthError (
2199+ AuthClientErrorCode . INVALID_CONFIG ,
2200+ '"PasswordPolicyConfig.constraints.maxLength" must be a number.' ,
2201+ ) ;
22042202 } else {
22052203 if ( ! ( options . constraints . maxLength >= options . constraints . minLength &&
22062204 options . constraints . maxLength <= 4096 ) ) {
0 commit comments