HomeWiki
HomeWiki
  1. Components
  • Back to home
  • 1. Themes
  • 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
  • Vs Code
    • Getting Started
  1. Components

Change Password

To properly document the Change Password Component, including its functionality, data handling, and configuration, here's a structured approach based on the provided code. This will include the model object properties, the Vue component structure, and how it interacts with the template.

Documentation: Change Password Component#

The Change Password Component is a Vue.js component that provides a form for users to change their password. The component uses the model object to configure text labels, error messages, and other aspects of its behavior.

Overview#

The Change Password Component displays a form with two password fields: one for entering the new password and another for confirming it. It performs validation on these fields and displays appropriate error messages based on the validation results. The component also handles form submission and displays a loading spinner while processing.

Model Documentation#

The model object is used to configure various aspects of the component. Here is a detailed breakdown of its properties:
Model Structure#
id: String
A unique identifier for the component. This is used for the id attribute of the outer <div> container and can be used for styling or JavaScript targeting.
cssClass: String
Optional CSS class(es) for additional styling of the component's outer container.
ChangePassword: String
The header text displayed at the top of the form, rendered as an <h2> element.
newPasswordText: String
The label text for the new password input field.
confirmPasswordText: String
The label text for the confirm password input field.
Example Model#
Here is an example model object:
{
  "id": "change-password-1",
  "cssClass": "custom-change-password",
  "ChangePassword": "Change Password",
  "newPasswordText": "New Password",
  "confirmPasswordText": "Confirm Password",
  "EmptyPasswordText": "Password cannot be empty.",
  "MismatchPasswordText": "Passwords do not match.",
  "PasswordPolicyText": "Password must be at least 8 characters long and include letters, numbers, and symbols.",
  "RequestError": "There was an error processing your request. Please try again.",
  "ButtonText": "Change Password"
}

Component Structure#

The Change Password Component includes the following Vue.js features:
1.
HTML Template: Defines the structure and appearance of the change password form.
2.
JavaScript Logic: Handles data management, validation, and form submission.

HTML Template#

The HTML template renders the change password form using Vue.js directives:

JavaScript Logic#

The JavaScript code handles data, methods, and lifecycle hooks for the component:

Explanation#

1.
Props:
model: Configures the component with properties like labels, error messages, and button text.
2.
Data:
login: Stores the model object.
password, passwordValidate, passwordValidateError, passwordError, isloading: Manages form input and state.
3.
Methods:
hasLetter(str), hasNumber(str), hasSymbol(str): Utility functions to check password complexity.
checkForm(e): Validates the form and manages errors. Submits the form if validation passes.
4.
Mounted Lifecycle Hook:
mounted(): Placeholder for additional initialization if needed.
5.
Template:
Uses Vue.js directives (v-model, v-if, v-show, etc.) to handle dynamic content and validation.

Steps to Create or Modify the Component#

1.
Define the Vue Component:
Register the component using Vue.component() or app.component().
2.
Create the Template:
Use Vue.js directives to bind data and handle conditional rendering.
3.
Implement JavaScript Logic:
Define props and data to manage the component’s state.
Implement methods for validation and form submission.
4.
Customize Styling and Layout:
Adjust CSS classes and styles based on the model properties.
This documentation provides a comprehensive overview of the Change Password Component and its configuration. Adjust the model object and component logic as needed to fit specific requirements.
Previous
Categories List
Next
Checkout
Built with