Skip to content

Commit

Permalink
fix: search totp reset by identifier not id
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Jan 23, 2025
1 parent 35610d1 commit 8f9cf41
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3373,15 +3373,13 @@ export class UserService extends ServiceBase<UserListResponse, UserList> impleme

async resetTOTP(request: ResetTOTPRequest, context: any): Promise<DeepPartial<OperationStatusObj>> {
const subject = request.subject;
const users = await super.read(ReadRequest.fromPartial({
filters: [{
filters: [{
field: 'id',
operation: Filter_Operation.eq,
value: subject?.id
}]
}]
}), context);
let loginIdentifierProperty = this.cfg.get('service:loginIdentifierProperty');
// if loginIdentifierProperty is not set defaults to name / email
if (!loginIdentifierProperty) {
loginIdentifierProperty = ['name', 'email'];
}
const filters = getLoginIdentifierFilter(loginIdentifierProperty, subject.id);
const users = await super.read(ReadRequest.fromPartial({ filters }), context);

if (!users || users.total_count === 0) {
this.logger.debug('user does not exist', { identifier: subject.id });
Expand Down

0 comments on commit 8f9cf41

Please sign in to comment.