@resolveio/server-lib 20.7.120 → 20.7.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-server-app.js +51 -1
- package/client-server-app.js.map +1 -1
- package/collections/app-status.collection.js +51 -1
- package/collections/app-status.collection.js.map +1 -1
- package/collections/counter.collection.js +55 -1
- package/collections/counter.collection.js.map +1 -1
- package/collections/cron-job-history.collection.js +136 -1
- package/collections/cron-job-history.collection.js.map +1 -1
- package/collections/cron-job.collection.js +87 -1
- package/collections/cron-job.collection.js.map +1 -1
- package/collections/email-history.collection.js +98 -1
- package/collections/email-history.collection.js.map +1 -1
- package/collections/email-verified.collection.js +60 -1
- package/collections/email-verified.collection.js.map +1 -1
- package/collections/file.collection.js +73 -1
- package/collections/file.collection.js.map +1 -1
- package/collections/flag-update.collection.js +56 -1
- package/collections/flag-update.collection.js.map +1 -1
- package/collections/flag.collection.js +56 -1
- package/collections/flag.collection.js.map +1 -1
- package/collections/log-method-latency.collection.js +72 -1
- package/collections/log-method-latency.collection.js.map +1 -1
- package/collections/log-subscription.collection.js +75 -1
- package/collections/log-subscription.collection.js.map +1 -1
- package/collections/log.collection.js +87 -1
- package/collections/log.collection.js.map +1 -1
- package/collections/logged-in-users.collection.js +66 -1
- package/collections/logged-in-users.collection.js.map +1 -1
- package/collections/monitor-cpu.collection.js +64 -1
- package/collections/monitor-cpu.collection.js.map +1 -1
- package/collections/monitor-function.collection.js +73 -1
- package/collections/monitor-function.collection.js.map +1 -1
- package/collections/monitor-memory.collection.js +76 -1
- package/collections/monitor-memory.collection.js.map +1 -1
- package/collections/monitor-mongo.collection.js +70 -1
- package/collections/monitor-mongo.collection.js.map +1 -1
- package/collections/notification.collection.js +56 -1
- package/collections/notification.collection.js.map +1 -1
- package/collections/report-builder-dashboard-builder.collection.js +108 -1
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
- package/collections/report-builder-library.collection.js +86 -1
- package/collections/report-builder-library.collection.js.map +1 -1
- package/collections/report-builder-report.collection.js +148 -1
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user-group.collection.js +88 -1
- package/collections/user-group.collection.js.map +1 -1
- package/collections/user-guide.collection.js +56 -1
- package/collections/user-guide.collection.js.map +1 -1
- package/collections/user.collection.js +265 -1
- package/collections/user.collection.js.map +1 -1
- package/cron/cron.js +97 -1
- package/cron/cron.js.map +1 -1
- package/fixtures/cron-jobs.js +95 -1
- package/fixtures/cron-jobs.js.map +1 -1
- package/fixtures/init.js +78 -1
- package/fixtures/init.js.map +1 -1
- package/http/auth.js +869 -1
- package/http/auth.js.map +1 -1
- package/http/health.js +11 -1
- package/http/health.js.map +1 -1
- package/http/home.js +114 -1
- package/http/home.js.map +1 -1
- package/index.js +18 -1
- package/index.js.map +1 -1
- package/managers/cron.manager.js +461 -1
- package/managers/cron.manager.js.map +1 -1
- package/managers/local-log.manager.js +79 -1
- package/managers/local-log.manager.js.map +1 -1
- package/managers/method.manager.js +1025 -1
- package/managers/method.manager.js.map +1 -1
- package/managers/mongo.manager.js +4231 -1
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +534 -1
- package/managers/monitor.manager.js.map +1 -1
- package/managers/subscription.manager.js +1292 -1
- package/managers/subscription.manager.js.map +1 -1
- package/managers/websocket.manager.js +165 -1
- package/managers/websocket.manager.js.map +1 -1
- package/managers/worker-dispatcher.manager.js +335 -1
- package/managers/worker-dispatcher.manager.js.map +1 -1
- package/managers/worker-server.manager.js +292 -1
- package/managers/worker-server.manager.js.map +1 -1
- package/methods/accounts.js +302 -1
- package/methods/accounts.js.map +1 -1
- package/methods/aws.js +748 -1
- package/methods/aws.js.map +1 -1
- package/methods/collections.js +542 -1
- package/methods/collections.js.map +1 -1
- package/methods/counters.js +111 -1
- package/methods/counters.js.map +1 -1
- package/methods/cron-jobs.js +1476 -1
- package/methods/cron-jobs.js.map +1 -1
- package/methods/flag-updates.js +8 -1
- package/methods/flag-updates.js.map +1 -1
- package/methods/flags.js +8 -1
- package/methods/flags.js.map +1 -1
- package/methods/logs.js +417 -1
- package/methods/logs.js.map +1 -1
- package/methods/monitor.js +543 -1
- package/methods/monitor.js.map +1 -1
- package/methods/pdf.js +742 -1
- package/methods/pdf.js.map +1 -1
- package/methods/report-builder.js +840 -1
- package/methods/report-builder.js.map +1 -1
- package/methods/support.js +232 -1
- package/methods/support.js.map +1 -1
- package/models/app-status.model.js +3 -1
- package/models/app-status.model.js.map +1 -1
- package/models/billing-logged-in-users.model.js +3 -1
- package/models/billing-logged-in-users.model.js.map +1 -1
- package/models/collection-document.model.js +3 -1
- package/models/collection-document.model.js.map +1 -1
- package/models/counter.model.js +3 -1
- package/models/counter.model.js.map +1 -1
- package/models/cron-job-history.model.js +3 -1
- package/models/cron-job-history.model.js.map +1 -1
- package/models/cron-job.model.js +3 -1
- package/models/cron-job.model.js.map +1 -1
- package/models/dialog.model.js +3 -1
- package/models/dialog.model.js.map +1 -1
- package/models/email-history.model.js +15 -1
- package/models/email-history.model.js.map +1 -1
- package/models/email-verified.model.js +3 -1
- package/models/email-verified.model.js.map +1 -1
- package/models/file.model.js +3 -1
- package/models/file.model.js.map +1 -1
- package/models/flag-update.model.js +3 -1
- package/models/flag-update.model.js.map +1 -1
- package/models/flag.model.js +3 -1
- package/models/flag.model.js.map +1 -1
- package/models/log-method-latency.model.js +3 -1
- package/models/log-method-latency.model.js.map +1 -1
- package/models/log-subscription.model.js +3 -1
- package/models/log-subscription.model.js.map +1 -1
- package/models/log.model.js +3 -1
- package/models/log.model.js.map +1 -1
- package/models/logged-in-users.model.js +3 -1
- package/models/logged-in-users.model.js.map +1 -1
- package/models/method-response.model.js +3 -1
- package/models/method-response.model.js.map +1 -1
- package/models/method.model.d.ts +0 -1
- package/models/method.model.js +3 -1
- package/models/method.model.js.map +1 -1
- package/models/monitor-cpu.model.js +3 -1
- package/models/monitor-cpu.model.js.map +1 -1
- package/models/monitor-function.model.js +3 -1
- package/models/monitor-function.model.js.map +1 -1
- package/models/monitor-memory.model.js +3 -1
- package/models/monitor-memory.model.js.map +1 -1
- package/models/monitor-mongo.model.js +3 -1
- package/models/monitor-mongo.model.js.map +1 -1
- package/models/notification.model.js +3 -1
- package/models/notification.model.js.map +1 -1
- package/models/pagination.model.js +23 -1
- package/models/pagination.model.js.map +1 -1
- package/models/permission.model.js +3 -1
- package/models/permission.model.js.map +1 -1
- package/models/report-builder-dashboard-builder.model.js +3 -1
- package/models/report-builder-dashboard-builder.model.js.map +1 -1
- package/models/report-builder-library.model.js +3 -1
- package/models/report-builder-library.model.js.map +1 -1
- package/models/report-builder-report.model.js +3 -1
- package/models/report-builder-report.model.js.map +1 -1
- package/models/report-builder.model.js +3 -1
- package/models/report-builder.model.js.map +1 -1
- package/models/select-data-label.model.js +3 -1
- package/models/select-data-label.model.js.map +1 -1
- package/models/server-message.model.js +3 -1
- package/models/server-message.model.js.map +1 -1
- package/models/subscription.model.js +3 -1
- package/models/subscription.model.js.map +1 -1
- package/models/support-ticket.model.js +3 -1
- package/models/support-ticket.model.js.map +1 -1
- package/models/user-group.model.js +3 -1
- package/models/user-group.model.js.map +1 -1
- package/models/user-guide.model.js +3 -1
- package/models/user-guide.model.js.map +1 -1
- package/models/user.model.js +3 -1
- package/models/user.model.js.map +1 -1
- package/package.json +1 -1
- package/public_api.js +77 -1
- package/public_api.js.map +1 -1
- package/publications/app-status.js +16 -1
- package/publications/app-status.js.map +1 -1
- package/publications/cron-jobs.js +32 -1
- package/publications/cron-jobs.js.map +1 -1
- package/publications/files.js +36 -1
- package/publications/files.js.map +1 -1
- package/publications/flags-update.js +22 -1
- package/publications/flags-update.js.map +1 -1
- package/publications/flags.js +22 -1
- package/publications/flags.js.map +1 -1
- package/publications/logs.js +164 -1
- package/publications/logs.js.map +1 -1
- package/publications/notifications.js +16 -1
- package/publications/notifications.js.map +1 -1
- package/publications/report-builder-dashboard-builders.js +42 -1
- package/publications/report-builder-dashboard-builders.js.map +1 -1
- package/publications/report-builder-libraries.js +90 -1
- package/publications/report-builder-libraries.js.map +1 -1
- package/publications/report-builder-reports.js +50 -1
- package/publications/report-builder-reports.js.map +1 -1
- package/publications/super-admin.js +16 -1
- package/publications/super-admin.js.map +1 -1
- package/publications/user-groups.js +16 -1
- package/publications/user-groups.js.map +1 -1
- package/publications/user-guides.js +16 -1
- package/publications/user-guides.js.map +1 -1
- package/resolveio-server-app.js +176 -1
- package/resolveio-server-app.js.map +1 -1
- package/server-app.js +1159 -1
- package/server-app.js.map +1 -1
- package/util/common.js +632 -1
- package/util/common.js.map +1 -1
- package/util/schema-report-builder.js +454 -1
- package/util/schema-report-builder.js.map +1 -1
package/http/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/http/auth.ts"],"names":["bodyParser","require","handlebars","jwt","jwt_decode_1","simpl_schema_1","user_collection_1","resolveio_server_app_1","common_1","setupAuthRoutes","mainServer","app","serverConfig","_this","this","post","json","request","response","__awaiter","headers","origin","send","JSON","stringify","error","result","body","schema","default","id_token","type","String","validate","console","Date","errors_1","ResolveIOServer","getMainServer","getMethodManager","sendEmail","getClientName","_a","sent","tokenData","split","token","decodedJWT","Users","findOne","other.ms_oid","user","email","toLowerCase","updateOne","_id","$set","objectIdHexString","__v","roles","super_admin","approvals","groups","notifications","miscs","username","fullname","active","phonenumber","readonly","other","ms_oid","attempts","salt","sign","now","toString","expiresIn","hash","last","settings","services","is_customer","create","update","id_user","log","password","errors_2","authenticate","resAuth","emailData","userToChangePassword","userWhoResetPassword","url","encodeURIComponent","html","readFile","template","compile","registerHelper","a","b","resetAttempts","refreshToken","errors_3","verify","err","decoded","findById","_b","body_1","enrollmentToken","errors_4","$and","services.enrollment","projection","body_2","errors_5","setPassword","body_3","forgotPasswordToken","errors_6","services.forgot_password","body_4","errors_7","errors_8","callMethod","call","exports"],"mappings":"k8CAAAA,Y,sFAAAC,QAAA,aAAA,GACAC,WAAAD,QAAA,YAAA,EACAE,IAAAF,QAAA,cAAA,EACAG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A/Dd,EAAOT,EAAAC,KAAA,E,iBAGJQ,GACHzC,EAAW6B,iBAAgB,EAAGwF,WAAWC,KAAKtH,EAAW6B,iBAAgB,EAAI,oBAAqBY,EAAKI,GAAG,EAG3GrC,EAASI,KAAKC,KAAKC,UAAU,CAC5BC,MAAO,CAAA,EACPC,OAAQ,E,CACR,CAAC,E,kCAEH,CACF,CAztBAuG,QAAAxH,gBAAAA","file":"auth.js","sourcesContent":["import * as bodyParser from 'body-parser';\nimport * as handlebars from 'handlebars';\nimport * as jwt from 'jsonwebtoken';\nimport jwt_decode from 'jwt-decode';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { ResolveIOMainServer } from '../server-app';\nimport { objectIdHexString } from '../util/common';\n\nexport function setupAuthRoutes(mainServer: ResolveIOMainServer, app, serverConfig) {\n\tapp.post('/login365', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tid_token: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/login)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/login365' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet tokenData = body.id_token.split('&');\n\t\t\tlet token = tokenData[0].split('=')[1];\n\t\t\tlet decodedJWT = jwt_decode(token);\n\n\t\t\tif (decodedJWT && decodedJWT['name'] && decodedJWT['preferred_username'] && decodedJWT['oid']) {\n\t\t\t\tlet user = await Users.findOne({'other.ms_oid': decodedJWT['oid']});\n\n\t\t\t\tif (!user) {\n\t\t\t\t\tuser = await Users.findOne({email: decodedJWT['preferred_username'].toLowerCase()});\n\n\t\t\t\t\tif (user) {\n\t\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {'other.ms_oid': decodedJWT['oid']}});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!user) {\n\t\t\t\t\tuser = {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\troles: {\n\t\t\t\t\t\t\tsuper_admin: false,\n\t\t\t\t\t\t\tapprovals: [],\n\t\t\t\t\t\t\tgroups: [],\n\t\t\t\t\t\t\tnotifications: [],\n\t\t\t\t\t\t\tmiscs: []\n\t\t\t\t\t\t},\n\t\t\t\t\t\tusername: decodedJWT['preferred_username'].toLowerCase(),\n\t\t\t\t\t\temail: decodedJWT['preferred_username'].toLowerCase(),\n\t\t\t\t\t\tfullname: decodedJWT['name'],\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\tphonenumber: '',\n\t\t\t\t\t\treadonly: false,\n\t\t\t\t\t\tother: {\n\t\t\t\t\t\t\tms_oid: decodedJWT['oid']\n\t\t\t\t\t\t},\n\t\t\t\t\t\tattempts: 0,\n\t\t\t\t\t\tsalt: jwt.sign({now: (Date.now() - 1000).toString()}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t}),\n\t\t\t\t\t\thash: jwt.sign({now: (Date.now() + 1000).toString()}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tlast: new Date(),\n\t\t\t\t\t\tsettings: null,\n\t\t\t\t\t\tservices: null,\n\t\t\t\t\t\tis_customer: false\n\t\t\t\t\t};\n\t\t\t\t\t\n\t\t\t\t\tawait Users.create(user);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet update = false;\n\n\t\t\t\t\tif (user.email !== decodedJWT['preferred_username'].toLowerCase()) {\n\t\t\t\t\t\tuser.email = decodedJWT['preferred_username'].toLowerCase();\n\t\t\t\t\t\tupdate = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (user.fullname !== decodedJWT['name']) {\n\t\t\t\t\t\tuser.fullname = decodedJWT['name'];\n\t\t\t\t\t\tupdate = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (update) {\n\t\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {email: user.email, fullname: user.fullname}});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\terror: false,\n\t\t\t\t\tresult: {\n\t\t\t\t\t\ttoken: jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('ERROR - 1', tokenData, token, decodedJWT);\n\n\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\terror: true,\n\t\t\t\t\tresult: 'Invalid Azure Token'\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\t});\n\n\t// Login via HTTP, return refresh token if authenticated\n\tapp.post('/login', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tusername: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/login)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/login' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet user = await Users.findOne({active: true, username: body.username});\n\n\t\t\tif (!user) {\n\t\t\t\tuser = await Users.findOne({active: true, email: body.username});\n\t\t\t}\n\t\t\t\n\t\t\tif (!user) {\n\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\terror: true,\n\t\t\t\t\tresult: 'Invalid Username And Password'\n\t\t\t\t}));\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet resAuth = await Users.authenticate(user, body.password);\n\n\t\t\tif (resAuth['error']) {\n\t\t\t\tif (resAuth['error'] === 'Too Many Attempts') {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: resAuth['error'] + '. A password reset link has been sent to your email, please reset your password.'\n\t\t\t\t\t}));\n\n\t\t\t\t\tif (!user.services) {\n\t\t\t\t\t\tuser.services = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tuser.services['forgot_password'] = jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET']);\n\n\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\tuserWhoResetPassword: ResolveIOServer.getClientName() + ' System',\n\t\t\t\t\t\turl: (serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(serverConfig['SERVER_URL']) + '&' + user.services['forgot_password'])\n\t\t\t\t\t};\n\n\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {services: user.services}});\n\t\t\t\t\tlet html = mainServer.getMethodManager().readFile('email-templates/forgot-password.html');\n\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t});\n\t\n\t\t\t\t\tawait mainServer.getMethodManager().sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData), null, null, '');\n\t\t\t\t}\n\t\t\t\telse if (resAuth['error'] === 'No Salt Value Stored') {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'A password reset link has been sent to your email, please reset your password.'\n\t\t\t\t\t}));\n\n\t\t\t\t\tif (!user.services) {\n\t\t\t\t\t\tuser.services = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tuser.services['forgot_password'] = jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET']);\n\n\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\tuserWhoResetPassword: ResolveIOServer.getClientName() + ' System',\n\t\t\t\t\t\turl: (serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(serverConfig['SERVER_URL']) + '&' + user.services['forgot_password'])\n\t\t\t\t\t};\n\n\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {services: user.services}});\n\t\t\t\t\tlet html = mainServer.getMethodManager().readFile('email-templates/forgot-password.html');\n\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t});\n\n\t\t\t\t\tawait mainServer.getMethodManager().sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData), null, null, '');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: resAuth['error']\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (resAuth && resAuth['data'] && resAuth['data'].active) {\n\t\t\t\t\tawait Users.resetAttempts(resAuth['data']);\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: false,\n\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\ttoken: jwt.sign({id_user: resAuth['data']._id}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} \n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tapp.post('/accessToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\trefreshToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/accessToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/accessToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.refreshToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findById(decoded['id_user']);\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\t\t\ttoken: jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\t\t\t\texpiresIn : 3 * 24 * 60 * 60 * 1000 // 3 days\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tuser: user\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/userWithEnrollmentToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tenrollmentToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/userWithEnrollmentToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/userWithEnrollmentToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.enrollmentToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.enrollment': body.enrollmentToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}, {projection: {_id: 1, __v: 1, username: 1, active: 1}});\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\t\t\tuser: user\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/setUserWithEnrollmentToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tenrollmentToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/setUserWithEnrollmentToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/setUserWithEnrollmentToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.enrollmentToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.enrollment': body.enrollmentToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tawait Users.setPassword(user, body.password);\n\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: true\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/userWithForgotPasswordToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tforgotPasswordToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/userWithForgotPasswordToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/userWithForgotPasswordToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.forgotPasswordToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.forgot_password': body.forgotPasswordToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}, {projection: {_id: 1, __v: 1, username: 1, active: 1}});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\t\t\tuser: user\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/setUserWithForgotPasswordToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tforgotPasswordToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/setUserWithForgotPasswordToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/setUserWithForgotPasswordToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.forgotPasswordToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.forgot_password': body.forgotPasswordToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tawait Users.setPassword(user, body.password);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: true\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/resetPassword', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tusername: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/resetPassword)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/resetPassword' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet user = await Users.findOne({active: true, username: body.username});\n\n\t\t\tif (!user) {\n\t\t\t\tuser = await Users.findOne({active: true, email: body.username});\n\t\t\t}\n\t\t\t\n\t\t\tif (user) {\n\t\t\t\tmainServer.getMethodManager().callMethod.call(mainServer.getMethodManager(), 'resetUserPassword', user._id);\n\t\t\t}\n\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: false,\n\t\t\t\tresult: ''\n\t\t\t}));\n\t\t}\n\t});\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/http/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA0C;AAC1C,uCAAyC;AACzC,kCAAoC;AACpC,yCAAoC;AACpC,6CAAwC;AACxC,kEAAuD;AACvD,gEAA0D;AAE1D,yCAAmD;AAEnD,SAAgB,eAAe,CAAC,UAA+B,EAAE,GAAG,EAAE,YAAY;IAAlF,iBAytBC;IAxtBA,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,UAAO,OAAO,EAAE,QAAQ;;;;;yBAC5D,CAAA,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,UAAU,CA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ebtoken';\nimport jwt_decode from 'jwt-decode';\nimport SimpleSchema from 'simpl-schema';\nimport { Users } from '../collections/user.collection';\nimport { ResolveIOServer } from '../resolveio-server-app';\nimport { ResolveIOMainServer } from '../server-app';\nimport { objectIdHexString } from '../util/common';\n\nexport function setupAuthRoutes(mainServer: ResolveIOMainServer, app, serverConfig) {\n\tapp.post('/login365', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tid_token: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/login)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/login365' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet tokenData = body.id_token.split('&');\n\t\t\tlet token = tokenData[0].split('=')[1];\n\t\t\tlet decodedJWT = jwt_decode(token);\n\n\t\t\tif (decodedJWT && decodedJWT['name'] && decodedJWT['preferred_username'] && decodedJWT['oid']) {\n\t\t\t\tlet user = await Users.findOne({'other.ms_oid': decodedJWT['oid']});\n\n\t\t\t\tif (!user) {\n\t\t\t\t\tuser = await Users.findOne({email: decodedJWT['preferred_username'].toLowerCase()});\n\n\t\t\t\t\tif (user) {\n\t\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {'other.ms_oid': decodedJWT['oid']}});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!user) {\n\t\t\t\t\tuser = {\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\troles: {\n\t\t\t\t\t\t\tsuper_admin: false,\n\t\t\t\t\t\t\tapprovals: [],\n\t\t\t\t\t\t\tgroups: [],\n\t\t\t\t\t\t\tnotifications: [],\n\t\t\t\t\t\t\tmiscs: []\n\t\t\t\t\t\t},\n\t\t\t\t\t\tusername: decodedJWT['preferred_username'].toLowerCase(),\n\t\t\t\t\t\temail: decodedJWT['preferred_username'].toLowerCase(),\n\t\t\t\t\t\tfullname: decodedJWT['name'],\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\tphonenumber: '',\n\t\t\t\t\t\treadonly: false,\n\t\t\t\t\t\tother: {\n\t\t\t\t\t\t\tms_oid: decodedJWT['oid']\n\t\t\t\t\t\t},\n\t\t\t\t\t\tattempts: 0,\n\t\t\t\t\t\tsalt: jwt.sign({now: (Date.now() - 1000).toString()}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t}),\n\t\t\t\t\t\thash: jwt.sign({now: (Date.now() + 1000).toString()}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tlast: new Date(),\n\t\t\t\t\t\tsettings: null,\n\t\t\t\t\t\tservices: null,\n\t\t\t\t\t\tis_customer: false\n\t\t\t\t\t};\n\t\t\t\t\t\n\t\t\t\t\tawait Users.create(user);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet update = false;\n\n\t\t\t\t\tif (user.email !== decodedJWT['preferred_username'].toLowerCase()) {\n\t\t\t\t\t\tuser.email = decodedJWT['preferred_username'].toLowerCase();\n\t\t\t\t\t\tupdate = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (user.fullname !== decodedJWT['name']) {\n\t\t\t\t\t\tuser.fullname = decodedJWT['name'];\n\t\t\t\t\t\tupdate = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (update) {\n\t\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {email: user.email, fullname: user.fullname}});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\terror: false,\n\t\t\t\t\tresult: {\n\t\t\t\t\t\ttoken: jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('ERROR - 1', tokenData, token, decodedJWT);\n\n\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\terror: true,\n\t\t\t\t\tresult: 'Invalid Azure Token'\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\t});\n\n\t// Login via HTTP, return refresh token if authenticated\n\tapp.post('/login', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tusername: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/login)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/login' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet user = await Users.findOne({active: true, username: body.username});\n\n\t\t\tif (!user) {\n\t\t\t\tuser = await Users.findOne({active: true, email: body.username});\n\t\t\t}\n\t\t\t\n\t\t\tif (!user) {\n\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\terror: true,\n\t\t\t\t\tresult: 'Invalid Username And Password'\n\t\t\t\t}));\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet resAuth = await Users.authenticate(user, body.password);\n\n\t\t\tif (resAuth['error']) {\n\t\t\t\tif (resAuth['error'] === 'Too Many Attempts') {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: resAuth['error'] + '. A password reset link has been sent to your email, please reset your password.'\n\t\t\t\t\t}));\n\n\t\t\t\t\tif (!user.services) {\n\t\t\t\t\t\tuser.services = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tuser.services['forgot_password'] = jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET']);\n\n\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\tuserWhoResetPassword: ResolveIOServer.getClientName() + ' System',\n\t\t\t\t\t\turl: (serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(serverConfig['SERVER_URL']) + '&' + user.services['forgot_password'])\n\t\t\t\t\t};\n\n\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {services: user.services}});\n\t\t\t\t\tlet html = mainServer.getMethodManager().readFile('email-templates/forgot-password.html');\n\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t});\n\t\n\t\t\t\t\tawait mainServer.getMethodManager().sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData), null, null, '');\n\t\t\t\t}\n\t\t\t\telse if (resAuth['error'] === 'No Salt Value Stored') {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'A password reset link has been sent to your email, please reset your password.'\n\t\t\t\t\t}));\n\n\t\t\t\t\tif (!user.services) {\n\t\t\t\t\t\tuser.services = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tuser.services['forgot_password'] = jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET']);\n\n\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\tuserWhoResetPassword: ResolveIOServer.getClientName() + ' System',\n\t\t\t\t\t\turl: (serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(serverConfig['SERVER_URL']) + '&' + user.services['forgot_password'])\n\t\t\t\t\t};\n\n\t\t\t\t\tawait Users.updateOne({_id: user._id}, {$set: {services: user.services}});\n\t\t\t\t\tlet html = mainServer.getMethodManager().readFile('email-templates/forgot-password.html');\n\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t});\n\n\t\t\t\t\tawait mainServer.getMethodManager().sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData), null, null, '');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: resAuth['error']\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (resAuth && resAuth['data'] && resAuth['data'].active) {\n\t\t\t\t\tawait Users.resetAttempts(resAuth['data']);\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: false,\n\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\ttoken: jwt.sign({id_user: resAuth['data']._id}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\texpiresIn : 90 * 24 * 60 * 60 * 1000 // 90 days\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} \n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tapp.post('/accessToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\trefreshToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/accessToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/accessToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.refreshToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findById(decoded['id_user']);\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\t\t\ttoken: jwt.sign({id_user: user._id}, serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\t\t\t\texpiresIn : 3 * 24 * 60 * 60 * 1000 // 3 days\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tuser: user\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/userWithEnrollmentToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tenrollmentToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/userWithEnrollmentToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/userWithEnrollmentToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.enrollmentToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.enrollment': body.enrollmentToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}, {projection: {_id: 1, __v: 1, username: 1, active: 1}});\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\t\t\tuser: user\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/setUserWithEnrollmentToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tenrollmentToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/setUserWithEnrollmentToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/setUserWithEnrollmentToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.enrollmentToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.enrollment': body.enrollmentToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tawait Users.setPassword(user, body.password);\n\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: true\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/userWithForgotPasswordToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tforgotPasswordToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/userWithForgotPasswordToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/userWithForgotPasswordToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.forgotPasswordToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.forgot_password': body.forgotPasswordToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}, {projection: {_id: 1, __v: 1, username: 1, active: 1}});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\t\t\tuser: user\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/setUserWithForgotPasswordToken', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tforgotPasswordToken: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tpassword: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/setUserWithForgotPasswordToken)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/setUserWithForgotPasswordToken' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjwt.verify(body.forgotPasswordToken, serverConfig['JWT_SECRET'], async (err, decoded) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Token'\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet user = await Users.findOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: decoded['id_user']},\n\t\t\t\t\t\t\t\t{'services.forgot_password': body.forgotPasswordToken}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif (user) {\n\t\t\t\t\t\t\tif (user.active) {\n\t\t\t\t\t\t\t\tawait Users.setPassword(user, body.password);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: false,\n\t\t\t\t\t\t\t\t\tresult: true\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\t\tresult: 'Account is Disabled'\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\t\tresult: 'Invalid User'\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch {\n\t\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\t\terror: true,\n\t\t\t\t\t\t\tresult: 'Invalid Mongo Get User'\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tapp.post('/resetPassword', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tusername: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/resetPassword)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/resetPassword' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet user = await Users.findOne({active: true, username: body.username});\n\n\t\t\tif (!user) {\n\t\t\t\tuser = await Users.findOne({active: true, email: body.username});\n\t\t\t}\n\t\t\t\n\t\t\tif (user) {\n\t\t\t\tmainServer.getMethodManager().callMethod.call(mainServer.getMethodManager(), 'resetUserPassword', user._id);\n\t\t\t}\n\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: false,\n\t\t\t\tresult: ''\n\t\t\t}));\n\t\t}\n\t});\n}"]}
|
package/http/health.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupHealthRoutes = void 0;
|
|
4
|
+
var bodyParser = require("body-parser");
|
|
5
|
+
function setupHealthRoutes(app) {
|
|
6
|
+
app.get('/health', bodyParser.json(), function (request, response) {
|
|
7
|
+
response.sendStatus(200);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
exports.setupHealthRoutes = setupHealthRoutes;
|
|
11
|
+
|
|
2
12
|
//# sourceMappingURL=health.js.map
|
package/http/health.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/http/health.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../src/http/health.ts"],"names":[],"mappings":";;;AAAA,wCAA0C;AAE1C,SAAgB,iBAAiB,CAAC,GAAG;IACpC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,UAAU,OAAO,EAAE,QAAQ;QAChE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACJ,CAAC;AAJD,8CAIC","file":"health.js","sourcesContent":["import * as bodyParser from 'body-parser';\n\nexport function setupHealthRoutes(app) {\n\tapp.get('/health', bodyParser.json(), function (request, response) {\n\t\tresponse.sendStatus(200);\n\t});\n}"]}
|
package/http/home.js
CHANGED
|
@@ -1,2 +1,115 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.setupHomeRoutes = void 0;
|
|
40
|
+
var bodyParser = require("body-parser");
|
|
41
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
42
|
+
var resolveio_server_app_1 = require("../resolveio-server-app");
|
|
43
|
+
function setupHomeRoutes(mainServer, app, serverConfig) {
|
|
44
|
+
var _this = this;
|
|
45
|
+
app.post('/resolveioContactUs', bodyParser.json(), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
46
|
+
var body, schema, errors_1, form;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
if (!(request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'])) return [3 /*break*/, 1];
|
|
51
|
+
response.send(JSON.stringify({
|
|
52
|
+
error: true,
|
|
53
|
+
result: 'Invalid header'
|
|
54
|
+
}));
|
|
55
|
+
return [3 /*break*/, 7];
|
|
56
|
+
case 1:
|
|
57
|
+
body = request.body;
|
|
58
|
+
schema = new simpl_schema_1.default({
|
|
59
|
+
form: {
|
|
60
|
+
type: Object
|
|
61
|
+
},
|
|
62
|
+
'form.name': {
|
|
63
|
+
type: String
|
|
64
|
+
},
|
|
65
|
+
'form.email': {
|
|
66
|
+
type: String
|
|
67
|
+
},
|
|
68
|
+
'form.phone': {
|
|
69
|
+
type: String
|
|
70
|
+
},
|
|
71
|
+
'form.subject': {
|
|
72
|
+
type: String
|
|
73
|
+
},
|
|
74
|
+
'form.message': {
|
|
75
|
+
type: String
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
_a.label = 2;
|
|
79
|
+
case 2:
|
|
80
|
+
_a.trys.push([2, 3, , 6]);
|
|
81
|
+
schema.validate(body);
|
|
82
|
+
return [3 /*break*/, 6];
|
|
83
|
+
case 3:
|
|
84
|
+
errors_1 = _a.sent();
|
|
85
|
+
if (!errors_1) return [3 /*break*/, 5];
|
|
86
|
+
console.error(new Date(), 'Error in HTTP Check (/resolveioContactUs)', errors_1);
|
|
87
|
+
return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', resolveio_server_app_1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/resolveioContactUs' + '\n\nData Being Checked\n' + JSON.stringify(body, null, 2) + '\n\nErrors\n' + JSON.stringify(errors_1, null, 2))];
|
|
88
|
+
case 4:
|
|
89
|
+
_a.sent();
|
|
90
|
+
response.send(JSON.stringify({
|
|
91
|
+
error: true,
|
|
92
|
+
result: 'Invalid Parameters'
|
|
93
|
+
}));
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
case 5: return [3 /*break*/, 6];
|
|
96
|
+
case 6:
|
|
97
|
+
form = request.body.form;
|
|
98
|
+
mainServer.getMethodManager().sendEmail('dustin@resolveio.com', 'ResolveIO - Contact Us', '', 'Name: ' + form.name + '<br>' +
|
|
99
|
+
'Email: ' + form.email + '<br>' +
|
|
100
|
+
'Phone: ' + form.phone + '<br>' +
|
|
101
|
+
'Subject: ' + form.subject + '<br>' +
|
|
102
|
+
'Message: ' + form.message + '<br>');
|
|
103
|
+
response.send(JSON.stringify({
|
|
104
|
+
error: false,
|
|
105
|
+
result: null
|
|
106
|
+
}));
|
|
107
|
+
_a.label = 7;
|
|
108
|
+
case 7: return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); });
|
|
112
|
+
}
|
|
113
|
+
exports.setupHomeRoutes = setupHomeRoutes;
|
|
114
|
+
|
|
2
115
|
//# sourceMappingURL=home.js.map
|
package/http/home.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/http/home.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../src/http/home.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA0C;AAC1C,6CAAwC;AACxC,gEAA0D;AAE1D,SAAgB,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,YAAY;IAA7D,iBAiEC;IAhEA,GAAG,CAAC,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,UAAO,OAAO,EAAE,QAAQ;;;;;yBACtE,CAAA,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,cAAc,CAAC,CAAA,EAA9G,wBAA8G;oBACjH,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;wBAC5B,KAAK,EAAE,IAAI;wBACX,MAAM,EAAE,gBAAgB;qBACxB,CAAC,CAAC,CAAC;;;oBAGA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;oBAEpB,MAAM,GAAG,IAAI,sBAAY,CAAC;wBAC7B,IAAI,EAAE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,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,MAAM;wBAC/B,WAAW,GAAG,IAAI,CAAC,OAAO,GAAG,MAAM;wBACnC,WAAW,GAAG,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;oBAErC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;wBACrC,KAAK,EAAE,KAAK;wBACZ,MAAM,EAAE,IAAI;qBACZ,CAAC,CAAC,CAAC;;;;;SAEL,CAAC,CAAC;AACJ,CAAC;AAjED,0CAiEC","file":"home.js","sourcesContent":["import * as bodyParser from 'body-parser';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../resolveio-server-app';\n\nexport function setupHomeRoutes(mainServer, app, serverConfig) {\n\tapp.post('/resolveioContactUs', bodyParser.json(), async (request, response) => {\n\t\tif (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL']) {\n\t\t\tresponse.send(JSON.stringify({\n\t\t\t\terror: true,\n\t\t\t\tresult: 'Invalid header'\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tlet body = request.body;\n\n\t\t\tlet schema = new SimpleSchema({\n\t\t\t\tform: {\n\t\t\t\t\ttype: Object\n\t\t\t\t},\n\t\t\t\t'form.name': {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\t'form.email': {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\t'form.phone': {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\t'form.subject': {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\t'form.message': {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\ttry {\n\t\t\t\tschema.validate(body);\n\t\t\t}\n\t\t\tcatch (errors) {\n\t\t\t\tif (errors) {\n\t\t\t\t\tconsole.error(new Date(), 'Error in HTTP Check (/resolveioContactUs)', errors);\n\t\n\t\t\t\t\tawait ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/resolveioContactUs' + '\\n\\nData Being Checked\\n' + JSON.stringify(body, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\n\t\t\t\t\tresponse.send(JSON.stringify({\n\t\t\t\t\t\terror: true,\n\t\t\t\t\t\tresult: 'Invalid Parameters'\n\t\t\t\t\t}));\n\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n let form = request.body.form;\n \n mainServer.getMethodManager().sendEmail('dustin@resolveio.com', 'ResolveIO - Contact Us', '', \n 'Name: ' + form.name + '<br>' + \n 'Email: ' + form.email + '<br>' + \n 'Phone: ' + form.phone + '<br>' + \n 'Subject: ' + form.subject + '<br>' + \n 'Message: ' + form.message + '<br>');\n\n response.send(JSON.stringify({\n\t\t\t\terror: false,\n\t\t\t\tresult: null\n\t\t\t}));\n\t\t}\n\t});\n}"]}
|
package/index.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./public_api"), exports);
|
|
18
|
+
|
|
2
19
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B","file":"index.js","sourcesContent":["export * from './public_api';"]}
|