-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
<title>查询验证码</title>
<style>
body { font-family: Arial, sans-serif; }
.container { max-width: 400px; margin: 50px auto; text-align: center; }
input[type="text"] { padding: 10px; width: 100%; margin: 10px 0; }
button { padding: 10px 20px; cursor: pointer; }
.result { margin-top: 20px; }
</style>
<script>
// 设置Worker URL
const WORKER_URL = "https://your-worker-subdomain.pages.dev"; // 请替换为实际的 Worker URL
async function getVerificationCode() {
const email = document.getElementById('email').value.trim();
if (!email) {
alert("请输入邮箱地址");
return;
}
try {
// 从后台获取JWT
const response = await fetch(`${WORKER_URL}/get-jwt?email=${email}`, { method: 'GET' });
const data = await response.json();
if (!data.jwt) {
alert("无法获取JWT,请检查邮箱地址或后台设置");
return;
}
// 查询验证码
const res = await fetch(WORKER_URL, {
method: 'GET',
headers: {
"Authorization": `Bearer ${data.jwt}`,
"Content-Type": "application/json"
}
});
const result = await res.json();
if (result.success) {
document.getElementById('result').innerHTML = `验证码: ${result.verificationCode}`;
} else {
document.getElementById('result').innerHTML = `错误: ${result.message}`;
}
} catch (error) {
alert("查询失败,请重试!");
console.error(error);
}
}
</script>
查询验证码
查询验证码Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels