jamro / jsbattle

JavaScript Programming Game (inspired by RoboCode)
http://jsbattle.jmrlab.com
MIT License
105 stars 47 forks source link

The email Regex is not allowing users with '.' in their email to login #32

Closed optinirr closed 3 years ago

optinirr commented 3 years ago

this regex: ^[\w-]+@([\w-]+.)+[\w-]+$ this email: anything.anyone@gmail.com won't work.

this stackoverflow questions contains a better regex: https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript

stack trace: (node:13902) UnhandledPromiseRejectionWarning: ValidationError: Entity validation error! at Service.settings.entityValidator (/home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer-db/src/index.js:951:28) at /home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer-db/src/index.js:669:76 at Array.map () at Service.validateEntity (/home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer-db/src/index.js:669:32) at Service._create (/home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer-db/src/index.js:787:16) at Service.handler (/home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer-db/src/index.js:220:17) at /home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer/src/utils.js:182:22 at /home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/jsbattle-server/app/lib/auditMiddleware.js:7:16 at /home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/moleculer/src/middlewares/action-hook.js:91:23 at Service.module.exports (/home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/jsbattle-server/app/services/userStore/actions/findOrCreate.js:44:14) at /home/ubuntu/.nvm/versions/node/v14.15.1/lib/node_modules/jsbattle/node_modules/jsbattle-server/app/services/apiGateway/lib/configPassport.js:86:20 (node:13902) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 25072)

optinirr commented 3 years ago

Thanks! this is awesome by the way.