-
-
-
S
-
+
+
+
+
+
+
Skin Hub 游戏皮肤分销平台
-
+
账号密码 + 短信验证码 + DCAuth 本机设备签名
@@ -146,14 +210,19 @@ export default function Login() {
/>
) : null}
-
}
+ prefix={}
placeholder="用户名(支持中文 / 英文)"
size="large"
autoComplete="username"
@@ -163,11 +232,11 @@ export default function Login() {
}
+ prefix={}
placeholder="密码"
size="large"
autoComplete="current-password"
@@ -177,12 +246,14 @@ export default function Login() {
}
- placeholder={`6 位短信验证码${phoneMasked ? `(${phoneMasked})` : ''}`}
+ prefix={
+
+ }
+ placeholder={`6 位短信验证码${phoneMasked ? `(${phoneMasked})` : ""}`}
size="large"
maxLength={6}
autoComplete="one-time-code"
@@ -195,9 +266,9 @@ export default function Login() {
loading={sending}
disabled={countdown > 0}
onClick={() => void sendCode()}
- style={{ padding: 0, height: 'auto' }}
+ style={{ padding: 0, height: "auto" }}
>
- {countdown > 0 ? `${countdown}s 后重发` : '获取验证码'}
+ {countdown > 0 ? `${countdown}s 后重发` : "获取验证码"}
}
/>
@@ -216,8 +287,9 @@ export default function Login() {
borderRadius: 8,
fontSize: 15,
fontWeight: 600,
- background: 'linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)',
- boxShadow: '0 4px 14px rgba(37, 99, 235, 0.4)',
+ background:
+ "linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)",
+ boxShadow: "0 4px 14px rgba(37, 99, 235, 0.4)",
}}
>
安全登录 · 拉起本机验证
@@ -225,54 +297,71 @@ export default function Login() {
-
- 未绑定手机号的历史账号
+
+
+ 未绑定手机号的历史账号
+
-
- )
+ );
}
async function waitForDevice(prepared: PreparedDeviceLogin) {
for (let attempt = 0; attempt < 120; attempt += 1) {
- await sleep(1000)
- const status = await authApi.deviceChallengeStatus(prepared.challengeId, prepared.pollToken)
- if (status.status === 'authorized' && status.deviceTicket) {
+ await sleep(1000);
+ const status = await authApi.deviceChallengeStatus(
+ prepared.challengeId,
+ prepared.pollToken,
+ );
+ if (status.status === "authorized" && status.deviceTicket) {
return authApi.completeLogin({
challengeId: prepared.challengeId,
pollToken: prepared.pollToken,
deviceTicket: status.deviceTicket,
- })
+ });
}
- if (status.status === 'expired' || status.status === 'rejected') {
- throw new Error(status.message || '本机验证已过期,请重新登录')
+ if (status.status === "expired" || status.status === "rejected") {
+ throw new Error(status.message || "本机验证已过期,请重新登录");
}
if (attempt === 4) {
- message.info('如果浏览器没有弹出 DCAuth,请先安装并运行一次 DCAuth 客户端')
+ message.info(
+ "如果浏览器没有弹出 DCAuth,请先安装并运行一次 DCAuth 客户端",
+ );
}
}
- throw new Error('等待本机验证超时,请确认 DCAuth 已安装并允许浏览器唤起')
+ throw new Error("等待本机验证超时,请确认 DCAuth 已安装并允许浏览器唤起");
}
function launchProtocol(url: string) {
- const anchor = document.createElement('a')
- anchor.href = url
- anchor.style.display = 'none'
- document.body.appendChild(anchor)
- anchor.click()
- window.setTimeout(() => anchor.remove(), 1000)
+ const anchor = document.createElement("a");
+ anchor.href = url;
+ anchor.style.display = "none";
+ document.body.appendChild(anchor);
+ anchor.click();
+ window.setTimeout(() => anchor.remove(), 1000);
}
function sleep(ms: number) {
- return new Promise((resolve) => window.setTimeout(resolve, ms))
+ return new Promise((resolve) => window.setTimeout(resolve, ms));
}