101 lines
2.5 KiB
HTML
101 lines
2.5 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="zh-Hant">
|
||
|
<head>
|
||
|
<meta charset="UTF-8" />
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||
|
<title>出入驗證</title>
|
||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||
|
<style>
|
||
|
body {
|
||
|
background-color: #f7f8fa;
|
||
|
font-family: 'Noto Sans TC', sans-serif;
|
||
|
}
|
||
|
header {
|
||
|
background-color: #9eaf9f;
|
||
|
color: #fff;
|
||
|
padding: 16px;
|
||
|
font-size: 20px;
|
||
|
font-weight: bold;
|
||
|
text-align: center;
|
||
|
position: relative;
|
||
|
}
|
||
|
.back-button {
|
||
|
position: absolute;
|
||
|
top: 12px;
|
||
|
left: 16px;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
.back-button img {
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
filter: brightness(0) invert(1);
|
||
|
}
|
||
|
.verify-container {
|
||
|
background-color: #fff;
|
||
|
margin: 20px;
|
||
|
padding: 30px 20px;
|
||
|
border-radius: 12px;
|
||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||
|
text-align: center;
|
||
|
}
|
||
|
.illustration {
|
||
|
width: 160px;
|
||
|
margin-bottom: 20px;
|
||
|
}
|
||
|
.status-message {
|
||
|
margin-top: 20px;
|
||
|
font-size: 18px;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
.success { color: green; }
|
||
|
.fail { color: red; }
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<header>
|
||
|
<div class="back-button">
|
||
|
<img src="https://img.icons8.com/ios-filled/50/ffffff/left.png" onclick="history.back()" />
|
||
|
</div>
|
||
|
出入驗證
|
||
|
</header>
|
||
|
|
||
|
<div class="verify-container">
|
||
|
<!-- 美工圖:臉部辨識插圖 -->
|
||
|
<img src="https://img.icons8.com/color/160/face-id.png" alt="Face ID" class="illustration">
|
||
|
|
||
|
<p class="mb-4">請點擊下方按鈕,啟動臉部或指紋辨識進行驗證</p>
|
||
|
|
||
|
<button class="btn btn-primary btn-lg w-100" onclick="startBiometric()">開始驗證</button>
|
||
|
|
||
|
<div id="statusMessage" class="status-message"></div>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
async function startBiometric() {
|
||
|
const status = document.getElementById('statusMessage');
|
||
|
|
||
|
if (!window.PublicKeyCredential) {
|
||
|
status.innerHTML = '<span class="fail">❌ 此裝置不支援生物辨識。</span>';
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
const result = await navigator.credentials.get({
|
||
|
publicKey: {
|
||
|
challenge: new Uint8Array(32),
|
||
|
allowCredentials: [],
|
||
|
timeout: 60000,
|
||
|
userVerification: "required"
|
||
|
}
|
||
|
});
|
||
|
|
||
|
status.innerHTML = '<span class="success">✅ 驗證成功,歡迎進入活動現場!</span>';
|
||
|
} catch (err) {
|
||
|
status.innerHTML = `<span class="fail">❌ 驗證失敗:${err.message}</span>`;
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|