Handling form POST from another site.



  • All, I’m totally aware that this is not a quasar specific question - it’s much more related to Vue.js and Vue-Router, but I’d like to ask it here because I’ve found this forum very helpful in the past, and I’m very appreciative that this community is here.

    Our site needs to handle a login form on an external third party site - totally unrelated from our Vue.js/Quasar built site. Submitted form elements are a username and password. The external site is doing a POST to a page on our site.

    <form id=“loginForm” method=“post” action=“http://www.mysite.com/siteLogin” onsubmit=“return setParamStatus();”>
    <input type=“text” autocomplete=“off” id=“userid” name=“userid” size=“23” maxlength=“18” placeholder=“Username”>
    <input type=“password” id=“password” name=“password” size=“23” maxlength=“18” placeholder=“Password”>
    <input type=“image” src="./loginButton.jpg" width=“97” height=“31” alt=“Sign in” id=“submitBtn”>
    </form>

    In my routes.js I’m defining

      {
        path: '/siteLogin',
        name: 'Site Login',
        component: () => import('components/home/siteLogin'),
        props: (route) => ({
          params: route.params
        })
      }
    

    But it’s not working. I’m getting a ‘cannot /POST’ message in the browser.

    I’d like to get to the params field from within siteLogin.vue and do the login/etc with the username/password.

    So the big question is how can I get to the form POST parameters (username, password) from within a Vue.js component/page?

    Any help would be appreciated.

    Thanks, Jeff.



  • Any help would be appreciated.



  • hey @jeffatpf … you have to differentiate between backend & frontend routing. vue-router is only in the browser…
    but sending a html form requires a backend handler like in php python etc… the browser then sends the form data to your backend…



  • I figured this out, it was not possible (nor did it make sense) to implement it in the manner with which I hoped/envisioned. A mix of backend/cookies/frontend did the trick.