mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Add logging statements for user sign up, email verification, password reset, and login
This code change adds logging statements for user sign up, email verification, password reset, and login in the Authentication.ts and SSO.ts files. The logging statements provide information about the corresponding user actions, including the user's email. This enhancement improves the visibility and monitoring of user activities in the system.
This commit is contained in:
@@ -203,6 +203,8 @@ router.post(
|
||||
httpOnly: true,
|
||||
});
|
||||
|
||||
logger.info('User signed up: ' + savedUser.email?.toString());
|
||||
|
||||
return Response.sendEntityResponse(req, res, savedUser, User);
|
||||
}
|
||||
|
||||
@@ -398,6 +400,8 @@ router.post(
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
logger.info('User email verified: ' + user.email?.toString());
|
||||
|
||||
return Response.sendEmptySuccessResponse(req, res);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
@@ -490,6 +494,10 @@ router.post(
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
logger.info(
|
||||
'User password reset: ' + alreadySavedUser.email?.toString()
|
||||
);
|
||||
|
||||
return Response.sendEmptySuccessResponse(req, res);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
@@ -581,6 +589,10 @@ router.post(
|
||||
alreadySavedUser.password.toString() ===
|
||||
user.password!.toString()
|
||||
) {
|
||||
logger.info(
|
||||
'User logged in: ' + alreadySavedUser.email?.toString()
|
||||
);
|
||||
|
||||
const token: string = JSONWebToken.signUserLoginToken({
|
||||
tokenData: {
|
||||
userId: alreadySavedUser.id!,
|
||||
|
||||
@@ -449,6 +449,8 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
|
||||
const host: Hostname = await DatabaseConfig.getHost();
|
||||
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
||||
|
||||
logger.info('User logged in with SSO' + email.toString());
|
||||
|
||||
return Response.redirect(
|
||||
req,
|
||||
res,
|
||||
|
||||
Reference in New Issue
Block a user