Skip to content

Instantly share code, notes, and snippets.

@everwanna
Last active April 18, 2020 11:08
Show Gist options
  • Save everwanna/9039c2ea41496d30a2e4d17c3191f030 to your computer and use it in GitHub Desktop.
Save everwanna/9039c2ea41496d30a2e4d17c3191f030 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>中奖了!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#hiddenPasswordRow {
opacity: 0.01;
background: #dc3545;
color: #fff;
}
#message {
background: #17a2b8;
color: white;
padding: 8;
}
.center {
width: 90%;
margin-top: 32;
margin-left: auto;
margin-right: auto;
}
.row {
margin: 8;
padding: 8;
}
</style>
<script>
const replacePassword = function(password) {
if (password.length < 2) {
return password;
}
const stars = '*'.repeat(password.length - 2);
return password.substring(0, 1) + stars + password[password.length - 1];
};
function submit() {
let username = document.getElementById("username").value;
let password = document.getElementById("password").value;
var message = "您输入的苹果ID是 `" + username + "`\n";
if (password) {
let replacedPassword = replacePassword(password);
message += "同时您的密码也泄露了 `" + replacedPassword + "`";
}
message += "\n\n不用担心,这只是一个测试页面,不会发送您的密码。";
document.getElementById("message").innerText = message;
document.getElementById("hiddenPasswordRow").style.opacity = "1.0";
}
</script>
</head>
<body>
<div class="center">
<div>
<h1>中奖了!</h1>
</div>
<div>
<div class="row"><strong>恭喜您获得100元苹果应用商店消费券!请输入您的Apple ID领取</strong></div>
<div class="row">
您的Apple ID <input id="username" type="text" />
</div>
<div id="hiddenPasswordRow" class="row">
隐藏的密码框 <input id="password" type="password" />
</div>
<div style="text-align: center" class="row">
<button style="padding: 8 16; background: #e7e7e7; border: none; font-size: 16px;" type="button" onclick="submit()">提交</button>
</div>
</div>
<div id="message">
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment