fix(core): Added logging for user email login process and fixed client URL parsing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import { LoginSession } from './classes.loginsession.js';
|
||||
import { Reception } from './classes.reception.js';
|
||||
import { logger } from './logging.js';
|
||||
|
||||
export class LoginSessionManager {
|
||||
// refs
|
||||
@@ -81,12 +82,14 @@ export class LoginSessionManager {
|
||||
new plugins.typedrequest.TypedHandler<plugins.lointReception.request.IReq_LoginWithEmail>(
|
||||
'loginWithEmail',
|
||||
async (requestDataArg) => {
|
||||
logger.log('info', `loginWithEmail requested for: ${requestDataArg.email}`);
|
||||
const existingUser = await this.receptionRef.userManager.CUser.getInstance({
|
||||
data: {
|
||||
email: requestDataArg.email,
|
||||
},
|
||||
});
|
||||
if (existingUser) {
|
||||
logger.log('info', `loginWithEmail found user: ${existingUser.data.email}`);
|
||||
this.emailTokenMap.findOneAndRemoveSync(
|
||||
(itemArg) => itemArg.email === existingUser.data.email
|
||||
);
|
||||
@@ -103,6 +106,8 @@ export class LoginSessionManager {
|
||||
);
|
||||
});
|
||||
this.receptionRef.receptionMailer.sendLoginWithEMailMail(existingUser, loginEmailToken);
|
||||
} else {
|
||||
logger.log('info', `loginWithEmail did not find user: ${requestDataArg.email}`);
|
||||
}
|
||||
return {
|
||||
status: 'ok',
|
||||
|
||||
@@ -229,6 +229,7 @@ export class ReceptionMailer {
|
||||
}
|
||||
|
||||
public sendLoginWithEMailMail(userArg: User, validationTokenArg: string) {
|
||||
console.log(`sending login email to ${userArg.data.email}`);
|
||||
this.receptionRef.szPlatformClient.emailConnector.sendEmail({
|
||||
from: 'workspace.global <noreply@mail.workspace.global>',
|
||||
title: 'Click to login!',
|
||||
|
||||
Reference in New Issue
Block a user