是否可以通过电子邮件中的点击来预先填充网站上的密码字段?

I'm working on building an email for a client. They want the email to drive to their landing page which is gated.

Is it possible to click a URL in an email and have it auto-generate the Username and Password for the website?

The website only has one login so it would be the same for all recipients of the email.

Thanks,

Why don't you build the web page with login and password already filled.

For instance:

<form method="POST" action="http://">
    <label for="username">Username:</label> 
    <input placeholder="MyLogin" id="username" name="username" size="15">
  <br /><br />
    <label for="password">Password:</label> 
    <input placeholder="MyPassword" type="password" id="password" name="password" size="15">
  <br /><br />
    <input type="submit" value="Login">
    </form>

</div>

It's possible but not sure if it's the most secure thing to do.

If I were to implement, I'd :

  1. Create a system to issue a token that ties to the user in the system and probably have some sort of expiration and "used" flag to prevent sharing of the link.

  2. Create a landing page/api endpoint that looks for the token, retrieves the user's credentials and follow through the login workflow for whatever handles authentication.

  3. The link in the email would take you directly to the landing page/api endpoint along with the token issued for the user. Once it hits this processing page, check if the token has already been used or not, check for expiration, mark the token as "used", and continue with authentication.

I have done something similar to this (although doing this with passwords is not recommended).

place some code on your landing page that checks the URL when the page loads:

window.onload = function(){
  var key = window.location.search; // grab the ?XXX part of the URL
  if (key == '?some_key'){
    populateInputs(); // function to fill user/pass
  }
}

And then you can send out a link like this: www.thesite.com/landingPage.html?some_key

This is just a barebones example that hopefully gives you an idea of how to accomplish your task.