code: def change_password_view(self):
          
  
          # Initialize form
          form = self.ChangePasswordFormClass(request.form)
  
          # Process valid POST
          if request.method == 'POST' and form.validate():
              # Hash password
              new_password = form.new_password.data
              password_hash = self.hash_password(new_password)
  
              # Update user.password
              current_user.password = password_hash
              self.db_manager.save_object(current_user)
              self.db_manager.commit()
  
              # Send password_changed email
              if self.USER_ENABLE_EMAIL and self.USER_SEND_PASSWORD_CHANGED_EMAIL:
                  self.email_manager.send_password_changed_email(current_user)
  
              # Send changed_password signal
              signals.user_changed_password.send(current_app._get_current_object(), user=current_user)
  
              # Flash a system message
              flash(_('Your password has been changed successfully.'), 'success')
  
              # Redirect to 'next' URL
              safe_next_url = self._get_safe_next_url('next', self.USER_AFTER_CHANGE_PASSWORD_ENDPOINT)
              return redirect(safe_next_url)
  
          # Render form
          self.prepare_domain_translations()
          return render_template(self.USER_CHANGE_PASSWORD_TEMPLATE, form=form)
docs: Prompt for old password and new password and change the user's password.