feat: 授权关联用户账号 — 登录记录设备, 激活时卡密存账号, 换设备登录自动授权(最多10台), 用户中心显示授权状态

This commit is contained in:
personal82555 committed 2026-10-12 12:32:13 +08:00
1 parent 3cd73d7f62
commit 70e03feca6
4 files changed
+133 -4

No files matched your search

+3 -2
View File
@@ -1,4 +1,5 @@
import { computed, ref } from 'vue';
import { licenseHeaders } from '@/tools/license/license';
const TOKEN_KEY = 'it-tools-auth';
@@ -52,7 +53,7 @@ export function useUserAuth() {
async function login(u: string, p: string, cfToken = '') {
const { status, body } = await apiFetch('/user/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', ...licenseHeaders() },
body: JSON.stringify({ username: u, password: p, cf_token: cfToken }),
});
if (status !== 200) {
@@ -66,7 +67,7 @@ export function useUserAuth() {
async function register(u: string, p: string, cfToken = '') {
const { status, body } = await apiFetch('/user/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', ...licenseHeaders() },
body: JSON.stringify({ username: u, password: p, cf_token: cfToken }),
});
if (status !== 200) {