Skip to content

Commit 30ddfc8

Browse files
committed
chore: Refactor PasswdService to include identity information in password change job execution
1 parent f93b135 commit 30ddfc8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/management/passwd/passwd.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { AskTokenDto } from './dto/ask-token.dto';
1010
import { ChangePasswordDto } from './dto/change-password.dto';
1111
import { ResetPasswordDto } from './dto/reset-password.dto';
1212
import { IdentitiesService } from '../identities/identities.service';
13+
import { pick } from 'radash';
14+
import { Identities } from '../identities/_schemas/identities.schema';
1315

1416
interface TokenData {
1517
k: string;
@@ -40,9 +42,12 @@ export class PasswdService extends AbstractService {
4042
}
4143

4244
public async change(passwdDto: ChangePasswordDto): Promise<[Jobs, any]> {
43-
const identity = await this.identities.findOne({ 'inetOrgPerson.uid': passwdDto.uid });
45+
const identity = await this.identities.findOne({ 'inetOrgPerson.uid': passwdDto.uid }) as Identities;
4446

45-
return await this.backends.executeJob(ActionType.IDENTITY_PASSWORD_CHANGE, identity._id, passwdDto, {
47+
return await this.backends.executeJob(ActionType.IDENTITY_PASSWORD_CHANGE, identity._id, {
48+
...passwdDto,
49+
...pick(identity, ['inetOrgPerson']),
50+
}, {
4651
async: false,
4752
});
4853
}

0 commit comments

Comments
 (0)