mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Fix TypeError: string.toLowerCase is not a function server unhandledRejections reported in production. The registration invitation-code check in Users.after.insert() read doc.authenticationMethod.toLowerCase() unguarded, but authenticationMethod is only set for oauth2/ldap signups - a normal password/invitation signup left it undefined and crashed this hook on every insert whenever disableRegistration was on; doc.emails[0].address was also read unguarded. The buffered notification-email sender likewise read user.emails[0].address.toLowerCase() unguarded, crashing when a user (e.g. a header-auth/LDAP account) has an empty emails array. The CSV/TSV importer's header-row mapping read headerRow[i].toLowerCase() unguarded, which could throw on a sparse row cell that isn't a string. A full audit of every server-reachable .toLowerCase() call site (server/, models/, packages/) found the rest already guarded (typeof checks, || '' fallbacks, or values sourced from validated schema fields). Thanks to xet7 !