@@ -36,7 +36,7 @@ module.exports = [
3636 }
3737 const projectId = _ . parseInt ( req . params . projectId ) ;
3838 const inviteId = _ . parseInt ( req . params . inviteId ) ;
39- const email = req . authUser . email ;
39+ const currentUserEmail = req . authUser . email ? req . authUser . email . toLowerCase ( ) : req . authUser . email ;
4040 const currentUserId = req . authUser . userId ;
4141
4242 // get invite by id and project id
@@ -45,13 +45,13 @@ module.exports = [
4545 // if invite doesn't exist, return 404
4646 if ( ! invite ) {
4747 const err = new Error ( `invite not found for project id ${ projectId } , inviteId ${ inviteId } ,` +
48- ` email ${ email } and userId ${ currentUserId } ` ,
48+ ` email ${ currentUserEmail } and userId ${ currentUserId } ` ,
4949 ) ;
5050 err . status = 404 ;
5151 return next ( err ) ;
5252 }
5353 // check this invitation is for logged-in user or not
54- const ownInvite = ( ! ! invite && ( invite . userId === currentUserId || invite . email === email ) ) ;
54+ const ownInvite = ( ! ! invite && ( invite . userId === currentUserId || invite . email === currentUserEmail ) ) ;
5555
5656 // check permission
5757 req . log . debug ( 'Checking user permission for updating invite' ) ;
@@ -103,7 +103,7 @@ module.exports = [
103103 req . context . currentProjectMembers = members ;
104104 let userId = updatedInvite . userId ;
105105 // if the requesting user is updating his/her own invite
106- if ( ! userId && email === updatedInvite . email ) {
106+ if ( ! userId && currentUserEmail === updatedInvite . email ) {
107107 userId = currentUserId ;
108108 }
109109 // if we are not able to identify the user yet, it must be something wrong and we should not create
0 commit comments