Home
Wiki
Home
Wiki
  1. 2. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
    • 0. Introduction
    • 6. FAQ
    • 1. Structure
      • _Overview
      • LayoutA.liquid
      • ComponentsList.liquid
      • Metas.liquid
      • CssVariables.liquid
      • Json.liquid
      • GoogleTagManager.liquid
      • StagingButton.liquid
    • 2. Components
      • _Overview
      • Announcement
      • BannerCarousel
      • BlogCategoryList
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Quote
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
    • 3. Reusables
      • _Overview
      • Addresses
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • BillingRetail
      • Company
      • General
      • Login
      • LoginModal
      • MonthlyTransactions
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductListItem
      • ProductModal
      • ProfileInfo
      • PromptModal
      • Quotes
      • Register
      • Services
      • Shipping
      • ShoppingLists
      • ShoppingListsButton
      • ShoppingListsNavbar
      • Toast
      • Transactions
      • Users
      • VariantContent
      • WishlistButton
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • _Overview
        • theme.js
      • Css - Scss
        • _Overview
        • ThemeClasses
    • 5. SDK
      • _Overview
      • LiquidGlobals
      • ServicesSDK
  1. 2. Components

ChangePassword

Purpose#

The ChangePassword component renders the “Change password” form and submits the new password using the theme services layer.
It includes:
Password + Confirm Password inputs
Client-side validation (required fields + password strength rules + match validation)
Show/hide password toggle
Toast feedback for success/failure
Redirect to /login on success

Inputs (model contract)#

Model shape (storefront example)#

{
  "name": "ChangePassword",
  "view": "Default",
  "section": "SectionA",
  "settings": {
    "id": "Component Id",
    "section": "SectionA",
    "type": "NoirChangePassword",
    "name": "ChangePassword",
    "configuredInContentApi": true,
    "view": "Default",
    "displayName": "",
    "cssClass": "Sample cssClass"
  },
  "translations": {
    "changePassword": "Sample translation",
    "buttonText": "Sample translation",
    "errorEmptyField": "Sample translation",
    "...": "..."
  }
}

Required fields#

settings.id
Used for wrapper id: comp-{{ id }}

Optional fields#

settings.cssClass
Applied to wrapper only when non-empty and not (UNDEFINED).

JavaScript#

Global object#

The component exposes an Alpine-ready object:
It’s used directly from the template via:
x-data="changepassworddefault"

State fields (what they represent)#

fields: []
Cached list of form inputs (all [name] fields except disabled + submit).
errors: {}
Per-field error code mapping:
"required" / "weak" / "unmatched" / "" (empty string means no error)
isSending: false
Used to disable UI / show loading state while submitting.
errorUpLowCase, errorLength, errorSymbolNum
Password strength breakdown flags (used to show the “weak password must…” checklist).

init#

Collects input fields inside the component, caches them in this.fields, and attaches blur listeners that call validateField(...).

validateField#

Validates a single field and updates this.errors, field classes (valid/invalid), the .icon-state indicator, and (for the main password field) the password-strength flags.

toggleVisibility#

Toggles a password input between type="password" and type="text", updating the related icon classes.

updateFormValidity#

Returns true only if every field:
has no error code in this.errors[field.name], and
is not empty when required
Implementation:
iterates all this.fields
checks err and requiredEmpty

clearForm#

Resets the form UI and state:
clears value for each field
removes valid / invalid classes
resets .icon-state classes
clears the errors object

checkForm#

Validates the form and submits the change-password request via servicesreusabledefault.changePassword(...), showing toast feedback and redirecting to /login on success.

Global Alpine stores (used by ChangePassword)#

Alpine.store("toast")#

Used for user feedback:
clears existing messages before validation/submit
shows error toast when API fails
shows success toast when API succeeds
Common pattern:
Alpine.store("toast").removeAll();
Alpine.store("toast").add(message, "ic-warning", "error");

Dependencies#

Alpine.js (for x-data, x-show, event handlers)
Alpine.store("toast")
servicesreusabledefault.changePassword(...) (theme services API)
Browser supports standard DOM APIs (the component uses querySelector/getElementById)

Notes#

The component depends on the reset token being present in the URL. The token is read as the last segment of window.location.href.
On success it redirects to /login after 1 second.
Password validation accepts unicode lowercase/uppercase letters and checks for symbol/number requirements.

Extras#

Template behavior (Liquid + Alpine)#

The form is initialized with:
x-data="changepassworddefault"
On submit it calls:
@submit.prevent="checkForm(successMessage, errorMessage)"
The password visibility toggle is handled via checkbox inputs that call:
toggleVisibility($event)
(on click and on Enter key press for accessibility)
Validation messages are shown conditionally using:
x-show="errors['change-password'] === 'required'"
x-show="errors['change-password'] === 'weak'"
x-show="errors['change-confirm-password'] === 'unmatched'"
Modified at 2026-05-12 06:55:09
Previous
CategoriesList
Next
Checkout
Built with