Is it possible for the data submitted in a POST request to be converted into URL parameters?

Our technology stack:

  • Frontend built with Vue.js and utilizing the vuetify component library
  • Custom Python middleware REST API using Flask + Tornado
  • External Matomo setup connected to the frontend via the vue-matomo plugin system (https://github.com/AmazingDreams/vue-matomo)

We recently integrated Matamo into our website and have observed an unusual occurrence. Occasionally, out of thousands of users, we noticed that the username and password submitted via a POST request to our middleware is being logged in Matomo as .

Oddly, even though the actual login route is at somesite.com/login, Matamo seems to capture it on the homepage.

Below is the code snippet for authenticating users:

auth.js

const authenticateUser = async (username, password) => {
const body = { username: username, password: password }
const headers = new Headers()
headers.append('Content-Type', 'application/json')
headers.append('Accept', 'application/json')
try {
  const response = await fetch('https://somesite.com/users/login', {
    method: 'POST',
    ...(body ? { body: JSON.stringify(body) } : {}),
    cache: 'no-store',
    credentials: 'include', // this is to allow cross-origin requests to our middleware microservice
    headers: headers
  })
  return response
} catch (error) {
  return false
}
}

Login Form

<v-form @submit.prevent="submit" @keyup.native.enter="submit" id="check-login-form">
            <v-text-field
              class="input-field"
              label="MS ID"
              v-model="username"
              name="username"
              data-cy="userName"
              prepend-icon="mdi-account"
              type="text"
              color="rgb(232, 119, 34)"
            />
            <div class="password-field">
              <v-text-field
                class="input-field"
                id="password"
                data-cy="userPassword"
                label="Password"
                v-model="password"
                name="password"
                prepend-icon="mdi-lock"
                :type="showPassword ? 'text' : 'password'"
                @click:append="showPassword = !showPassword"
                color="rgb(232, 119, 34)"
              ></v-text-field>
              <div v-if="showPassword" class="icon-container" v-on:click="toggleShowPassword">
                <img src="~assets/Icons/View.svg" class="eye-icon" />
              </div>
              <div v-else class="icon-container" v-on:click="toggleShowPassword">
                <img src="~assets/Icons/ViewHide.svg" class="eye-icon" />
              </div>
            </div>
          </v-form>

Submit Method

async submit() {
      this.isLoading = true
      const response = await authenticateUser(this.username, this.password)
      this.statusCode = response.status
      this.currentStatusCode = this.statusCode
      if (this.statusCode === 200) {
        this.currentStatusCode = this.statusCode
        this.$router.push('/')
        this.isLoading = false
        this.$matomo.setUserId(this.username)
      } else {
        this.isLoading = false
        this.currentStatusCode = null
        this.showPassword = false
      }
    },
    toggleShowPassword: function() {
      this.showPassword = !this.showPassword
    }
  },

Any thoughts on why this issue might be occurring?

Answer №1

To fix this issue, we found that by including the method="POST" attribute in the <v-form> element, we were able to prevent the form from occasionally submitting as GET. This was causing the form parameters to be included in the URL as URL parameters.

 <v-form
   method="POST"
   enctype="text/plain"
   @submit.prevent="submit"
   @keyup.native.enter="submit"
   id="check-login-form"
 >...</v-form>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am looking to optimize my WordPress posts to load in increments as the user scrolls down the page, similar to how Facebook does

I am looking to implement a feature on my WordPress post where the content loads a few at a time as the user scrolls, similar to Facebook. Specifically, I would like my webpage to automatically load 10 posts and then continue loading 10 more as the user re ...

Inability to assign a value to an @input within an Angular project

I recently started using Angular and I'm currently trying to declare an input. Specifically, I need the input to be a number rather than a string in an object within an array. However, I'm encountering difficulties and I can't figure out wha ...

By simply clicking a button in a React component, I aim to alter the font style of the text

function makeTextBold() { const boldText = document.querySelector('.form-control'); boldText.style.fontWeight = 'bold'; setText(boldText); } When I click the button, it redirects me to a blank page in the browser. ...

React Alert: Please be advised that whitespace text nodes are not allowed as children of <tr> elements

Currently, I am encountering an error message regarding the spaces left in . Despite my efforts to search for a solution on Stack Overflow, I have been unable to find one because my project does not contain any or table elements due to it being built with ...

