mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复重置用户名失败
This commit is contained in:
parent
c3072e7712
commit
05db2b1df8
|
@ -21,6 +21,8 @@ import dayjs from 'dayjs';
|
||||||
import IP2Region from 'ip2region';
|
import IP2Region from 'ip2region';
|
||||||
import requestIp from 'request-ip';
|
import requestIp from 'request-ip';
|
||||||
import uniq from 'lodash/uniq';
|
import uniq from 'lodash/uniq';
|
||||||
|
import pickBy from 'lodash/pickBy';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
import { shareStore } from '../shared/store';
|
import { shareStore } from '../shared/store';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
|
@ -365,11 +367,16 @@ export default class UserService {
|
||||||
public async resetAuthInfo(info: Partial<AuthInfo>) {
|
public async resetAuthInfo(info: Partial<AuthInfo>) {
|
||||||
const { retries, twoFactorActivated, password, username } = info;
|
const { retries, twoFactorActivated, password, username } = info;
|
||||||
const authInfo = await this.getAuthInfo();
|
const authInfo = await this.getAuthInfo();
|
||||||
await this.updateAuthInfo(authInfo, {
|
const payload = pickBy(
|
||||||
retries,
|
{
|
||||||
twoFactorActivated,
|
retries,
|
||||||
password,
|
twoFactorActivated,
|
||||||
username
|
password,
|
||||||
});
|
username,
|
||||||
|
},
|
||||||
|
(x) => !isNil(x),
|
||||||
|
);
|
||||||
|
|
||||||
|
await this.updateAuthInfo(authInfo, payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user