@@ -2146,49 +2146,42 @@ export class PasswordPolicyAuthConfig implements PasswordPolicyConfig {
2146
2146
) ;
2147
2147
}
2148
2148
}
2149
- if ( typeof options . constraints . requireUppercase !== undefined &&
2149
+ if ( typeof options . constraints . requireUppercase !== ' undefined' &&
2150
2150
! validator . isBoolean ( options . constraints . requireUppercase ) ) {
2151
2151
throw new FirebaseAuthError (
2152
2152
AuthClientErrorCode . INVALID_CONFIG ,
2153
2153
'"PasswordPolicyConfig.constraints.requireUppercase" must be a boolean.' ,
2154
2154
) ;
2155
2155
}
2156
- if ( typeof options . constraints . requireLowercase !== undefined &&
2156
+ if ( typeof options . constraints . requireLowercase !== ' undefined' &&
2157
2157
! validator . isBoolean ( options . constraints . requireLowercase ) ) {
2158
2158
throw new FirebaseAuthError (
2159
2159
AuthClientErrorCode . INVALID_CONFIG ,
2160
2160
'"PasswordPolicyConfig.constraints.requireLowercase" must be a boolean.' ,
2161
2161
) ;
2162
2162
}
2163
- if ( typeof options . constraints . requireNonAlphanumeric !== undefined &&
2163
+ if ( typeof options . constraints . requireNonAlphanumeric !== ' undefined' &&
2164
2164
! validator . isBoolean ( options . constraints . requireNonAlphanumeric ) ) {
2165
2165
throw new FirebaseAuthError (
2166
2166
AuthClientErrorCode . INVALID_CONFIG ,
2167
2167
'"PasswordPolicyConfig.constraints.requireNonAlphanumeric"' +
2168
2168
' must be a boolean.' ,
2169
2169
) ;
2170
2170
}
2171
- if ( typeof options . constraints . requireNumeric !== undefined &&
2171
+ if ( typeof options . constraints . requireNumeric !== ' undefined' &&
2172
2172
! validator . isBoolean ( options . constraints . requireNumeric ) ) {
2173
2173
throw new FirebaseAuthError (
2174
2174
AuthClientErrorCode . INVALID_CONFIG ,
2175
2175
'"PasswordPolicyConfig.constraints.requireNumeric" must be a boolean.' ,
2176
2176
) ;
2177
2177
}
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 ) ) {
2179
2181
throw new FirebaseAuthError (
2180
2182
AuthClientErrorCode . INVALID_CONFIG ,
2181
2183
'"PasswordPolicyConfig.constraints.minLength" must be a number.' ,
2182
2184
) ;
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 ;
2192
2185
} else {
2193
2186
if ( ! ( options . constraints . minLength >= 6
2194
2187
&& options . constraints . minLength <= 30 ) ) {
@@ -2199,8 +2192,13 @@ export class PasswordPolicyAuthConfig implements PasswordPolicyConfig {
2199
2192
) ;
2200
2193
}
2201
2194
}
2202
- if ( options . constraints . maxLength === undefined ) {
2195
+ if ( typeof options . constraints . maxLength === ' undefined' ) {
2203
2196
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
+ ) ;
2204
2202
} else {
2205
2203
if ( ! ( options . constraints . maxLength >= options . constraints . minLength &&
2206
2204
options . constraints . maxLength <= 4096 ) ) {
0 commit comments