What is the reason behind being able to assign unidentified properties to a literal object in TypeScript?

type ExpectedType = Array<{ name: number, gender?: string }> function go1(p: ExpectedType) { } function f() { const a = [{name: 1, age: 2}] go1(a) // no error shown go1([{name: 1, age: 2}]) // error displayed ...

The React-FontAwesome icon is unable to display when a favicon has been set

I encountered an issue while using the react-fontawesome module to display brand icons. Whenever I set a favicon in <Head>...</Head> (imported from next/head), all the react-fontawesome icons disappear. Can someone please advise me on how to re ...

Updating the value of an HTML table cell when the data in local storage is changed using JavaScript

In my JavaScript code, I have a function that retrieves data from an API and stores it in the browser's localStorage. The API fetches ETA data and saves it in localStorage using the key id_ETA (e.g., 12342_ETA). I want the values in the HTML table&a ...

Is it possible to use a shell script to replace the external CSS file link in an HTML file with the actual content of the CSS file

Seeking a solution for replacing external CSS and JS file links in an HTML document with the actual content of these files. The current structure of the HTML file is as follows: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C ...

Getting the button element in Angular when submitting a form

My web page contains multiple forms, each with a set of buttons. I want to incorporate a loading spinner on buttons after they are clicked. When using a regular click event, I am able to pass the button element: HTML <button #cancelButton class="butto ...

What is the proper method for overriding styles in material-ui v5 for properties that are not present in the themes components?

Currently, I am customizing MuiDataTables using the adaptv4theme in the following manner: declare module '@material-ui/core/styles/overrides' { export interface ComponentNameToClassKey { MUIDataTable: any; MUIDataTableFilterList: any; ...

Convert alias query strings into parameters

I am currently working on a project that involves using node, express, and jade. I need to be able to access content through two different URLs: /Page/foo/bar and /Page?Foo=foo&Bar=bar The goal is for the top URL to act as an alias for the bottom o ...

When a user clicks on an element, use jQuery to show a specific

I am looking to extract the Admission ID field within a separate function that triggers when a user clicks on a button. $(document).ready(function () { $.each(data.student, function (i, item){ trHTML += '<tr>'+ ...

Incorporating JavaScript/JSON into your Ebay listings to seamlessly receive user-selected choices

There has been a trend among Ebay users to incorporate dynamic data fetching and sending from external sources in their listings. This could be for implementing a shipping calculator or offering different product variants through dropdown lists. You can c ...

Exploring Non Blocking IO through an Example

While browsing through a node.js tutorial, I stumbled upon this informative page that uses the example of a "Restaurant service" to explain a scenario. In the context of Blocking IO, they provide the following code snippet: // requesting drinks for table ...

Is authorization (JWT) required for accessing posts when using Next.js with headless WordPress?

Currently, I am in the process of developing a Next.js website that is integrated with headless Wordpress. I am considering either using the REST API or possibly exploring the GraphQL alternative. My main concern revolves around whether implementing author ...

The jQuery script tag fails to recognize click events once dynamically loaded with the load event

Hey there, I recently utilized this script in a SAP WebDynpro setup to dynamically load and employ jQuery. The onload event of the script tag is functioning well as I can select the text of the focused element. However, I am facing issues with registering ...

Are you experiencing issues with your Ajax request?

I've been struggling to retrieve json data from an API. Despite my efforts, the GET request seems to be executing successfully and returning the correct data when I check the Net tab in Firebug. Can anyone offer advice on what could be going wrong or ...

encountering problems with Next.js routing resulting in 404 errors

I developed a Next Js 14 app where I had to change the routing names inside the pages before going live. For example, instead of 'Charts', I changed it to 'charts' and made similar modifications to other pages as well. However, after de ...

Messages and responses from an array within a discord.js bot

Currently, I am attempting to set up my discord.js version 12.0.0 bot to react to specific words using arrays for words and corresponding responses. However, I am encountering the following error message: TypeError: Cannot read property 'split' o ...

ng-required is ineffective when used with number inputs that have a minimum value requirement

In my form, I have implemented a checkbox that, when checked, toggles the visibility of a div using AngularJS's ng-show. Within this div, there is an input field of type "number" with a validation setting of min="10000". I am trying to prevent the f ...