@loomcore/api 0.2.66 → 0.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ export class EmailService {
|
|
|
14
14
|
async sendResetPasswordEmail(emailAddress, resetPasswordLink) {
|
|
15
15
|
try {
|
|
16
16
|
await this.emailClient.sendResetPasswordEmail(emailAddress, resetPasswordLink);
|
|
17
|
-
logger.info(`Reset password email sent to ${emailAddress}
|
|
17
|
+
logger.info(`Reset password email sent to ${emailAddress}.`);
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
20
|
console.error('Error sending reset password email:', error);
|
|
@@ -25,11 +25,11 @@ export class EmailService {
|
|
|
25
25
|
try {
|
|
26
26
|
if (this.emailClient.sendWelcomeEmail) {
|
|
27
27
|
await this.emailClient.sendWelcomeEmail(emailAddress, setPasswordLink);
|
|
28
|
-
logger.info(`Welcome email sent to ${emailAddress}
|
|
28
|
+
logger.info(`Welcome email sent to ${emailAddress}.`);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
await this.emailClient.sendResetPasswordEmail(emailAddress, setPasswordLink);
|
|
32
|
-
logger.info(`Welcome email (via reset password) sent to ${emailAddress}
|
|
32
|
+
logger.info(`Welcome email (via reset password) sent to ${emailAddress}.`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
@@ -3,6 +3,7 @@ import { entityUtils } from '@loomcore/common/utils';
|
|
|
3
3
|
import { BadRequestError, ServerError } from '../../errors/index.js';
|
|
4
4
|
import { PasswordResetTokenService } from '../../services/password-reset-token.service.js';
|
|
5
5
|
import { UserService } from '../../services/user.service.js';
|
|
6
|
+
import { logger } from '../logger.utils.js';
|
|
6
7
|
export async function resetPassword(database, email, passwordResetToken, password, organization, userService = new UserService(database), userSpec = UserSpec) {
|
|
7
8
|
const validationErrors = entityUtils.validate(userSpec, { password: password }, true, passwordValidator);
|
|
8
9
|
entityUtils.handleValidationResult(validationErrors, 'AuthService.resetPassword');
|
|
@@ -26,9 +27,9 @@ export async function resetPassword(database, email, passwordResetToken, passwor
|
|
|
26
27
|
throw new ServerError(`Unable to retrieve user for email: ${lowerCaseEmail}`);
|
|
27
28
|
}
|
|
28
29
|
const result = await userService.changePassword(systemUserContext, user._id, password);
|
|
29
|
-
|
|
30
|
+
logger.info(`password changed using forgot-password for email: ${lowerCaseEmail}`);
|
|
30
31
|
await passwordResetTokenService.deleteById(systemUserContext, retrievedPasswordResetToken._id);
|
|
31
|
-
|
|
32
|
+
logger.info(`passwordResetToken deleted for email: ${lowerCaseEmail}`);
|
|
32
33
|
return {
|
|
33
34
|
success: true,
|
|
34
35
|
count: 1,
|