31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.maskPassword = exports.getUserSafetyFilter = void 0;
|
|
function getUserSafetyFilter(context) {
|
|
const application = context.getApplication();
|
|
const { config } = application.system;
|
|
const { Security } = config || {};
|
|
if (Security && ['strong', 'medium'].includes(Security.level)) {
|
|
// 对于安全要求中高的系统,需要检查其验证密码时间
|
|
const stamp = Date.now() - Security.passwordVerifyGap;
|
|
return {
|
|
$or: [
|
|
{
|
|
verifyPasswordAt: {
|
|
$gte: stamp,
|
|
},
|
|
},
|
|
{
|
|
hasPassword: false,
|
|
}
|
|
]
|
|
};
|
|
}
|
|
}
|
|
exports.getUserSafetyFilter = getUserSafetyFilter;
|
|
function maskPassword(password) {
|
|
const encStr = "****************************************".slice(0, password.length - 2);
|
|
return password[0] + encStr + password[password.length - 1];
|
|
}
|
|
exports.maskPassword = maskPassword;
|