mirror of
https://github.com/labring/sealos.git
synced 2026-09-24 15:46:19 +08:00
feat(desktop): Add real-name restrictions (#5368)
This commit is contained in:
@@ -193,6 +193,20 @@ async function handlePost(
|
||||
|
||||
const data = validationResult.data;
|
||||
|
||||
const enterprise = await globalPrisma.enterpriseRealNameInfo.findFirst({
|
||||
where: {
|
||||
enterpriseName: data.keyName,
|
||||
isVerified: true
|
||||
}
|
||||
});
|
||||
|
||||
if (enterprise) {
|
||||
return jsonRes(res, {
|
||||
code: 400,
|
||||
message: 'Enterprise real name information has been used'
|
||||
});
|
||||
}
|
||||
|
||||
const globalToken = generateAuthenticationToken({
|
||||
userUid: payload.userUid,
|
||||
userId: payload.userId,
|
||||
|
||||
@@ -157,7 +157,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
if (!isFaceRecognitionSuccess) {
|
||||
await globalPrisma.userRealNameInfo.update({
|
||||
where: { userUid },
|
||||
where: { userUid: userUid },
|
||||
data: {
|
||||
isVerified: false,
|
||||
idVerifyFailedTimes: { increment: 1 },
|
||||
@@ -194,6 +194,53 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
`);
|
||||
}
|
||||
|
||||
const realnameInfo = await globalPrisma.userRealNameInfo.findFirst({
|
||||
where: {
|
||||
realName: userRealNameFaceAuthInfo.Text?.Name,
|
||||
idCard: userRealNameFaceAuthInfo.Text?.IdCard,
|
||||
isVerified: true
|
||||
}
|
||||
});
|
||||
|
||||
if (realnameInfo) {
|
||||
await globalPrisma.userRealNameInfo.update({
|
||||
where: { userUid: userUid },
|
||||
data: {
|
||||
isVerified: false,
|
||||
idVerifyFailedTimes: { increment: 1 },
|
||||
additionalInfo: additionalInfo
|
||||
}
|
||||
});
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
return res.send(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Real Name Authentication</title>
|
||||
<style>
|
||||
body, html {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: #ff0000; /* Red color for error message */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Real name information has been used</h1>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
}
|
||||
|
||||
if (realNameAuthReward) {
|
||||
await globalPrisma.$transaction(async (globalPrisma) => {
|
||||
const currentAccount = await globalPrisma.account.findUniqueOrThrow({
|
||||
|
||||
Reference in New Issue
Block a user