Skip to content

Commit

Permalink
BC-8054 - fix log of email from user
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenWaysDP committed Sep 25, 2024
1 parent 5d0f6d5 commit 9fde6e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class AccountService extends AbstractAccountService implements DeletionSe
}

public async replaceMyTemporaryPassword(userId: EntityId, password: string, confirmPassword: string): Promise<void> {
console.log(userId);
if (password !== confirmPassword) {
throw new ForbiddenOperationError('Password and confirm password do not match.');
}
Expand All @@ -211,17 +212,17 @@ export class AccountService extends AbstractAccountService implements DeletionSe
const firstLoginPassed = userPreferences ? userPreferences.firstLogin : false;

if (!user.forcePasswordChange && firstLoginPassed) {
throw new ForbiddenOperationError('The password is not temporary, hence can not be changed.');
throw new ForbiddenOperationError('The password is not temporary, hence can not be changed.', { userId });
} // Password change was forces or this is a first logon for the user

const account: Account = await this.findByUserIdOrFail(userId);

if (account.systemId) {
throw new ForbiddenOperationError('External account details can not be changed.');
throw new ForbiddenOperationError('External account details can not be changed.', { userId });
}

if (await this.validatePassword(account, password)) {
throw new ForbiddenOperationError('New password can not be same as old password.');
throw new ForbiddenOperationError('New password can not be same as old password.', { userId });
}

try {
Expand Down
1 change: 1 addition & 0 deletions src/middleware/errorHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const secretDataKeys = (() =>
'_csrf',
'searchUserPassword',
'authorization',
'student-email',
].map((k) => k.toLocaleLowerCase()))();

const filterSecretValue = (key, value) => {
Expand Down

0 comments on commit 9fde6e3

Please sign in to comment.