Bootstrap Form for login to another site

Viewed 35

I have inherited a template that I can use for my website and the login page then redirects to a subdomain.

https://www.premium-hosting.co.uk/login when the data is inputted it directs to https://cp.premium-hosting.co.uk/login?

The issue I have is the login details don't appear to copy over and then the users have to input their details yet again and hit submit.

I have researched all I can, I cannot seem to find a solution to this issue. Below is the HTML and JS used for the login,

There is also a JSON file :

{ "shopUrl" : "https://cp.premium-hosting.co.uk/", "presalesUrl" : "" }

var init_script_path = document.currentScript ?
  document.currentScript.src :
  $("script[src$=\"/init.js\"]").last().attr("src");
$(function() {
  var init_script_dir = init_script_path.replace(new RegExp("/+[^/]*$"), "");
  $.getJSON(init_script_dir + "/../../config.json").then(function(config) {

    $("a[data-shop-href]").each(
      /**
       * @param {number} i
       * @param {HTMLAnchorElement} e
       */
      function(i, e) {
        var url = config.shopUrl;
        e.href = url + e.dataset.shopHref;
      }
    );

    $("form[data-shop-action]").each(
      /**
       * @param {number} i
       * @param {HTMLFormElement} e
       */
      function(i, e) {
        var url = config.shopUrl;
        e.action = url + e.dataset.shopAction;
      }
    );
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<section class="py-6">
  <div class="container">
    <div class="row">
      <div class="col-lg-6 mx-auto">
        <div class="card">
          <div class="card-body">
            <div class="icon mx-auto"><i class="fas fa-key text-primary fa-3x"></i></div>
            <h1 class="h3 mb-6 card-title text-center">Sign in to <span class="text-primary">Premium-Hosting</span></h1>
            <form class="form-signin" data-shop-action="login" action="submit">
              <div class="form-group">
                <label class="sr-only" for="inputEmail">Email address</label>
                <input class="form-control" id="inputEmail" type="email" placeholder="Email address" required="" autofocus="">
              </div>
              <div class="form-group">
                <label class="sr-only" for="inputPassword">Password</label>
                <input class="form-control" id="inputPassword" type="password" placeholder="Password" required="">
              </div>
              <div class="checkbox mb-3">
                <label>
                    <input type="checkbox" value="remember-me"> Remember me</label>
              </div>
              <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
            </form>
            <div class="my-3 lead">
              <a href="https://cp.premium-hosting.co.uk/recover-password">Forgot your details?</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

0 Answers
Related