code: def change_password(self):
          
          form = self._get_form('SECURITY_CHANGE_PASSWORD_FORM')
          if form.validate_on_submit():
              self.security_service.change_password(
                  current_user._get_current_object(),
                  form.new_password.data)
              self.after_this_request(self._commit)
              self.flash(_('flask_unchained.bundles.security:flash.password_change'),
                         category='success')
              if request.is_json:
                  return self.jsonify({'token': current_user.get_auth_token()})
              return self.redirect('SECURITY_POST_CHANGE_REDIRECT_ENDPOINT',
                                   'SECURITY_POST_LOGIN_REDIRECT_ENDPOINT')
  
          elif form.errors and request.is_json:
              return self.errors(form.errors)
  
          return self.render('change_password',
                             change_password_form=form,
                             **self.security.run_ctx_processor('change_password'))
docs: View function for a user to change their password.
          Supports html and json requests.