@abp/ng.theme.shared 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ import { NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, N
15
15
  import * as i1$2 from '@swimlane/ngx-datatable';
16
16
  import { ColumnMode, NgxDatatableModule } from '@swimlane/ngx-datatable';
17
17
  import { HttpErrorResponse } from '@angular/common/http';
18
- import { NgxValidateCoreModule, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, validatePassword } from '@ngx-validate/core';
18
+ import { NgxValidateCoreModule, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, normalizeDiacritics } from '@ngx-validate/core';
19
19
  import { Validators } from '@angular/forms';
20
20
 
21
21
  const bounceIn = animation([
@@ -949,6 +949,10 @@ const DEFAULT_VALIDATION_BLUEPRINTS = {
949
949
  range: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]',
950
950
  required: 'AbpValidation::ThisFieldIsRequired.',
951
951
  url: 'AbpValidation::ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl',
952
+ passwordRequiresLower: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresLower',
953
+ passwordRequiresUpper: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresUpper',
954
+ passwordRequiresDigit: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresDigit',
955
+ passwordRequiresNonAlphanumeric: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresNonAlphanumeric',
952
956
  };
953
957
 
954
958
  class EllipsisDirective {
@@ -2213,7 +2217,8 @@ function getPasswordValidators(injector) {
2213
2217
  if (Number.isInteger(+getRule('RequiredLength'))) {
2214
2218
  requiredLength = +getRule('RequiredLength');
2215
2219
  }
2216
- return [validatePassword(passwordRulesArr), minLength(requiredLength), maxLength(128)];
2220
+ const passwordValidators = passwordRulesArr.map(rule => validatePassword(rule));
2221
+ return [...passwordValidators, minLength(requiredLength), maxLength(128)];
2217
2222
  }
2218
2223
  function getRuleFn(injector) {
2219
2224
  const configState = injector.get(ConfigStateService);
@@ -2221,6 +2226,34 @@ function getRuleFn(injector) {
2221
2226
  const passwordRules = configState.getSettings('Identity.Password');
2222
2227
  return (passwordRules[`Abp.Identity.Password.${key}`] || '').toLowerCase();
2223
2228
  };
2229
+ }
2230
+ const errorMessageMap = {
2231
+ small: 'passwordRequiresLower',
2232
+ capital: 'passwordRequiresUpper',
2233
+ number: 'passwordRequiresDigit',
2234
+ special: 'passwordRequiresNonAlphanumeric',
2235
+ };
2236
+ function validatePassword(shouldContain) {
2237
+ return (control) => {
2238
+ if (!control.value)
2239
+ return null;
2240
+ const value = normalizeDiacritics(control.value);
2241
+ const regexMap = {
2242
+ small: /.*[a-z].*/,
2243
+ capital: /.*[A-Z].*/,
2244
+ number: /.*[0-9].*/,
2245
+ special: /.*[^0-9a-zA-Z].*/,
2246
+ };
2247
+ const regex = regexMap[shouldContain];
2248
+ const isValid = regex.test(value);
2249
+ if (isValid) {
2250
+ return null;
2251
+ }
2252
+ const error = errorMessageMap[shouldContain];
2253
+ return {
2254
+ [error]: true,
2255
+ };
2256
+ };
2224
2257
  }
2225
2258
 
2226
2259
  /*
@@ -2231,5 +2264,5 @@ function getRuleFn(injector) {
2231
2264
  * Generated bundle index. Do not edit.
2232
2265
  */
2233
2266
 
2234
- export { BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut };
2267
+ export { BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut, validatePassword };
2235
2268
  //# sourceMappingURL=abp-ng.theme.shared.mjs.map