Sage-Bionetworks / sagebio-collaboration-portal

Collaboration Portal developed by Sage Bionetworks
1 stars 0 forks source link

Handle error when two email addresses with same username part but different domain are used #55

Open tschaffter opened 5 years ago

tschaffter commented 5 years ago
  1. Login with thomas.schaffter@sagebase.org => account creation
  2. Logout
  3. Login with thomas.schaffter@gmail.com => Error:
MongoError: E11000 duplicate key error collection: phccp-dev.users index: username_1 dup key: { : "thomas.schaffter" }
    at Function.create (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/mongoose/node_modules/mongodb-core/lib/error.js:43:12)
    at toError (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/mongoose/node_modules/mongodb/lib/utils.js:149:22)
    at coll.s.topology.insert (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/mongoose/node_modules/mongodb/lib/operations/collection_ops.js:859:39)
    at /home/tschaffter/dev/PHCCollaborationPortal/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:532:18
    at process._tickCallback (internal/process/next_tick.js:61:11)
From previous event:
    at Object.promiseOrCallback (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/mongoose/lib/utils.js:269:10)
    at model.Model.save (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/mongoose/lib/model.js:455:16)
    at save (/home/tschaffter/dev/PHCCollaborationPortal/server/auth/google/passport.js:47:33)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at Strategy.then [as _verify] (/home/tschaffter/dev/PHCCollaborationPortal/server/auth/google/passport.js:20:18)
    at /home/tschaffter/dev/PHCCollaborationPortal/node_modules/passport-oauth2/lib/strategy.js:202:24
    at /home/tschaffter/dev/PHCCollaborationPortal/node_modules/passport-google-oauth20/lib/strategy.js:122:5
    at passBackControl (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/oauth/lib/oauth2.js:134:9)
    at IncomingMessage.<anonymous> (/home/tschaffter/dev/PHCCollaborationPortal/node_modules/oauth/lib/oauth2.js:157:7)
    at IncomingMessage.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1125:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
tschaffter commented 5 years ago

@TheRobBrennan This is the issue I mentioned today with Google OAuth. Is this still an issue when moving to SAML?

tschaffter commented 5 years ago

This will always be a problem when a local user is created and his/her username is set by default to the part of the email address before '@' (either local or using sso).