4 min readUpdated Mar 2, 2026

ChangePasswordForm Documentation

Overview

The ChangePasswordForm component is designed for secure user interactions that allow the changing of passwords on the Vantage analytics and data platform. It facilitates users in entering their current password and a new password, while ensuring the new password is confirmed accurately. This component is essential for maintaining account security and enhancing user experience.

Settings

Data Prop

  1. Name: data
    • Input Type: Object
    • Purpose: Holds the values for the fields oldPassword, newPassword, and confirmPassword.
    • Default Value: An empty object ({}) if not provided.
    • Effect of Changes: Updates the form fields with the respective password values. Each change will be reflected immediately in the form's UI.

onChange Prop

  1. Name: onChange
    • Input Type: Function
    • Purpose: A callback function that is triggered when any of the password fields change. It provides a way to update the state in the parent component.
    • Effect of Changes: Ensures that real-time updates to the password fields are propagated back to the parent component, enabling dynamic handling of form state.

Error Prop

  1. Name: error
    • Input Type: String or null
    • Purpose: Displays an error message if there is an issue with password validation (e.g., if the current password is incorrect or new password constraints aren't met).
    • Default Value: null (no error message displayed).
    • Effect of Changes: Conditional rendering displays the message in red text to inform the user of the encountered issue.

Success Prop

  1. Name: success
    • Input Type: String or null
    • Purpose: Displays a success message to acknowledge that the password has been changed successfully.
    • Default Value: null (no success message displayed).
    • Effect of Changes: Conditional rendering shows the success text in green, enhancing user feedback upon successful password change.

Component Mechanics

The ChangePasswordForm component manages state through its parent component. Users input their current password, new password, and a confirmation of the new password into styled input fields. The component includes validation messaging to guide users to input data correctly.

When a user types into any password field:

The design of the component promotes accessibility, using clear labels and contrasting text colors that adapt to light and dark theme environments.

Use Cases & Examples

Use Case 1: User Account Security Management

A user on the Vantage platform needs to change their password due to a security concern, such as a potential data breach. The ChangePasswordForm allows them to quickly and securely modify their login credentials.

Use Case 2: Regular Password Updates

An organization mandates its employees to regularly update their passwords as part of its security policy. The ChangePasswordForm enables employees to meet this requirement easily.

Use Case 3: Integration with User Account Management

In a system that requires user accounts for access, administrators can integrate the ChangePasswordForm into their user management dashboard, allowing users to modify their credentials without requiring admin intervention.

Example Configuration

To change the password for a user, the parent component that uses ChangePasswordForm could pass the following props:

javascript
const UserProfile = () => {
    const [formData, setFormData] = initState({
        oldPassword: '',
        newPassword: '',
        confirmPassword: ''
    });

    const [error, setError] = initState(null);
    const [success, setSuccess] = initState(null);

    const handleChange = (field, value) => {
        setFormData(prev => ({
            ...prev,
            [field]: value
        }));
        setError(null);  // Clear error on user input
        setSuccess(null); // Clear success message on user input
    };

    const handleSubmit = async () => {
        // Implement password change logic here
        // This should update the user password in the database
        const response = await changeUserPassword(formData);
        
        if (response.error) {
            setError(response.error);
        } else {
            setSuccess("Password changed successfully!");
        }
    };

    return (
        <ChangePasswordForm 
            data={formData}
            onChange={handleChange}
            error={error}
            success={success}
        />
    );
};

In this example: