@ruiapp/rapid-core 0.8.14 → 0.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -5466,13 +5466,16 @@ class MetaService {
|
|
|
5466
5466
|
for (const index of model.indexes) {
|
|
5467
5467
|
const sqlCreateIndex = generateTableIndexDDL(queryBuilder, server, model, index);
|
|
5468
5468
|
try {
|
|
5469
|
-
await server.queryDatabaseObject(sqlCreateIndex, [], null);
|
|
5469
|
+
await server.queryDatabaseObject(sqlCreateIndex, [], null, true);
|
|
5470
5470
|
}
|
|
5471
5471
|
catch (err) {
|
|
5472
5472
|
const logger = this.#server.getLogger();
|
|
5473
5473
|
if (err.message.includes("already exists")) {
|
|
5474
5474
|
logger.warn("Failed to create index.", { errorMessage: err.message, sqlCreateIndex });
|
|
5475
5475
|
}
|
|
5476
|
+
else {
|
|
5477
|
+
logger.error("Failed to create index.", { errorMessage: err.message, sqlCreateIndex });
|
|
5478
|
+
}
|
|
5476
5479
|
}
|
|
5477
5480
|
}
|
|
5478
5481
|
}
|
|
@@ -6824,11 +6827,18 @@ async function handler$d(plugin, ctx, options) {
|
|
|
6824
6827
|
field: "login",
|
|
6825
6828
|
value: account,
|
|
6826
6829
|
},
|
|
6830
|
+
{
|
|
6831
|
+
operator: "null",
|
|
6832
|
+
field: "deletedAt",
|
|
6833
|
+
},
|
|
6827
6834
|
],
|
|
6828
6835
|
}, routeContext?.getDbTransactionClient());
|
|
6829
6836
|
if (!user) {
|
|
6830
6837
|
throw new Error("用户名或密码错误。");
|
|
6831
6838
|
}
|
|
6839
|
+
if (user.state !== "enabled") {
|
|
6840
|
+
throw new Error("用户已被禁用,不允许登录。");
|
|
6841
|
+
}
|
|
6832
6842
|
const isMatch = await bcrypt__default["default"].compare(password, user.password);
|
|
6833
6843
|
if (!isMatch) {
|
|
6834
6844
|
throw new Error("用户名或密码错误。");
|
package/package.json
CHANGED
|
@@ -26,6 +26,10 @@ export async function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, op
|
|
|
26
26
|
field: "login",
|
|
27
27
|
value: account,
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
operator: "null",
|
|
31
|
+
field: "deletedAt",
|
|
32
|
+
},
|
|
29
33
|
],
|
|
30
34
|
},
|
|
31
35
|
routeContext?.getDbTransactionClient(),
|
|
@@ -35,6 +39,10 @@ export async function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, op
|
|
|
35
39
|
throw new Error("用户名或密码错误。");
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
if (user.state !== "enabled") {
|
|
43
|
+
throw new Error("用户已被禁用,不允许登录。");
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
const isMatch = await bcrypt.compare(password, user.password);
|
|
39
47
|
if (!isMatch) {
|
|
40
48
|
throw new Error("用户名或密码错误。");
|
|
@@ -361,11 +361,13 @@ export default class MetaService {
|
|
|
361
361
|
for (const index of model.indexes) {
|
|
362
362
|
const sqlCreateIndex = generateTableIndexDDL(queryBuilder, server, model, index);
|
|
363
363
|
try {
|
|
364
|
-
await server.queryDatabaseObject(sqlCreateIndex, [], null);
|
|
364
|
+
await server.queryDatabaseObject(sqlCreateIndex, [], null, true);
|
|
365
365
|
} catch (err: any) {
|
|
366
366
|
const logger = this.#server.getLogger();
|
|
367
367
|
if ((err as Error).message.includes("already exists")) {
|
|
368
368
|
logger.warn("Failed to create index.", { errorMessage: err.message, sqlCreateIndex });
|
|
369
|
+
} else {
|
|
370
|
+
logger.error("Failed to create index.", { errorMessage: err.message, sqlCreateIndex });
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
373
|
}
|