Skip to content

Commit 9262798

Browse files
author
Vikas Agarwal
committed
Merge branch 'hotfix/email_sanitize_fix'
2 parents a09a68b + f423083 commit 9262798

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function startKafkaConsumer(handlers) {
103103
topicId,
104104
userEmail: helper.sanitizeEmail(user.email),
105105
};
106+
logger.debug('body', body);
106107
logger.debug(`body for generating token: ${JSON.stringify(body)}`);
107108
logger.debug(`authSecret: ${config.authSecret.substring(-5)}`);
108109
const token = jwt.sign(body, config.authSecret, { noTimestamp: true }).split('.')[2];

src/common/helper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ function autoWrapExpress(obj) {
4949
*/
5050
function sanitizeEmail(email) {
5151
if (email) {
52-
return email.substring(0, email.indexOf('+')) + email.substring(email.indexOf('@'));
52+
return email.substring(0, email.indexOf('+') !== -1 ? email.indexOf('+') : email.indexOf('@'))
53+
+ email.substring(email.indexOf('@'));
5354
}
5455
return '';
5556
}

0 commit comments

Comments
 (0)