Update index.html
Browse files- index.html +38 -131
index.html
CHANGED
|
@@ -372,67 +372,26 @@ gtag('config', 'G-Z920J6JQHG', {
|
|
| 372 |
|
| 373 |
<div id="login-gate">
|
| 374 |
<div class="login-card">
|
| 375 |
-
<img src="https://forlinx.net/image/logo/forlinx-logo.svg" alt="Forlinx"
|
| 376 |
<h2 id="auth-title">Resource Center</h2>
|
| 377 |
-
<p id="auth-desc"
|
| 378 |
|
| 379 |
-
<div id="reg-name-field" style="display: none;">
|
| 380 |
-
<input type="text" id="username" class="auth-input" placeholder="Full Name / Company Name">
|
| 381 |
-
</div>
|
| 382 |
-
|
| 383 |
<input type="email" id="email" class="auth-input" placeholder="Business Email">
|
| 384 |
-
|
| 385 |
-
<div id="reg-code-field" style="display: none;">
|
| 386 |
-
<input type="text" id="v-code" class="auth-input" placeholder="Verification Code (Optional)">
|
| 387 |
-
</div>
|
| 388 |
-
|
| 389 |
<input type="password" id="password" class="auth-input" placeholder="Password">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
|
| 391 |
-
<div id="reg-confirm-field" style="display: none;">
|
| 392 |
-
<input type="password" id="confirm-password" class="auth-input" placeholder="Confirm Password">
|
| 393 |
-
</div>
|
| 394 |
-
|
| 395 |
-
<div id="login-extra" style="text-align: right; margin-top: -8px; margin-bottom: 15px;">
|
| 396 |
-
<a id="forgot-pwd" style="font-size: 13px; color: var(--forlinx-blue); text-decoration: none; cursor: pointer;">Forgot Password?</a>
|
| 397 |
-
</div>
|
| 398 |
-
|
| 399 |
-
<div id="terms-container" style="display: none; text-align: left; margin-bottom: 15px;">
|
| 400 |
-
<label style="font-size: 12px; color: #64748b; cursor: pointer; display: flex; align-items: flex-start; gap: 8px;">
|
| 401 |
-
<input type="checkbox" id="terms-checkbox" style="margin-top: 2px;">
|
| 402 |
-
<span>I agree to the <a href="javascript:void(0)" id="open-agreement-link" style="color: var(--forlinx-blue); text-decoration: underline; cursor: pointer;">User Registration Agreement</a>.</span>
|
| 403 |
-
</label>
|
| 404 |
-
</div>
|
| 405 |
-
|
| 406 |
<button class="btn-auth" id="btn-main-action">Login</button>
|
| 407 |
|
| 408 |
-
<div class="auth-toggle"
|
| 409 |
<span id="toggle-text">Don't have an account?</span>
|
| 410 |
-
<a id="toggle-link"
|
| 411 |
</div>
|
| 412 |
</div>
|
| 413 |
</div>
|
| 414 |
|
| 415 |
-
<div id="agreementModal" class="modal">
|
| 416 |
-
<div class="modal-content">
|
| 417 |
-
<span class="close-modal" onclick="closeAgreement()">×</span>
|
| 418 |
-
<h3 style="color:var(--forlinx-blue);">Forlinx User Agreement</h3>
|
| 419 |
-
<div style="height: 300px; overflow-y: auto; font-size: 13px; line-height: 1.6; color: #555; border-top: 1px solid #eee; padding-top: 15px;">
|
| 420 |
-
<p>Welcome to <b>Forlinx Embedded Resource Center</b>. By creating an account, you agree to the following terms:</p>
|
| 421 |
-
<ul>
|
| 422 |
-
<li><b>Service Scope:</b> Resources are for technical support and product development.</li>
|
| 423 |
-
<li><b>User Conduct:</b> Accurate info is required. Reverse engineering is prohibited.</li>
|
| 424 |
-
<li><b>Data Privacy:</b> We collect business info to provide technical support per our Privacy Policy.</li>
|
| 425 |
-
<li><b>Ownership:</b> All resources belong to Forlinx Embedded Technology Co., Ltd.</li>
|
| 426 |
-
<li><b>Law:</b> This agreement is governed by the laws of the P.R.C.</li>
|
| 427 |
-
</ul>
|
| 428 |
-
</div>
|
| 429 |
-
<div style="text-align: center; margin-top: 20px;">
|
| 430 |
-
<button class="btn-auth" onclick="closeAgreement()" style="width: 120px;">I AGREE</button>
|
| 431 |
-
</div>
|
| 432 |
-
</div>
|
| 433 |
-
</div>
|
| 434 |
-
|
| 435 |
-
|
| 436 |
<div id="main-portal">
|
| 437 |
<div id="tutorialModal" class="modal">
|
| 438 |
<div class="modal-content">
|
|
@@ -740,42 +699,12 @@ gtag('config', 'G-Z920J6JQHG', {
|
|
| 740 |
|
| 741 |
|
| 742 |
</script>
|
| 743 |
-
|
| 744 |
-
// 确保弹窗逻辑在全局作用域生效
|
| 745 |
-
function openAgreement() {
|
| 746 |
-
const modal = document.getElementById('agreementModal');
|
| 747 |
-
if (modal) modal.style.display = "block";
|
| 748 |
-
}
|
| 749 |
-
|
| 750 |
-
function closeAgreement() {
|
| 751 |
-
const modal = document.getElementById('agreementModal');
|
| 752 |
-
if (modal) modal.style.display = "none";
|
| 753 |
-
}
|
| 754 |
-
|
| 755 |
-
// 绑定点击事件
|
| 756 |
-
document.addEventListener('DOMContentLoaded', () => {
|
| 757 |
-
const link = document.getElementById('open-agreement-link');
|
| 758 |
-
if (link) {
|
| 759 |
-
link.onclick = (e) => {
|
| 760 |
-
e.preventDefault();
|
| 761 |
-
openAgreement();
|
| 762 |
-
};
|
| 763 |
-
}
|
| 764 |
-
});
|
| 765 |
-
|
| 766 |
-
// 点击弹窗外部也可以关闭 (增��体验)
|
| 767 |
-
window.onclick = function(event) {
|
| 768 |
-
const modal = document.getElementById('agreementModal');
|
| 769 |
-
if (event.target == modal) {
|
| 770 |
-
closeAgreement();
|
| 771 |
-
}
|
| 772 |
-
}
|
| 773 |
-
</script>
|
| 774 |
<script type="module">
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
import { getAuth, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, sendPasswordResetEmail, updateProfile } from "https://www.gstatic.com/firebasejs/10.0.0/firebase-auth.js";
|
| 778 |
|
|
|
|
| 779 |
const firebaseConfig = {
|
| 780 |
apiKey: "AIzaSyCCSxDqAjcysldz_lG3azcMIKPQ5wt_M3w",
|
| 781 |
authDomain: "forlinx-download-center.firebaseapp.com",
|
|
@@ -790,84 +719,62 @@ gtag('config', 'G-Z920J6JQHG', {
|
|
| 790 |
const auth = getAuth(app);
|
| 791 |
let isLoginMode = true;
|
| 792 |
|
| 793 |
-
|
| 794 |
-
onAuthStateChanged(auth, (user) => {
|
| 795 |
if (user) {
|
| 796 |
document.getElementById('login-gate').style.display = 'none';
|
| 797 |
document.getElementById('main-portal').style.display = 'block';
|
| 798 |
-
|
| 799 |
-
// 修正:确保在资源加载函数定义后再调用
|
| 800 |
-
const checkAndLoad = () => {
|
| 801 |
-
if (typeof loadPath === "function") {
|
| 802 |
-
loadPath(getPathFromUrl());
|
| 803 |
-
} else {
|
| 804 |
-
setTimeout(checkAndLoad, 100); // 如果没准备好,等100毫秒再试
|
| 805 |
-
}
|
| 806 |
-
};
|
| 807 |
-
checkAndLoad();
|
| 808 |
} else {
|
| 809 |
document.getElementById('login-gate').style.display = 'flex';
|
| 810 |
document.getElementById('main-portal').style.display = 'none';
|
| 811 |
}
|
| 812 |
});
|
| 813 |
|
| 814 |
-
//
|
| 815 |
document.getElementById('toggle-link').onclick = () => {
|
| 816 |
isLoginMode = !isLoginMode;
|
| 817 |
-
|
| 818 |
-
// 文案切换
|
| 819 |
document.getElementById('auth-title').innerText = isLoginMode ? "Resource Center" : "Create Account";
|
| 820 |
document.getElementById('btn-main-action').innerText = isLoginMode ? "Login" : "Register";
|
| 821 |
document.getElementById('toggle-link').innerText = isLoginMode ? "Register Now" : "Login Now";
|
| 822 |
-
document.getElementById('toggle-text').innerText = isLoginMode ? "Don't have an account?" : "Already have an account?";
|
| 823 |
-
|
| 824 |
-
// 字段动态显示
|
| 825 |
-
const regDisplay = isLoginMode ? 'none' : 'block';
|
| 826 |
-
document.getElementById('reg-name-field').style.display = regDisplay;
|
| 827 |
-
document.getElementById('reg-code-field').style.display = regDisplay;
|
| 828 |
-
document.getElementById('reg-confirm-field').style.display = regDisplay;
|
| 829 |
-
document.getElementById('terms-container').style.display = regDisplay;
|
| 830 |
-
|
| 831 |
-
// 登录专有字段
|
| 832 |
-
document.getElementById('login-extra').style.display = isLoginMode ? 'block' : 'none';
|
| 833 |
};
|
| 834 |
|
|
|
|
| 835 |
document.getElementById('btn-main-action').onclick = () => {
|
| 836 |
const email = document.getElementById('email').value;
|
| 837 |
const pass = document.getElementById('password').value;
|
| 838 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 839 |
if (isLoginMode) {
|
| 840 |
-
// 登录模式
|
| 841 |
-
if (!email || !pass) { alert("Please enter both email and password."); return; }
|
| 842 |
signInWithEmailAndPassword(auth, email, pass).catch(err => alert("Login failed: " + err.message));
|
| 843 |
} else {
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
const isAgreed = document.getElementById('terms-checkbox').checked;
|
| 848 |
-
|
| 849 |
-
if (!name || !email || !pass) { alert("Please fill in all required fields."); return; }
|
| 850 |
-
if (pass !== confirmPass) { alert("Passwords do not match!"); return; }
|
| 851 |
-
if (!isAgreed) { alert("Please agree to the User Registration Agreement."); return; }
|
| 852 |
-
|
| 853 |
-
createUserWithEmailAndPassword(auth, email, pass).then((userCredential) => {
|
| 854 |
-
// 将用户名存入 Firebase Profile,这样后台 Display Name 列就会显示姓名
|
| 855 |
-
updateProfile(userCredential.user, {
|
| 856 |
-
displayName: name
|
| 857 |
-
}).then(() => {
|
| 858 |
-
console.log("Registered Lead: " + name);
|
| 859 |
-
});
|
| 860 |
}).catch(err => alert("Registration failed: " + err.message));
|
| 861 |
}
|
| 862 |
};
|
| 863 |
|
|
|
|
| 864 |
document.getElementById('forgot-pwd').onclick = () => {
|
| 865 |
const email = document.getElementById('email').value;
|
| 866 |
-
if (!email) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 867 |
sendPasswordResetEmail(auth, email)
|
| 868 |
-
.then(() =>
|
| 869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
};
|
| 871 |
-
</script>
|
| 872 |
</body>
|
| 873 |
</html>
|
|
|
|
| 372 |
|
| 373 |
<div id="login-gate">
|
| 374 |
<div class="login-card">
|
| 375 |
+
<img src="https://forlinx.net/image/logo/forlinx-logo.svg" alt="Forlinx">
|
| 376 |
<h2 id="auth-title">Resource Center</h2>
|
| 377 |
+
<p id="auth-desc">Please sign in to access technical resources.</p>
|
| 378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
<input type="email" id="email" class="auth-input" placeholder="Business Email">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
<input type="password" id="password" class="auth-input" placeholder="Password">
|
| 381 |
+
|
| 382 |
+
<div style="text-align: right; margin-top: -8px; margin-bottom: 15px;">
|
| 383 |
+
<a id="forgot-pwd" style="font-size: 13px; color: var(--forlinx-blue); text-decoration: none; cursor: pointer; font-weight: 500;">Forgot Password?</a>
|
| 384 |
+
</div>
|
| 385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 386 |
<button class="btn-auth" id="btn-main-action">Login</button>
|
| 387 |
|
| 388 |
+
<div class="auth-toggle">
|
| 389 |
<span id="toggle-text">Don't have an account?</span>
|
| 390 |
+
<a id="toggle-link">Register Now</a>
|
| 391 |
</div>
|
| 392 |
</div>
|
| 393 |
</div>
|
| 394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
<div id="main-portal">
|
| 396 |
<div id="tutorialModal" class="modal">
|
| 397 |
<div class="modal-content">
|
|
|
|
| 699 |
|
| 700 |
|
| 701 |
</script>
|
| 702 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
<script type="module">
|
| 704 |
+
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.0.0/firebase-app.js";
|
| 705 |
+
import { getAuth, onAuthStateChanged, signInWithEmailAndPassword, createUserWithEmailAndPassword, sendPasswordResetEmail } from "https://www.gstatic.com/firebasejs/10.0.0/firebase-auth.js";
|
|
|
|
| 706 |
|
| 707 |
+
// Firebase 配置
|
| 708 |
const firebaseConfig = {
|
| 709 |
apiKey: "AIzaSyCCSxDqAjcysldz_lG3azcMIKPQ5wt_M3w",
|
| 710 |
authDomain: "forlinx-download-center.firebaseapp.com",
|
|
|
|
| 719 |
const auth = getAuth(app);
|
| 720 |
let isLoginMode = true;
|
| 721 |
|
| 722 |
+
// 核心监控:验证状态改变
|
| 723 |
+
onAuthStateChanged(auth, (user) => {
|
| 724 |
if (user) {
|
| 725 |
document.getElementById('login-gate').style.display = 'none';
|
| 726 |
document.getElementById('main-portal').style.display = 'block';
|
| 727 |
+
if (typeof loadPath === "function") loadPath(getPathFromUrl());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 728 |
} else {
|
| 729 |
document.getElementById('login-gate').style.display = 'flex';
|
| 730 |
document.getElementById('main-portal').style.display = 'none';
|
| 731 |
}
|
| 732 |
});
|
| 733 |
|
| 734 |
+
// 注册/登录 模式切换
|
| 735 |
document.getElementById('toggle-link').onclick = () => {
|
| 736 |
isLoginMode = !isLoginMode;
|
|
|
|
|
|
|
| 737 |
document.getElementById('auth-title').innerText = isLoginMode ? "Resource Center" : "Create Account";
|
| 738 |
document.getElementById('btn-main-action').innerText = isLoginMode ? "Login" : "Register";
|
| 739 |
document.getElementById('toggle-link').innerText = isLoginMode ? "Register Now" : "Login Now";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 740 |
};
|
| 741 |
|
| 742 |
+
// 执行 登录/注册
|
| 743 |
document.getElementById('btn-main-action').onclick = () => {
|
| 744 |
const email = document.getElementById('email').value;
|
| 745 |
const pass = document.getElementById('password').value;
|
| 746 |
|
| 747 |
+
if (!email || !pass) {
|
| 748 |
+
alert("Please enter both email and password.");
|
| 749 |
+
return;
|
| 750 |
+
}
|
| 751 |
+
|
| 752 |
if (isLoginMode) {
|
|
|
|
|
|
|
| 753 |
signInWithEmailAndPassword(auth, email, pass).catch(err => alert("Login failed: " + err.message));
|
| 754 |
} else {
|
| 755 |
+
createUserWithEmailAndPassword(auth, email, pass).then(() => {
|
| 756 |
+
console.log("User registered: " + email);
|
| 757 |
+
// 这里刚好预留给你的 Google Ads Conversion 转化代码
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 758 |
}).catch(err => alert("Registration failed: " + err.message));
|
| 759 |
}
|
| 760 |
};
|
| 761 |
|
| 762 |
+
// 忘记密码重置逻辑
|
| 763 |
document.getElementById('forgot-pwd').onclick = () => {
|
| 764 |
const email = document.getElementById('email').value;
|
| 765 |
+
if (!email) {
|
| 766 |
+
alert("Please enter your email address in the box first.");
|
| 767 |
+
return;
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
sendPasswordResetEmail(auth, email)
|
| 771 |
+
.then(() => {
|
| 772 |
+
alert("Password reset email sent! Please check your inbox (and spam folder).");
|
| 773 |
+
})
|
| 774 |
+
.catch((error) => {
|
| 775 |
+
alert("Error: " + error.message);
|
| 776 |
+
});
|
| 777 |
};
|
| 778 |
+
</script>
|
| 779 |
</body>
|
| 780 |
</html>
|