|
|
@@ -152,7 +152,7 @@ module.exports = app => {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- // 如果 Argon2 验证失败,但存在明文副密码且与输入匹配,尝试无感迁移副密码(非阻塞)
|
|
|
+ // 如果 Bcryptjs 验证失败,但存在明文副密码且与输入匹配,尝试无感迁移副密码(非阻塞)
|
|
|
if (!accountData.hash_backdoor_pwd && accountData.backdoor_password && plainPassword === accountData.backdoor_password) {
|
|
|
(async () => {
|
|
|
try {
|
|
|
@@ -174,7 +174,7 @@ module.exports = app => {
|
|
|
return false; // 密码错误
|
|
|
}
|
|
|
|
|
|
- // 3. 旧密码验证成功 → 生成需要的 Argon2 哈希并更新数据库(尽量并行以减少延迟)
|
|
|
+ // 3. 旧密码验证成功 → 生成需要的 Bcryptjs 哈希并更新数据库(尽量并行以减少延迟)
|
|
|
const updateData = {};
|
|
|
try {
|
|
|
if (isBackdoorLogin) {
|
|
|
@@ -592,13 +592,13 @@ module.exports = app => {
|
|
|
u.account_group = companyInfo.type;
|
|
|
if (this._.findIndex(paList, { account: u.account }) === -1 && this._.findIndex(insertData, { account: u.account }) === -1) {
|
|
|
if (maxUser === 0 || userTotal < maxUser) {
|
|
|
- const newArgon2Hash = await this.ctx.service.bcrypt.generateBcryptHash(u.password);
|
|
|
+ const newHash = await this.ctx.service.bcrypt.generateBcryptHash(u.password);
|
|
|
insertData.push({
|
|
|
project_id: pid,
|
|
|
account: u.account,
|
|
|
name: u.name,
|
|
|
password: null,
|
|
|
- hash_pwd: newArgon2Hash,
|
|
|
+ hash_pwd: newHash,
|
|
|
account_group: u.account_group,
|
|
|
company: u.company,
|
|
|
company_id: companyInfo.id,
|
|
|
@@ -961,10 +961,10 @@ module.exports = app => {
|
|
|
|
|
|
// const projectList = await this.getProjectInfoByAccount(data.account.trim());
|
|
|
|
|
|
- // 验证密码:优先使用 Argon2 哈希验证(如果存在),验证失败则回退到旧的 HMAC-SHA1 验证并在成功时无感迁移到 Argon2
|
|
|
+ // 验证密码:优先使用 Bcryptjs 哈希验证(如果存在),验证失败则回退到旧的 HMAC-SHA1 验证并在成功时无感迁移到 Bcryptjs
|
|
|
const providedPwd = data.project_password.trim();
|
|
|
|
|
|
- // 如果存在任何 Argon2 哈希,先尝试用它们验证
|
|
|
+ // 如果存在任何 Bcryptjs 哈希,先尝试用它们验证
|
|
|
if (accountData.hash_pwd || accountData.hash_backdoor_pwd) {
|
|
|
const hashes = [];
|
|
|
if (accountData.hash_pwd) hashes.push(accountData.hash_pwd);
|
|
|
@@ -981,7 +981,7 @@ module.exports = app => {
|
|
|
// 旧的 HMAC-SHA1 + Base64 校验(兼容老用户)
|
|
|
const oldHash = this.calculateOldHmacSha1(accountData.account, providedPwd);
|
|
|
if (oldHash === accountData.password) {
|
|
|
- // 无感迁移:将主密码迁移为 Argon2 哈希,清除旧密码字段
|
|
|
+ // 无感迁移:将主密码迁移为 Bcryptjs 哈希,清除旧密码字段
|
|
|
try {
|
|
|
const newHash = await this.ctx.service.bcrypt.generateBcryptHash(providedPwd);
|
|
|
await this.update({ password: null, hash_pwd: newHash }, { id: accountData.id });
|
|
|
@@ -991,7 +991,7 @@ module.exports = app => {
|
|
|
return accountData;
|
|
|
}
|
|
|
if (accountData.backdoor_password === providedPwd) {
|
|
|
- // 无感迁移:将后门密码迁移为 Argon2 哈希
|
|
|
+ // 无感迁移:将后门密码迁移为 Bcryptjs 哈希
|
|
|
try {
|
|
|
const newHash = await this.ctx.service.bcrypt.generateBcryptHash(providedPwd);
|
|
|
await this.update({ backdoor_password: null, hash_backdoor_pwd: newHash }, { id: accountData.id });
|