From 3628971eb89d10e57c4de62646922c41dc5d958c Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Mon, 3 May 2021 20:08:30 +0530 Subject: [PATCH 01/39] addedremainingTimes --- .history/app_20210503200710.js | 99 ++++++++++++++++++++++++ .history/models/Coupon_20210503200331.js | 16 ++++ .history/models/Coupon_20210503200625.js | 16 ++++ .history/routes/Coupon_20210503200453.js | 54 +++++++++++++ .history/routes/Coupon_20210503200528.js | 52 +++++++++++++ .history/routes/Coupon_20210503200538.js | 53 +++++++++++++ .history/routes/Coupon_20210503200623.js | 53 +++++++++++++ models/Coupon.js | 9 ++- routes/Coupon.js | 9 ++- 9 files changed, 357 insertions(+), 4 deletions(-) create mode 100644 .history/app_20210503200710.js create mode 100644 .history/models/Coupon_20210503200331.js create mode 100644 .history/models/Coupon_20210503200625.js create mode 100644 .history/routes/Coupon_20210503200453.js create mode 100644 .history/routes/Coupon_20210503200528.js create mode 100644 .history/routes/Coupon_20210503200538.js create mode 100644 .history/routes/Coupon_20210503200623.js diff --git a/.history/app_20210503200710.js b/.history/app_20210503200710.js new file mode 100644 index 0000000..c081f70 --- /dev/null +++ b/.history/app_20210503200710.js @@ -0,0 +1,99 @@ +const express = require('express') ; +const mongoose = require('mongoose') ; +const bodyparser = require('body-parser') ; +const authRoute = require('./routes/auth') ; +const profileRoute = require('./routes/profile') ; +const paymentRoute = require('./routes/payment') ; +const courseRoute = require('./routes/course') ; +const adminRoute = require('./routes/admin') ; +const port=process.env.PORT || 5000; + +const cors = require('cors') ; +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express() ; + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` + +app.use(cors()) ; +app.use(bodyparser.json()) ; +require('./models/Coupon') + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require('./routes/Coupon')) +app.use(authRoute) ; + +app.use(profileRoute) ; + +app.use(paymentRoute) ; + +app.use(courseRoute) ; + +app.use(adminRoute) ; + + +mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:false}). +then(result => { + console.log('connected'); + app.listen(port,()=>{ + console.log("server is running on port",port); + }) ; +}) +.catch(err => { + console.log(err); +}) \ No newline at end of file diff --git a/.history/models/Coupon_20210503200331.js b/.history/models/Coupon_20210503200331.js new file mode 100644 index 0000000..a68a548 --- /dev/null +++ b/.history/models/Coupon_20210503200331.js @@ -0,0 +1,16 @@ +const mongoose=require('mongoose') +const CouponSchema=new mongoose.Schema({ + coupon_code:{ + type:String, + required:true + }, + percentage:{ + type:String, + required:true + }, + remainingTimes:{ + type:Number + } +}) + +module.exports=mongoose.model("Coupon",CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503200625.js b/.history/models/Coupon_20210503200625.js new file mode 100644 index 0000000..a68a548 --- /dev/null +++ b/.history/models/Coupon_20210503200625.js @@ -0,0 +1,16 @@ +const mongoose=require('mongoose') +const CouponSchema=new mongoose.Schema({ + coupon_code:{ + type:String, + required:true + }, + percentage:{ + type:String, + required:true + }, + remainingTimes:{ + type:Number + } +}) + +module.exports=mongoose.model("Coupon",CouponSchema) \ No newline at end of file diff --git a/.history/routes/Coupon_20210503200453.js b/.history/routes/Coupon_20210503200453.js new file mode 100644 index 0000000..82be28f --- /dev/null +++ b/.history/routes/Coupon_20210503200453.js @@ -0,0 +1,54 @@ +const express = require("express"); +const router = express.Router(); +const mongoose = require("mongoose"); +const Coupon = mongoose.model("Coupon"); + +router.get("/get-coupon", (req, res) => { + Coupon.find().then((result) => { + res.status(200).json({ coupon: result }); + console.log(result); + }); +}); + +router.post("/set-coupon", (req, res) => { + const { percentage, coupon_code ,remainingTimes} = req.body; + if(!coupon_code || !percentage || !remainingTimes){ + return res.status(422).json({error:"Add all fields"}) + }else{ + const coupon = new Coupon({ + coupon_code, + percentage, + remainingTimes + }); + coupon.save().then((result) => { + res.status(200).json({ message: "Coupon set Successfully" }); + }); +}); + } + + +router.delete("/delete-coupon", (req, res) => { + Coupon.remove({ _id: req.body.id }).then((result) => { + res.status(200).json({ message: "Coupon Deleted" }); + }); +}); + +router.put("/update-coupon", (req, res) => { + const {coupon_code,percentage} =req.body; + Coupon.findByIdAndUpdate( + req.body._id, + { + $set: { + coupon_code,percentage + } + }, + { new: true }) + .then((result) => { + res.status(200).json({ message: result }); + }) + .catch((err) => { + console.log(err); + }); +}); + +module.exports = router; diff --git a/.history/routes/Coupon_20210503200528.js b/.history/routes/Coupon_20210503200528.js new file mode 100644 index 0000000..7cccf4b --- /dev/null +++ b/.history/routes/Coupon_20210503200528.js @@ -0,0 +1,52 @@ +const express = require("express"); +const router = express.Router(); +const mongoose = require("mongoose"); +const Coupon = mongoose.model("Coupon"); + +router.get("/get-coupon", (req, res) => { + Coupon.find().then((result) => { + res.status(200).json({ coupon: result }); + console.log(result); + }); +}); + +router.post("/set-coupon", (req, res) => { + const { percentage, coupon_code ,remainingTimes} = req.body; + if(!coupon_code || !percentage || !remainingTimes){ + return res.status(422).json({error:"Add all fields"}) + }else{ + const coupon = new Coupon({ + coupon_code, + percentage, + }); + coupon.save().then((result) => { + res.status(200).json({ message: "Coupon set Successfully" }); + }); + } +}); + +router.delete("/delete-coupon", (req, res) => { + Coupon.remove({ _id: req.body.id }).then((result) => { + res.status(200).json({ message: "Coupon Deleted" }); + }); +}); + +router.put("/update-coupon", (req, res) => { + const {coupon_code,percentage} =req.body; + Coupon.findByIdAndUpdate( + req.body._id, + { + $set: { + coupon_code,percentage + } + }, + { new: true }) + .then((result) => { + res.status(200).json({ message: result }); + }) + .catch((err) => { + console.log(err); + }); +}); + +module.exports = router; diff --git a/.history/routes/Coupon_20210503200538.js b/.history/routes/Coupon_20210503200538.js new file mode 100644 index 0000000..36980c3 --- /dev/null +++ b/.history/routes/Coupon_20210503200538.js @@ -0,0 +1,53 @@ +const express = require("express"); +const router = express.Router(); +const mongoose = require("mongoose"); +const Coupon = mongoose.model("Coupon"); + +router.get("/get-coupon", (req, res) => { + Coupon.find().then((result) => { + res.status(200).json({ coupon: result }); + console.log(result); + }); +}); + +router.post("/set-coupon", (req, res) => { + const { percentage, coupon_code ,remainingTimes} = req.body; + if(!coupon_code || !percentage || !remainingTimes){ + return res.status(422).json({error:"Add all fields"}) + }else{ + const coupon = new Coupon({ + coupon_code, + percentage, + remainingTimes + }); + coupon.save().then((result) => { + res.status(200).json({ message: "Coupon set Successfully" }); + }); + } +}); + +router.delete("/delete-coupon", (req, res) => { + Coupon.remove({ _id: req.body.id }).then((result) => { + res.status(200).json({ message: "Coupon Deleted" }); + }); +}); + +router.put("/update-coupon", (req, res) => { + const {coupon_code,percentage} =req.body; + Coupon.findByIdAndUpdate( + req.body._id, + { + $set: { + coupon_code,percentage + } + }, + { new: true }) + .then((result) => { + res.status(200).json({ message: result }); + }) + .catch((err) => { + console.log(err); + }); +}); + +module.exports = router; diff --git a/.history/routes/Coupon_20210503200623.js b/.history/routes/Coupon_20210503200623.js new file mode 100644 index 0000000..36980c3 --- /dev/null +++ b/.history/routes/Coupon_20210503200623.js @@ -0,0 +1,53 @@ +const express = require("express"); +const router = express.Router(); +const mongoose = require("mongoose"); +const Coupon = mongoose.model("Coupon"); + +router.get("/get-coupon", (req, res) => { + Coupon.find().then((result) => { + res.status(200).json({ coupon: result }); + console.log(result); + }); +}); + +router.post("/set-coupon", (req, res) => { + const { percentage, coupon_code ,remainingTimes} = req.body; + if(!coupon_code || !percentage || !remainingTimes){ + return res.status(422).json({error:"Add all fields"}) + }else{ + const coupon = new Coupon({ + coupon_code, + percentage, + remainingTimes + }); + coupon.save().then((result) => { + res.status(200).json({ message: "Coupon set Successfully" }); + }); + } +}); + +router.delete("/delete-coupon", (req, res) => { + Coupon.remove({ _id: req.body.id }).then((result) => { + res.status(200).json({ message: "Coupon Deleted" }); + }); +}); + +router.put("/update-coupon", (req, res) => { + const {coupon_code,percentage} =req.body; + Coupon.findByIdAndUpdate( + req.body._id, + { + $set: { + coupon_code,percentage + } + }, + { new: true }) + .then((result) => { + res.status(200).json({ message: result }); + }) + .catch((err) => { + console.log(err); + }); +}); + +module.exports = router; diff --git a/models/Coupon.js b/models/Coupon.js index e69ad70..a68a548 100644 --- a/models/Coupon.js +++ b/models/Coupon.js @@ -1,10 +1,15 @@ const mongoose=require('mongoose') const CouponSchema=new mongoose.Schema({ coupon_code:{ - type:String + type:String, + required:true }, percentage:{ - type:String + type:String, + required:true + }, + remainingTimes:{ + type:Number } }) diff --git a/routes/Coupon.js b/routes/Coupon.js index 7813150..36980c3 100644 --- a/routes/Coupon.js +++ b/routes/Coupon.js @@ -11,14 +11,19 @@ router.get("/get-coupon", (req, res) => { }); router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ + const { percentage, coupon_code ,remainingTimes} = req.body; + if(!coupon_code || !percentage || !remainingTimes){ + return res.status(422).json({error:"Add all fields"}) + }else{ + const coupon = new Coupon({ coupon_code, percentage, + remainingTimes }); coupon.save().then((result) => { res.status(200).json({ message: "Coupon set Successfully" }); }); + } }); router.delete("/delete-coupon", (req, res) => { From 9400a61e838d58153c0c9d68ff18d4624996ddb9 Mon Sep 17 00:00:00 2001 From: hardcodder Date: Fri, 7 May 2021 19:08:11 +0530 Subject: [PATCH 02/39] Added graduation Year to query Schema --- controllers/query.js | 2 ++ models/query.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/controllers/query.js b/controllers/query.js index c4eca85..7f7848b 100644 --- a/controllers/query.js +++ b/controllers/query.js @@ -8,6 +8,7 @@ module.exports.addQuery = async (req , res , next)=> { let email = req.body.email ; let query = req.body.query || " " ; let other = req.body.other || false ; + let graduationYear = req.body.graduationYear ; let queryModel = await Query.findOne({email:email , query:query}) ; if(queryModel) { @@ -27,6 +28,7 @@ module.exports.addQuery = async (req , res , next)=> { email : email, query : query , numAsked : 1 , + graduationYear : graduationYear , other : other }) ; await queryModel.save() ; diff --git a/models/query.js b/models/query.js index 03cceaa..69edf0f 100644 --- a/models/query.js +++ b/models/query.js @@ -26,6 +26,10 @@ const querySchema = new Schema({ other : { type : Boolean , require : true + } , + graduationYear : { + type : Number , + required :true } }) ; From 87af5c7be881606aa07ec212af868ecc8f302d06 Mon Sep 17 00:00:00 2001 From: hardcodder Date: Fri, 7 May 2021 19:16:15 +0530 Subject: [PATCH 03/39] Added phone number and fullname to query Schema --- controllers/query.js | 8 ++++---- models/query.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/controllers/query.js b/controllers/query.js index 7f7848b..8dc4c39 100644 --- a/controllers/query.js +++ b/controllers/query.js @@ -3,8 +3,8 @@ const Query = require('../models/query') ; module.exports.addQuery = async (req , res , next)=> { try { - let firstName = req.body.firstName || " " ; - let lastName = req.body.lastName || " " ; + let fullName = req.body.fullName || " " ; + let phoneNumber = req.body.phoneNumber ; let email = req.body.email ; let query = req.body.query || " " ; let other = req.body.other || false ; @@ -23,8 +23,8 @@ module.exports.addQuery = async (req , res , next)=> { else { queryModel = new Query ({ - firstName : firstName , - lastName : lastName , + fullName : fullName , + phoneNumber : phoneNumber , email : email, query : query , numAsked : 1 , diff --git a/models/query.js b/models/query.js index 69edf0f..1da09ba 100644 --- a/models/query.js +++ b/models/query.js @@ -3,13 +3,13 @@ const mongoose = require('mongoose') ; const Schema = mongoose.Schema ; const querySchema = new Schema({ - firstName : { + fullName : { type :String , required : true } , - lastName : { - type:String , - required: true + phoneNumber : { + type : String , + required : true } , email : { type:String , From cd97b83292c3d18a1ab9bf1a7a27ca32d8d97895 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Sun, 9 May 2021 17:01:53 +0530 Subject: [PATCH 04/39] Added PhoneAuth --- .env | 3 + .history/.env_20210509163951 | 0 .history/.env_20210509164017 | 1 + .history/.env_20210509164034 | 3 + .history/.env_20210509164050 | 3 + .history/.env_20210509164109 | 3 + .history/.env_20210509164138 | 3 + .history/.env_20210509164140 | 3 + .history/app_20210509163930.js | 103 +++++++++ .history/app_20210509163946.js | 103 +++++++++ .history/app_20210509164233.js | 103 +++++++++ .history/controllers/auth_20210503150708.js | 103 +++++++++ .history/controllers/auth_20210509153635.js | 102 +++++++++ .history/controllers/auth_20210509154632.js | 130 +++++++++++ .history/controllers/auth_20210509155010.js | 130 +++++++++++ .history/controllers/auth_20210509155051.js | 130 +++++++++++ .history/controllers/auth_20210509155117.js | 130 +++++++++++ .history/controllers/auth_20210509155429.js | 130 +++++++++++ .history/controllers/auth_20210509155455.js | 130 +++++++++++ .history/controllers/auth_20210509155647.js | 130 +++++++++++ .history/controllers/auth_20210509155744.js | 130 +++++++++++ .history/controllers/auth_20210509160156.js | 130 +++++++++++ .history/controllers/auth_20210509161351.js | 130 +++++++++++ .history/controllers/auth_20210509164829.js | 130 +++++++++++ .history/controllers/auth_20210509165526.js | 130 +++++++++++ .history/controllers/auth_20210509165744.js | 134 ++++++++++++ .history/controllers/auth_20210509165914.js | 134 ++++++++++++ .history/models/User_20210503150708.js | 34 +++ .history/models/User_20210509151714.js | 37 ++++ .history/models/User_20210509151719.js | 37 ++++ .history/routes/auth_20210503150708.js | 12 ++ .history/routes/auth_20210509154824.js | 16 ++ .history/routes/auth_20210509164314.js | 16 ++ app.js | 74 ++++--- controllers/auth.js | 225 +++++++++++--------- models/User.js | 63 +++--- package-lock.json | 72 +++++++ package.json | 2 + routes/auth.js | 20 +- 39 files changed, 2799 insertions(+), 170 deletions(-) create mode 100644 .env create mode 100644 .history/.env_20210509163951 create mode 100644 .history/.env_20210509164017 create mode 100644 .history/.env_20210509164034 create mode 100644 .history/.env_20210509164050 create mode 100644 .history/.env_20210509164109 create mode 100644 .history/.env_20210509164138 create mode 100644 .history/.env_20210509164140 create mode 100644 .history/app_20210509163930.js create mode 100644 .history/app_20210509163946.js create mode 100644 .history/app_20210509164233.js create mode 100644 .history/controllers/auth_20210503150708.js create mode 100644 .history/controllers/auth_20210509153635.js create mode 100644 .history/controllers/auth_20210509154632.js create mode 100644 .history/controllers/auth_20210509155010.js create mode 100644 .history/controllers/auth_20210509155051.js create mode 100644 .history/controllers/auth_20210509155117.js create mode 100644 .history/controllers/auth_20210509155429.js create mode 100644 .history/controllers/auth_20210509155455.js create mode 100644 .history/controllers/auth_20210509155647.js create mode 100644 .history/controllers/auth_20210509155744.js create mode 100644 .history/controllers/auth_20210509160156.js create mode 100644 .history/controllers/auth_20210509161351.js create mode 100644 .history/controllers/auth_20210509164829.js create mode 100644 .history/controllers/auth_20210509165526.js create mode 100644 .history/controllers/auth_20210509165744.js create mode 100644 .history/controllers/auth_20210509165914.js create mode 100644 .history/models/User_20210503150708.js create mode 100644 .history/models/User_20210509151714.js create mode 100644 .history/models/User_20210509151719.js create mode 100644 .history/routes/auth_20210503150708.js create mode 100644 .history/routes/auth_20210509154824.js create mode 100644 .history/routes/auth_20210509164314.js diff --git a/.env b/.env new file mode 100644 index 0000000..64a51f9 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +MONGO_USER:Cantilever, + MONGO_PASSWORD :Cantilever , + MONGO_DEFAULT_DATABASE :myFirstDatabase \ No newline at end of file diff --git a/.history/.env_20210509163951 b/.history/.env_20210509163951 new file mode 100644 index 0000000..e69de29 diff --git a/.history/.env_20210509164017 b/.history/.env_20210509164017 new file mode 100644 index 0000000..eb765ae --- /dev/null +++ b/.history/.env_20210509164017 @@ -0,0 +1 @@ +MONGO_USER:"Cantilever" \ No newline at end of file diff --git a/.history/.env_20210509164034 b/.history/.env_20210509164034 new file mode 100644 index 0000000..088aa13 --- /dev/null +++ b/.history/.env_20210509164034 @@ -0,0 +1,3 @@ +"MONGO_USER":"Cantilever", + "MONGO_PASSWORD" :"Cantilever" , + "MONGO_DEFAULT_DATABASE" :"myFirstDatabase" \ No newline at end of file diff --git a/.history/.env_20210509164050 b/.history/.env_20210509164050 new file mode 100644 index 0000000..39086ad --- /dev/null +++ b/.history/.env_20210509164050 @@ -0,0 +1,3 @@ +module.export={MONGO_USER:"Cantilever", + MONGO_PASSWORD :"Cantilever" , + MONGO_DEFAULT_DATABASE :"myFirstDatabase" } \ No newline at end of file diff --git a/.history/.env_20210509164109 b/.history/.env_20210509164109 new file mode 100644 index 0000000..39086ad --- /dev/null +++ b/.history/.env_20210509164109 @@ -0,0 +1,3 @@ +module.export={MONGO_USER:"Cantilever", + MONGO_PASSWORD :"Cantilever" , + MONGO_DEFAULT_DATABASE :"myFirstDatabase" } \ No newline at end of file diff --git a/.history/.env_20210509164138 b/.history/.env_20210509164138 new file mode 100644 index 0000000..64a51f9 --- /dev/null +++ b/.history/.env_20210509164138 @@ -0,0 +1,3 @@ +MONGO_USER:Cantilever, + MONGO_PASSWORD :Cantilever , + MONGO_DEFAULT_DATABASE :myFirstDatabase \ No newline at end of file diff --git a/.history/.env_20210509164140 b/.history/.env_20210509164140 new file mode 100644 index 0000000..64a51f9 --- /dev/null +++ b/.history/.env_20210509164140 @@ -0,0 +1,3 @@ +MONGO_USER:Cantilever, + MONGO_PASSWORD :Cantilever , + MONGO_DEFAULT_DATABASE :myFirstDatabase \ No newline at end of file diff --git a/.history/app_20210509163930.js b/.history/app_20210509163930.js new file mode 100644 index 0000000..71a0918 --- /dev/null +++ b/.history/app_20210509163930.js @@ -0,0 +1,103 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; +require("dotenv"); + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/app_20210509163946.js b/.history/app_20210509163946.js new file mode 100644 index 0000000..5def299 --- /dev/null +++ b/.history/app_20210509163946.js @@ -0,0 +1,103 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; +require("dotenv").config(); + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/app_20210509164233.js b/.history/app_20210509164233.js new file mode 100644 index 0000000..c8213d3 --- /dev/null +++ b/.history/app_20210509164233.js @@ -0,0 +1,103 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; +require("dotenv").config(); + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/controllers/auth_20210503150708.js b/.history/controllers/auth_20210503150708.js new file mode 100644 index 0000000..645d127 --- /dev/null +++ b/.history/controllers/auth_20210503150708.js @@ -0,0 +1,103 @@ +const bcrypt = require('bcryptjs') ; +const User = require('../models/User') ; +const Student = require('../models/Student') ; +const jwt = require('jsonwebtoken'); +const JWT_secret = "Cantileverlabs"; + +module.exports.Protected = async (req,res,next)=>{ + res.send("Hello User") +} +module.exports.postSignup = async (req , res , next) => { + try + { //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " " ; + let lastName = req.body.lastName || " " ; + let email = req.body.email ; + let password = req.body.password ; + let user = await User.findOne({email:email}) ; + if(user) + { + res.json({ + message:"User already exist" , + type:"error" + }) + } + else + { + const hashedPass = await bcrypt.hash(password , 12) ; + user = new User({ + firstName : firstName , + lastName : lastName , + email : email , + password : hashedPass , + isAdmin : false + }) ; + user = await user.save() ; + await Student.deleteOne({user:user._id}) ; + let student = new Student({ + user:user._id + }) + student = await student.save() ; + user.student = student._id ; + await user.save() ; + res.json({ + message:"Successfully signed Up" , + type:"success" + }) + } + } + catch(err) + { + console.log(err); + } +} ; + + +module.exports.postSignin = async (req , res , next) => { + try + { + //we need email and password as input + let email = req.body.email ; + let password = req.body.password ; + let user = await User.findOne({email : email}) ; + if(user) + { + const isMatched = await bcrypt.compare(password , user.password) ; + if(isMatched) + { + const token = jwt.sign({_id:user._id},JWT_secret) + res.json( + { + token:token + } + ) + } + else + { + res.json({ + message:"email and password doesn't match" , + type:"error" + }) + } + } + else + { + res.json({ + message:"No user with this email exists" , + type : "error" + }) + } + } + catch(err) + { + console.log(err); + } +} + +module.exports.checkProtected = (req , res , next) => { + console.log(req.user); + res.json({ + message:"Protected" , + user : req.user + }) +} \ No newline at end of file diff --git a/.history/controllers/auth_20210509153635.js b/.history/controllers/auth_20210509153635.js new file mode 100644 index 0000000..abe08a3 --- /dev/null +++ b/.history/controllers/auth_20210509153635.js @@ -0,0 +1,102 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.phoneAuth = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + } else { + messagebird.verify.create; + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509154632.js b/.history/controllers/auth_20210509154632.js new file mode 100644 index 0000000..c7feaaf --- /dev/null +++ b/.history/controllers/auth_20210509154632.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155010.js b/.history/controllers/auth_20210509155010.js new file mode 100644 index 0000000..95eb378 --- /dev/null +++ b/.history/controllers/auth_20210509155010.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const { messagebird } = require("messagebird"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155051.js b/.history/controllers/auth_20210509155051.js new file mode 100644 index 0000000..95eb378 --- /dev/null +++ b/.history/controllers/auth_20210509155051.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const { messagebird } = require("messagebird"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155117.js b/.history/controllers/auth_20210509155117.js new file mode 100644 index 0000000..bb30f83 --- /dev/null +++ b/.history/controllers/auth_20210509155117.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const { messagebird } = require("messagebird")(""); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155429.js b/.history/controllers/auth_20210509155429.js new file mode 100644 index 0000000..8cf5df4 --- /dev/null +++ b/.history/controllers/auth_20210509155429.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const { messagebird } = require("messagebird")(" "); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155455.js b/.history/controllers/auth_20210509155455.js new file mode 100644 index 0000000..8cf5df4 --- /dev/null +++ b/.history/controllers/auth_20210509155455.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const { messagebird } = require("messagebird")(" "); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155647.js b/.history/controllers/auth_20210509155647.js new file mode 100644 index 0000000..8b44c69 --- /dev/null +++ b/.history/controllers/auth_20210509155647.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")(" "); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code has been sent!", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509155744.js b/.history/controllers/auth_20210509155744.js new file mode 100644 index 0000000..e0acea9 --- /dev/null +++ b/.history/controllers/auth_20210509155744.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")(" "); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509160156.js b/.history/controllers/auth_20210509160156.js new file mode 100644 index 0000000..bdf5047 --- /dev/null +++ b/.history/controllers/auth_20210509160156.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509161351.js b/.history/controllers/auth_20210509161351.js new file mode 100644 index 0000000..bdf5047 --- /dev/null +++ b/.history/controllers/auth_20210509161351.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + try { + const { otp, phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509164829.js b/.history/controllers/auth_20210509164829.js new file mode 100644 index 0000000..3e02797 --- /dev/null +++ b/.history/controllers/auth_20210509164829.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509165526.js b/.history/controllers/auth_20210509165526.js new file mode 100644 index 0000000..cb03924 --- /dev/null +++ b/.history/controllers/auth_20210509165526.js @@ -0,0 +1,130 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509165744.js b/.history/controllers/auth_20210509165744.js new file mode 100644 index 0000000..812d0a7 --- /dev/null +++ b/.history/controllers/auth_20210509165744.js @@ -0,0 +1,134 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210509165914.js b/.history/controllers/auth_20210509165914.js new file mode 100644 index 0000000..d9b71a4 --- /dev/null +++ b/.history/controllers/auth_20210509165914.js @@ -0,0 +1,134 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/models/User_20210503150708.js b/.history/models/User_20210503150708.js new file mode 100644 index 0000000..205349f --- /dev/null +++ b/.history/models/User_20210503150708.js @@ -0,0 +1,34 @@ +const mongoose = require('mongoose') ; + +const Schema = mongoose.Schema ; + +const userSchema = new Schema({ + firstName : { + type :String , + required : true + } , + lastName : { + type:String , + required: true + } , + email : { + type:String , + required: true + } , + password : { + type : String + } , + googleId : { + type : String + } , + student : { + type : mongoose.Types.ObjectId , + ref: 'Student' + } , + isAdmin : { + type : Boolean + } + //need to add isAdmin +}) ; + +module.exports = mongoose.model("User" , userSchema) ; \ No newline at end of file diff --git a/.history/models/User_20210509151714.js b/.history/models/User_20210509151714.js new file mode 100644 index 0000000..434b290 --- /dev/null +++ b/.history/models/User_20210509151714.js @@ -0,0 +1,37 @@ +const mongoose = require("mongoose"); + +const Schema = mongoose.Schema; + +const userSchema = new Schema({ + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + //need to add isAdmin +}); + +module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210509151719.js b/.history/models/User_20210509151719.js new file mode 100644 index 0000000..434b290 --- /dev/null +++ b/.history/models/User_20210509151719.js @@ -0,0 +1,37 @@ +const mongoose = require("mongoose"); + +const Schema = mongoose.Schema; + +const userSchema = new Schema({ + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + //need to add isAdmin +}); + +module.exports = mongoose.model("User", userSchema); diff --git a/.history/routes/auth_20210503150708.js b/.history/routes/auth_20210503150708.js new file mode 100644 index 0000000..0eeb700 --- /dev/null +++ b/.history/routes/auth_20210503150708.js @@ -0,0 +1,12 @@ +const express = require('express') ; +const authController = require('../controllers/auth') ; +const isAuth = require('../middleware/requirelogin') ; +const router = express.Router() ; + +router.get('/protected' ,isAuth,authController.checkProtected) ; + +router.post('/signup' , authController.postSignup) ; + +router.post('/signin' , authController.postSignin) ; + +module.exports = router ; \ No newline at end of file diff --git a/.history/routes/auth_20210509154824.js b/.history/routes/auth_20210509154824.js new file mode 100644 index 0000000..59ba658 --- /dev/null +++ b/.history/routes/auth_20210509154824.js @@ -0,0 +1,16 @@ +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); + +router.get("/protected", isAuth, authController.checkProtected); + +router.post("/signup", authController.postSignup); + +router.post("/signin", authController.postSignin); + +router.post("/sendotp", authController.sendOTP); + +router.get("/getotp", authController.getOTP); + +module.exports = router; diff --git a/.history/routes/auth_20210509164314.js b/.history/routes/auth_20210509164314.js new file mode 100644 index 0000000..6c04fe6 --- /dev/null +++ b/.history/routes/auth_20210509164314.js @@ -0,0 +1,16 @@ +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); + +router.get("/protected", isAuth, authController.checkProtected); + +router.post("/signup", authController.postSignup); + +router.post("/signin", authController.postSignin); + +router.post("/sendotp", authController.sendOTP); + +router.post("/getotp", authController.getOTP); + +module.exports = router; diff --git a/app.js b/app.js index c081f70..c8213d3 100644 --- a/app.js +++ b/app.js @@ -1,25 +1,26 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; +require("dotenv").config(); -const cors = require('cors') ; +const cors = require("cors"); //const passport = require('passport'); //const cookieSession = require('cookie-session') ; //require('./passport-setup') ; -const app = express() ; +const app = express(); -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; -app.use(cors()) ; -app.use(bodyparser.json()) ; -require('./models/Coupon') +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); // app.use(cookieSession({ // name: 'test-session', @@ -34,7 +35,7 @@ require('./models/Coupon') // else // { // res.json({ -// error : "No user" +// error : "No user" // }) // } // } @@ -42,13 +43,12 @@ require('./models/Coupon') // app.use(passport.initialize()); // app.use(passport.session()); - // app.get('/failed' , (req , res) => { // res.json({ // error : "You have failed to login" // }) // }) - + // app.get('/' , (req , res) => { // console.log('you are not logged in'); @@ -64,7 +64,7 @@ require('./models/Coupon') // app.get('/auth/google', // passport.authenticate('google', { scope: ['profile' , 'email'] })); -// app.get('/auth/google/callback', +// app.get('/auth/google/callback', // passport.authenticate('google', { failureRedirect: '/failed' }), // function(req, res) { // res.redirect('/good'); @@ -75,25 +75,29 @@ require('./models/Coupon') // req.logout() ; // res.redirect('/') ; // }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; +app.use(require("./routes/Coupon")); +app.use(authRoute); -app.use(profileRoute) ; +app.use(profileRoute); -app.use(paymentRoute) ; +app.use(paymentRoute); -app.use(courseRoute) ; +app.use(courseRoute); -app.use(adminRoute) ; +app.use(adminRoute); - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:false}). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { console.log(err); -}) \ No newline at end of file + }); diff --git a/controllers/auth.js b/controllers/auth.js index 645d127..d9b71a4 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -1,103 +1,134 @@ -const bcrypt = require('bcryptjs') ; -const User = require('../models/User') ; -const Student = require('../models/Student') ; -const jwt = require('jsonwebtoken'); +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -module.exports.Protected = async (req,res,next)=>{ - res.send("Hello User") -} -module.exports.postSignup = async (req , res , next) => { - try - { //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " " ; - let lastName = req.body.lastName || " " ; - let email = req.body.email ; - let password = req.body.password ; - let user = await User.findOne({email:email}) ; - if(user) - { - res.json({ - message:"User already exist" , - type:"error" - }) - } - else - { - const hashedPass = await bcrypt.hash(password , 12) ; - user = new User({ - firstName : firstName , - lastName : lastName , - email : email , - password : hashedPass , - isAdmin : false - }) ; - user = await user.save() ; - await Student.deleteOne({user:user._id}) ; - let student = new Student({ - user:user._id - }) - student = await student.save() ; - user.student = student._id ; - await user.save() ; - res.json({ - message:"Successfully signed Up" , - type:"success" - }) - } +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); } - catch(err) - { - console.log(err); - } -} ; + } catch (err) { + console.log(err); + } +}; - -module.exports.postSignin = async (req , res , next) => { - try - { - //we need email and password as input - let email = req.body.email ; - let password = req.body.password ; - let user = await User.findOne({email : email}) ; - if(user) - { - const isMatched = await bcrypt.compare(password , user.password) ; - if(isMatched) - { - const token = jwt.sign({_id:user._id},JWT_secret) - res.json( - { - token:token - } - ) - } - else - { - res.json({ - message:"email and password doesn't match" , - type:"error" - }) - } - } - else - { - res.json({ - message:"No user with this email exists" , - type : "error" - }) - } +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); } - catch(err) - { - console.log(err); - } -} + } catch (err) { + console.log(err); + } +}; -module.exports.checkProtected = (req , res , next) => { - console.log(req.user); - res.json({ - message:"Protected" , - user : req.user - }) -} \ No newline at end of file +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/models/User.js b/models/User.js index 205349f..434b290 100644 --- a/models/User.js +++ b/models/User.js @@ -1,34 +1,37 @@ -const mongoose = require('mongoose') ; +const mongoose = require("mongoose"); -const Schema = mongoose.Schema ; +const Schema = mongoose.Schema; const userSchema = new Schema({ - firstName : { - type :String , - required : true - } , - lastName : { - type:String , - required: true - } , - email : { - type:String , - required: true - } , - password : { - type : String - } , - googleId : { - type : String - } , - student : { - type : mongoose.Types.ObjectId , - ref: 'Student' - } , - isAdmin : { - type : Boolean - } - //need to add isAdmin -}) ; + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + //need to add isAdmin +}); -module.exports = mongoose.model("User" , userSchema) ; \ No newline at end of file +module.exports = mongoose.model("User", userSchema); diff --git a/package-lock.json b/package-lock.json index e4d84ad..2ba48fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,10 @@ "cookie-session": "^1.4.0", "cors": "^2.8.5", "crypto": "^1.0.1", + "dotenv": "^9.0.1", "express": "^4.17.1", "jsonwebtoken": "^8.5.1", + "messagebird": "^3.6.1", "mongoose": "^5.12.2", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", @@ -695,6 +697,14 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.1.tgz", + "integrity": "sha512-W8FNeNnnvJoYfgkFRKzp8kTgz0T2YY4TJ9xy1Ma0hSebPTK8iquRtpG12TUrSTX5zIN9D/wSLEEuI+Ad35tlyw==", + "engines": { + "node": ">=10" + } + }, "node_modules/duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -1444,6 +1454,37 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, + "node_modules/messagebird": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/messagebird/-/messagebird-3.6.1.tgz", + "integrity": "sha512-HcbHxNp53MblcDReOo+sLvlr/aX1pGH/Liyegphpz+CXVKmEl2WUOKyPQCy69pTW8uRM8QlGbmYJP+BzZh/sRQ==", + "dependencies": { + "safe-buffer": "^5.2.1", + "scmp": "^2.1.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/messagebird/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -2172,6 +2213,11 @@ "node": ">=6" } }, + "node_modules/scmp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", + "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" + }, "node_modules/semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -3233,6 +3279,11 @@ "is-obj": "^2.0.0" } }, + "dotenv": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.1.tgz", + "integrity": "sha512-W8FNeNnnvJoYfgkFRKzp8kTgz0T2YY4TJ9xy1Ma0hSebPTK8iquRtpG12TUrSTX5zIN9D/wSLEEuI+Ad35tlyw==" + }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -3849,6 +3900,22 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, + "messagebird": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/messagebird/-/messagebird-3.6.1.tgz", + "integrity": "sha512-HcbHxNp53MblcDReOo+sLvlr/aX1pGH/Liyegphpz+CXVKmEl2WUOKyPQCy69pTW8uRM8QlGbmYJP+BzZh/sRQ==", + "requires": { + "safe-buffer": "^5.2.1", + "scmp": "^2.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } + } + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -4437,6 +4504,11 @@ "sparse-bitfield": "^3.0.3" } }, + "scmp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", + "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", diff --git a/package.json b/package.json index d13724d..57493f3 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,10 @@ "cookie-session": "^1.4.0", "cors": "^2.8.5", "crypto": "^1.0.1", + "dotenv": "^9.0.1", "express": "^4.17.1", "jsonwebtoken": "^8.5.1", + "messagebird": "^3.6.1", "mongoose": "^5.12.2", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", diff --git a/routes/auth.js b/routes/auth.js index 0eeb700..6c04fe6 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -1,12 +1,16 @@ -const express = require('express') ; -const authController = require('../controllers/auth') ; -const isAuth = require('../middleware/requirelogin') ; -const router = express.Router() ; +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); -router.get('/protected' ,isAuth,authController.checkProtected) ; +router.get("/protected", isAuth, authController.checkProtected); -router.post('/signup' , authController.postSignup) ; +router.post("/signup", authController.postSignup); -router.post('/signin' , authController.postSignin) ; +router.post("/signin", authController.postSignin); -module.exports = router ; \ No newline at end of file +router.post("/sendotp", authController.sendOTP); + +router.post("/getotp", authController.getOTP); + +module.exports = router; From 1775d79983018f2d3763661d0f8681a0c31dde1b Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Sun, 9 May 2021 18:26:52 +0530 Subject: [PATCH 05/39] Added Phone Auth --- .env | 3 - .history/app_20210509182548.js | 103 +++++++++++++++++++++++++++++++++ .history/app_20210509182557.js | 103 +++++++++++++++++++++++++++++++++ .history/app_20210509182624.js | 102 ++++++++++++++++++++++++++++++++ app.js | 3 +- 5 files changed, 309 insertions(+), 5 deletions(-) delete mode 100644 .env create mode 100644 .history/app_20210509182548.js create mode 100644 .history/app_20210509182557.js create mode 100644 .history/app_20210509182624.js diff --git a/.env b/.env deleted file mode 100644 index 64a51f9..0000000 --- a/.env +++ /dev/null @@ -1,3 +0,0 @@ -MONGO_USER:Cantilever, - MONGO_PASSWORD :Cantilever , - MONGO_DEFAULT_DATABASE :myFirstDatabase \ No newline at end of file diff --git a/.history/app_20210509182548.js b/.history/app_20210509182548.js new file mode 100644 index 0000000..5def299 --- /dev/null +++ b/.history/app_20210509182548.js @@ -0,0 +1,103 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; +require("dotenv").config(); + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/app_20210509182557.js b/.history/app_20210509182557.js new file mode 100644 index 0000000..5def299 --- /dev/null +++ b/.history/app_20210509182557.js @@ -0,0 +1,103 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; +require("dotenv").config(); + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/app_20210509182624.js b/.history/app_20210509182624.js new file mode 100644 index 0000000..9dec7ab --- /dev/null +++ b/.history/app_20210509182624.js @@ -0,0 +1,102 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/app.js b/app.js index c8213d3..9dec7ab 100644 --- a/app.js +++ b/app.js @@ -7,7 +7,6 @@ const paymentRoute = require("./routes/payment"); const courseRoute = require("./routes/course"); const adminRoute = require("./routes/admin"); const port = process.env.PORT || 5000; -require("dotenv").config(); const cors = require("cors"); //const passport = require('passport'); @@ -16,7 +15,7 @@ const cors = require("cors"); const app = express(); -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; app.use(cors()); app.use(bodyparser.json()); From f4ac5978a8f1dcb0c9f1ef32e9706006b37978fe Mon Sep 17 00:00:00 2001 From: hardcodder Date: Mon, 10 May 2021 14:30:02 +0530 Subject: [PATCH 06/39] for bugs --- controllers/payment.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/payment.js b/controllers/payment.js index 394a24f..4ae8264 100644 --- a/controllers/payment.js +++ b/controllers/payment.js @@ -108,6 +108,9 @@ module.exports.postRazorpay = async (req , res , next) => { const courseId = req.body.courseId ; const couponCode = req.body.couponCode ; const userId = req.user._id ; + + console.log(courseId , couponCode , userId) ; + let user = await User.findById(userId) ; let student =await Student.findById(user.student) ; let course =await CourseType.findById(courseId) ; From 03a373620aaba1b714c460933da0a66a11eb242a Mon Sep 17 00:00:00 2001 From: hardcodder Date: Mon, 10 May 2021 14:32:44 +0530 Subject: [PATCH 07/39] for bugs --- controllers/payment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/payment.js b/controllers/payment.js index 4ae8264..555dbf5 100644 --- a/controllers/payment.js +++ b/controllers/payment.js @@ -109,7 +109,7 @@ module.exports.postRazorpay = async (req , res , next) => { const couponCode = req.body.couponCode ; const userId = req.user._id ; - console.log(courseId , couponCode , userId) ; + console.log("Course ID =" ,courseId ," Coupon code =" , couponCode ," user ID =" , userId) ; let user = await User.findById(userId) ; let student =await Student.findById(user.student) ; From 30cd12d73874583d87376494b4fc77365dbaf93f Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Mon, 10 May 2021 15:27:31 +0530 Subject: [PATCH 08/39] PhoneAuth --- .history/.env_20210509163951 | 0 .history/.env_20210509164017 | 1 - .history/.env_20210509164034 | 3 - .history/.env_20210509164050 | 3 - .history/.env_20210509164109 | 3 - .history/.env_20210509164138 | 3 - .history/.env_20210509164140 | 3 - .history/app_20210503150708.js | 93 -------------- .history/app_20210503152356.js | 96 -------------- .history/app_20210503152948.js | 99 --------------- .history/app_20210503152953.js | 99 --------------- .history/app_20210503153001.js | 99 --------------- .history/app_20210503153018.js | 99 --------------- .history/app_20210503153622.js | 99 --------------- .history/app_20210503153812.js | 98 -------------- .history/app_20210503153844.js | 99 --------------- .history/app_20210503160225.js | 99 --------------- .history/app_20210503160253.js | 99 --------------- .history/app_20210503160401.js | 99 --------------- .history/app_20210503200710.js | 99 --------------- .history/app_20210509163930.js | 103 --------------- .history/app_20210509163946.js | 103 --------------- .history/app_20210509164233.js | 103 --------------- .history/app_20210509182548.js | 103 --------------- .history/app_20210509182557.js | 103 --------------- .history/app_20210509182624.js | 102 --------------- .history/controllers/auth_20210503150708.js | 103 --------------- .history/controllers/auth_20210509153635.js | 102 --------------- .history/controllers/auth_20210509154632.js | 130 ------------------- .history/controllers/auth_20210509155010.js | 130 ------------------- .history/controllers/auth_20210509155051.js | 130 ------------------- .history/controllers/auth_20210509155117.js | 130 ------------------- .history/controllers/auth_20210509155429.js | 130 ------------------- .history/controllers/auth_20210509155455.js | 130 ------------------- .history/controllers/auth_20210509155647.js | 130 ------------------- .history/controllers/auth_20210509155744.js | 130 ------------------- .history/controllers/auth_20210509160156.js | 130 ------------------- .history/controllers/auth_20210509161351.js | 130 ------------------- .history/controllers/auth_20210509164829.js | 130 ------------------- .history/controllers/auth_20210509165526.js | 130 ------------------- .history/controllers/auth_20210509165744.js | 134 -------------------- .history/controllers/auth_20210509165914.js | 134 -------------------- .history/models/Coupon_20210503151008.js | 0 .history/models/Coupon_20210503151143.js | 7 - .history/models/Coupon_20210503151154.js | 6 - .history/models/Coupon_20210503151227.js | 8 -- .history/models/Coupon_20210503151229.js | 8 -- .history/models/Coupon_20210503152726.js | 8 -- .history/models/Coupon_20210503153800.js | 8 -- .history/models/Coupon_20210503154746.js | 11 -- .history/models/Coupon_20210503200331.js | 16 --- .history/models/Coupon_20210503200625.js | 16 --- .history/models/User_20210503150708.js | 34 ----- .history/models/User_20210509151714.js | 37 ------ .history/models/User_20210509151719.js | 37 ------ .history/routes/Coupon_20210503151244.js | 0 .history/routes/Coupon_20210503151301.js | 5 - .history/routes/Coupon_20210503151644.js | 11 -- .history/routes/Coupon_20210503152048.js | 25 ---- .history/routes/Coupon_20210503152427.js | 27 ---- .history/routes/Coupon_20210503152622.js | 27 ---- .history/routes/Coupon_20210503152827.js | 27 ---- .history/routes/Coupon_20210503153143.js | 28 ---- .history/routes/Coupon_20210503153304.js | 28 ---- .history/routes/Coupon_20210503153306.js | 28 ---- .history/routes/Coupon_20210503153356.js | 28 ---- .history/routes/Coupon_20210503153430.js | 28 ---- .history/routes/Coupon_20210503154437.js | 33 ----- .history/routes/Coupon_20210503154828.js | 34 ----- .history/routes/Coupon_20210503155530.js | 41 ------ .history/routes/Coupon_20210503155602.js | 43 ------- .history/routes/Coupon_20210503155643.js | 43 ------- .history/routes/Coupon_20210503155753.js | 43 ------- .history/routes/Coupon_20210503155800.js | 43 ------- .history/routes/Coupon_20210503155845.js | 43 ------- .history/routes/Coupon_20210503155915.js | 43 ------- .history/routes/Coupon_20210503160010.js | 43 ------- .history/routes/Coupon_20210503160014.js | 50 -------- .history/routes/Coupon_20210503160018.js | 49 ------- .history/routes/Coupon_20210503160037.js | 48 ------- .history/routes/Coupon_20210503160039.js | 48 ------- .history/routes/Coupon_20210503160151.js | 47 ------- .history/routes/Coupon_20210503160427.js | 47 ------- .history/routes/Coupon_20210503160555.js | 47 ------- .history/routes/Coupon_20210503160634.js | 47 ------- .history/routes/Coupon_20210503160748.js | 47 ------- .history/routes/Coupon_20210503160850.js | 51 -------- .history/routes/Coupon_20210503160852.js | 50 -------- .history/routes/Coupon_20210503160913.js | 50 -------- .history/routes/Coupon_20210503160949.js | 50 -------- .history/routes/Coupon_20210503161113.js | 50 -------- .history/routes/Coupon_20210503161127.js | 50 -------- .history/routes/Coupon_20210503161157.js | 47 ------- .history/routes/Coupon_20210503161211.js | 47 ------- .history/routes/Coupon_20210503161322.js | 48 ------- .history/routes/Coupon_20210503161402.js | 48 ------- .history/routes/Coupon_20210503200453.js | 54 -------- .history/routes/Coupon_20210503200528.js | 52 -------- .history/routes/Coupon_20210503200538.js | 53 -------- .history/routes/Coupon_20210503200623.js | 53 -------- .history/routes/auth_20210503150708.js | 12 -- .history/routes/auth_20210509154824.js | 16 --- .history/routes/auth_20210509164314.js | 16 --- 103 files changed, 5987 deletions(-) delete mode 100644 .history/.env_20210509163951 delete mode 100644 .history/.env_20210509164017 delete mode 100644 .history/.env_20210509164034 delete mode 100644 .history/.env_20210509164050 delete mode 100644 .history/.env_20210509164109 delete mode 100644 .history/.env_20210509164138 delete mode 100644 .history/.env_20210509164140 delete mode 100644 .history/app_20210503150708.js delete mode 100644 .history/app_20210503152356.js delete mode 100644 .history/app_20210503152948.js delete mode 100644 .history/app_20210503152953.js delete mode 100644 .history/app_20210503153001.js delete mode 100644 .history/app_20210503153018.js delete mode 100644 .history/app_20210503153622.js delete mode 100644 .history/app_20210503153812.js delete mode 100644 .history/app_20210503153844.js delete mode 100644 .history/app_20210503160225.js delete mode 100644 .history/app_20210503160253.js delete mode 100644 .history/app_20210503160401.js delete mode 100644 .history/app_20210503200710.js delete mode 100644 .history/app_20210509163930.js delete mode 100644 .history/app_20210509163946.js delete mode 100644 .history/app_20210509164233.js delete mode 100644 .history/app_20210509182548.js delete mode 100644 .history/app_20210509182557.js delete mode 100644 .history/app_20210509182624.js delete mode 100644 .history/controllers/auth_20210503150708.js delete mode 100644 .history/controllers/auth_20210509153635.js delete mode 100644 .history/controllers/auth_20210509154632.js delete mode 100644 .history/controllers/auth_20210509155010.js delete mode 100644 .history/controllers/auth_20210509155051.js delete mode 100644 .history/controllers/auth_20210509155117.js delete mode 100644 .history/controllers/auth_20210509155429.js delete mode 100644 .history/controllers/auth_20210509155455.js delete mode 100644 .history/controllers/auth_20210509155647.js delete mode 100644 .history/controllers/auth_20210509155744.js delete mode 100644 .history/controllers/auth_20210509160156.js delete mode 100644 .history/controllers/auth_20210509161351.js delete mode 100644 .history/controllers/auth_20210509164829.js delete mode 100644 .history/controllers/auth_20210509165526.js delete mode 100644 .history/controllers/auth_20210509165744.js delete mode 100644 .history/controllers/auth_20210509165914.js delete mode 100644 .history/models/Coupon_20210503151008.js delete mode 100644 .history/models/Coupon_20210503151143.js delete mode 100644 .history/models/Coupon_20210503151154.js delete mode 100644 .history/models/Coupon_20210503151227.js delete mode 100644 .history/models/Coupon_20210503151229.js delete mode 100644 .history/models/Coupon_20210503152726.js delete mode 100644 .history/models/Coupon_20210503153800.js delete mode 100644 .history/models/Coupon_20210503154746.js delete mode 100644 .history/models/Coupon_20210503200331.js delete mode 100644 .history/models/Coupon_20210503200625.js delete mode 100644 .history/models/User_20210503150708.js delete mode 100644 .history/models/User_20210509151714.js delete mode 100644 .history/models/User_20210509151719.js delete mode 100644 .history/routes/Coupon_20210503151244.js delete mode 100644 .history/routes/Coupon_20210503151301.js delete mode 100644 .history/routes/Coupon_20210503151644.js delete mode 100644 .history/routes/Coupon_20210503152048.js delete mode 100644 .history/routes/Coupon_20210503152427.js delete mode 100644 .history/routes/Coupon_20210503152622.js delete mode 100644 .history/routes/Coupon_20210503152827.js delete mode 100644 .history/routes/Coupon_20210503153143.js delete mode 100644 .history/routes/Coupon_20210503153304.js delete mode 100644 .history/routes/Coupon_20210503153306.js delete mode 100644 .history/routes/Coupon_20210503153356.js delete mode 100644 .history/routes/Coupon_20210503153430.js delete mode 100644 .history/routes/Coupon_20210503154437.js delete mode 100644 .history/routes/Coupon_20210503154828.js delete mode 100644 .history/routes/Coupon_20210503155530.js delete mode 100644 .history/routes/Coupon_20210503155602.js delete mode 100644 .history/routes/Coupon_20210503155643.js delete mode 100644 .history/routes/Coupon_20210503155753.js delete mode 100644 .history/routes/Coupon_20210503155800.js delete mode 100644 .history/routes/Coupon_20210503155845.js delete mode 100644 .history/routes/Coupon_20210503155915.js delete mode 100644 .history/routes/Coupon_20210503160010.js delete mode 100644 .history/routes/Coupon_20210503160014.js delete mode 100644 .history/routes/Coupon_20210503160018.js delete mode 100644 .history/routes/Coupon_20210503160037.js delete mode 100644 .history/routes/Coupon_20210503160039.js delete mode 100644 .history/routes/Coupon_20210503160151.js delete mode 100644 .history/routes/Coupon_20210503160427.js delete mode 100644 .history/routes/Coupon_20210503160555.js delete mode 100644 .history/routes/Coupon_20210503160634.js delete mode 100644 .history/routes/Coupon_20210503160748.js delete mode 100644 .history/routes/Coupon_20210503160850.js delete mode 100644 .history/routes/Coupon_20210503160852.js delete mode 100644 .history/routes/Coupon_20210503160913.js delete mode 100644 .history/routes/Coupon_20210503160949.js delete mode 100644 .history/routes/Coupon_20210503161113.js delete mode 100644 .history/routes/Coupon_20210503161127.js delete mode 100644 .history/routes/Coupon_20210503161157.js delete mode 100644 .history/routes/Coupon_20210503161211.js delete mode 100644 .history/routes/Coupon_20210503161322.js delete mode 100644 .history/routes/Coupon_20210503161402.js delete mode 100644 .history/routes/Coupon_20210503200453.js delete mode 100644 .history/routes/Coupon_20210503200528.js delete mode 100644 .history/routes/Coupon_20210503200538.js delete mode 100644 .history/routes/Coupon_20210503200623.js delete mode 100644 .history/routes/auth_20210503150708.js delete mode 100644 .history/routes/auth_20210509154824.js delete mode 100644 .history/routes/auth_20210509164314.js diff --git a/.history/.env_20210509163951 b/.history/.env_20210509163951 deleted file mode 100644 index e69de29..0000000 diff --git a/.history/.env_20210509164017 b/.history/.env_20210509164017 deleted file mode 100644 index eb765ae..0000000 --- a/.history/.env_20210509164017 +++ /dev/null @@ -1 +0,0 @@ -MONGO_USER:"Cantilever" \ No newline at end of file diff --git a/.history/.env_20210509164034 b/.history/.env_20210509164034 deleted file mode 100644 index 088aa13..0000000 --- a/.history/.env_20210509164034 +++ /dev/null @@ -1,3 +0,0 @@ -"MONGO_USER":"Cantilever", - "MONGO_PASSWORD" :"Cantilever" , - "MONGO_DEFAULT_DATABASE" :"myFirstDatabase" \ No newline at end of file diff --git a/.history/.env_20210509164050 b/.history/.env_20210509164050 deleted file mode 100644 index 39086ad..0000000 --- a/.history/.env_20210509164050 +++ /dev/null @@ -1,3 +0,0 @@ -module.export={MONGO_USER:"Cantilever", - MONGO_PASSWORD :"Cantilever" , - MONGO_DEFAULT_DATABASE :"myFirstDatabase" } \ No newline at end of file diff --git a/.history/.env_20210509164109 b/.history/.env_20210509164109 deleted file mode 100644 index 39086ad..0000000 --- a/.history/.env_20210509164109 +++ /dev/null @@ -1,3 +0,0 @@ -module.export={MONGO_USER:"Cantilever", - MONGO_PASSWORD :"Cantilever" , - MONGO_DEFAULT_DATABASE :"myFirstDatabase" } \ No newline at end of file diff --git a/.history/.env_20210509164138 b/.history/.env_20210509164138 deleted file mode 100644 index 64a51f9..0000000 --- a/.history/.env_20210509164138 +++ /dev/null @@ -1,3 +0,0 @@ -MONGO_USER:Cantilever, - MONGO_PASSWORD :Cantilever , - MONGO_DEFAULT_DATABASE :myFirstDatabase \ No newline at end of file diff --git a/.history/.env_20210509164140 b/.history/.env_20210509164140 deleted file mode 100644 index 64a51f9..0000000 --- a/.history/.env_20210509164140 +++ /dev/null @@ -1,3 +0,0 @@ -MONGO_USER:Cantilever, - MONGO_PASSWORD :Cantilever , - MONGO_DEFAULT_DATABASE :myFirstDatabase \ No newline at end of file diff --git a/.history/app_20210503150708.js b/.history/app_20210503150708.js deleted file mode 100644 index ae33225..0000000 --- a/.history/app_20210503150708.js +++ /dev/null @@ -1,93 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(process.env.PORT || 5000) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503152356.js b/.history/app_20210503152356.js deleted file mode 100644 index 1c52ad8..0000000 --- a/.history/app_20210503152356.js +++ /dev/null @@ -1,96 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; -app.use(require('./models/Coupon')) -app.use(require('./routes/Coupon')) - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(process.env.PORT || 5000) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503152948.js b/.history/app_20210503152948.js deleted file mode 100644 index 8421cd5..0000000 --- a/.history/app_20210503152948.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; -app.use(require('./models/Coupon')) -app.use(require('./routes/Coupon')) - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503152953.js b/.history/app_20210503152953.js deleted file mode 100644 index d0ed53b..0000000 --- a/.history/app_20210503152953.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; -app.use(require('./models/Coupon')) -app.use(require('./routes/Coupon')) - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503153001.js b/.history/app_20210503153001.js deleted file mode 100644 index 510184e..0000000 --- a/.history/app_20210503153001.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; -app.use(require('./models/Coupon')) -app.use(require('./routes/Coupon')) - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(()=>{ - console.log("server is running on port",port); - },port) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503153018.js b/.history/app_20210503153018.js deleted file mode 100644 index 0950006..0000000 --- a/.history/app_20210503153018.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; -app.use(require('./models/Coupon')) -app.use(require('./routes/Coupon')) - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503153622.js b/.history/app_20210503153622.js deleted file mode 100644 index 2f26c3b..0000000 --- a/.history/app_20210503153622.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./models/Coupon')) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503153812.js b/.history/app_20210503153812.js deleted file mode 100644 index 7e4c371..0000000 --- a/.history/app_20210503153812.js +++ /dev/null @@ -1,98 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503153844.js b/.history/app_20210503153844.js deleted file mode 100644 index 1673a63..0000000 --- a/.history/app_20210503153844.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; -require('./models/Coupon') - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503160225.js b/.history/app_20210503160225.js deleted file mode 100644 index 5a6ac7a..0000000 --- a/.history/app_20210503160225.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; -require('./models/Coupon') - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:true}). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503160253.js b/.history/app_20210503160253.js deleted file mode 100644 index c081f70..0000000 --- a/.history/app_20210503160253.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; -require('./models/Coupon') - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:false}). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503160401.js b/.history/app_20210503160401.js deleted file mode 100644 index c081f70..0000000 --- a/.history/app_20210503160401.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; -require('./models/Coupon') - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:false}). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210503200710.js b/.history/app_20210503200710.js deleted file mode 100644 index c081f70..0000000 --- a/.history/app_20210503200710.js +++ /dev/null @@ -1,99 +0,0 @@ -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express() ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority` - -app.use(cors()) ; -app.use(bodyparser.json()) ; -require('./models/Coupon') - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require('./routes/Coupon')) -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:false}). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { - console.log(err); -}) \ No newline at end of file diff --git a/.history/app_20210509163930.js b/.history/app_20210509163930.js deleted file mode 100644 index 71a0918..0000000 --- a/.history/app_20210509163930.js +++ /dev/null @@ -1,103 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; -require("dotenv"); - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/app_20210509163946.js b/.history/app_20210509163946.js deleted file mode 100644 index 5def299..0000000 --- a/.history/app_20210509163946.js +++ /dev/null @@ -1,103 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; -require("dotenv").config(); - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/app_20210509164233.js b/.history/app_20210509164233.js deleted file mode 100644 index c8213d3..0000000 --- a/.history/app_20210509164233.js +++ /dev/null @@ -1,103 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; -require("dotenv").config(); - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/app_20210509182548.js b/.history/app_20210509182548.js deleted file mode 100644 index 5def299..0000000 --- a/.history/app_20210509182548.js +++ /dev/null @@ -1,103 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; -require("dotenv").config(); - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/app_20210509182557.js b/.history/app_20210509182557.js deleted file mode 100644 index 5def299..0000000 --- a/.history/app_20210509182557.js +++ /dev/null @@ -1,103 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; -require("dotenv").config(); - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/app_20210509182624.js b/.history/app_20210509182624.js deleted file mode 100644 index 9dec7ab..0000000 --- a/.history/app_20210509182624.js +++ /dev/null @@ -1,102 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/controllers/auth_20210503150708.js b/.history/controllers/auth_20210503150708.js deleted file mode 100644 index 645d127..0000000 --- a/.history/controllers/auth_20210503150708.js +++ /dev/null @@ -1,103 +0,0 @@ -const bcrypt = require('bcryptjs') ; -const User = require('../models/User') ; -const Student = require('../models/Student') ; -const jwt = require('jsonwebtoken'); -const JWT_secret = "Cantileverlabs"; - -module.exports.Protected = async (req,res,next)=>{ - res.send("Hello User") -} -module.exports.postSignup = async (req , res , next) => { - try - { //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " " ; - let lastName = req.body.lastName || " " ; - let email = req.body.email ; - let password = req.body.password ; - let user = await User.findOne({email:email}) ; - if(user) - { - res.json({ - message:"User already exist" , - type:"error" - }) - } - else - { - const hashedPass = await bcrypt.hash(password , 12) ; - user = new User({ - firstName : firstName , - lastName : lastName , - email : email , - password : hashedPass , - isAdmin : false - }) ; - user = await user.save() ; - await Student.deleteOne({user:user._id}) ; - let student = new Student({ - user:user._id - }) - student = await student.save() ; - user.student = student._id ; - await user.save() ; - res.json({ - message:"Successfully signed Up" , - type:"success" - }) - } - } - catch(err) - { - console.log(err); - } -} ; - - -module.exports.postSignin = async (req , res , next) => { - try - { - //we need email and password as input - let email = req.body.email ; - let password = req.body.password ; - let user = await User.findOne({email : email}) ; - if(user) - { - const isMatched = await bcrypt.compare(password , user.password) ; - if(isMatched) - { - const token = jwt.sign({_id:user._id},JWT_secret) - res.json( - { - token:token - } - ) - } - else - { - res.json({ - message:"email and password doesn't match" , - type:"error" - }) - } - } - else - { - res.json({ - message:"No user with this email exists" , - type : "error" - }) - } - } - catch(err) - { - console.log(err); - } -} - -module.exports.checkProtected = (req , res , next) => { - console.log(req.user); - res.json({ - message:"Protected" , - user : req.user - }) -} \ No newline at end of file diff --git a/.history/controllers/auth_20210509153635.js b/.history/controllers/auth_20210509153635.js deleted file mode 100644 index abe08a3..0000000 --- a/.history/controllers/auth_20210509153635.js +++ /dev/null @@ -1,102 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.phoneAuth = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - } else { - messagebird.verify.create; - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509154632.js b/.history/controllers/auth_20210509154632.js deleted file mode 100644 index c7feaaf..0000000 --- a/.history/controllers/auth_20210509154632.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155010.js b/.history/controllers/auth_20210509155010.js deleted file mode 100644 index 95eb378..0000000 --- a/.history/controllers/auth_20210509155010.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const { messagebird } = require("messagebird"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155051.js b/.history/controllers/auth_20210509155051.js deleted file mode 100644 index 95eb378..0000000 --- a/.history/controllers/auth_20210509155051.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const { messagebird } = require("messagebird"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155117.js b/.history/controllers/auth_20210509155117.js deleted file mode 100644 index bb30f83..0000000 --- a/.history/controllers/auth_20210509155117.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const { messagebird } = require("messagebird")(""); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155429.js b/.history/controllers/auth_20210509155429.js deleted file mode 100644 index 8cf5df4..0000000 --- a/.history/controllers/auth_20210509155429.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const { messagebird } = require("messagebird")(" "); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155455.js b/.history/controllers/auth_20210509155455.js deleted file mode 100644 index 8cf5df4..0000000 --- a/.history/controllers/auth_20210509155455.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const { messagebird } = require("messagebird")(" "); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155647.js b/.history/controllers/auth_20210509155647.js deleted file mode 100644 index 8b44c69..0000000 --- a/.history/controllers/auth_20210509155647.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")(" "); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code has been sent!", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509155744.js b/.history/controllers/auth_20210509155744.js deleted file mode 100644 index e0acea9..0000000 --- a/.history/controllers/auth_20210509155744.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")(" "); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509160156.js b/.history/controllers/auth_20210509160156.js deleted file mode 100644 index bdf5047..0000000 --- a/.history/controllers/auth_20210509160156.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509161351.js b/.history/controllers/auth_20210509161351.js deleted file mode 100644 index bdf5047..0000000 --- a/.history/controllers/auth_20210509161351.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - try { - const { otp, phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509164829.js b/.history/controllers/auth_20210509164829.js deleted file mode 100644 index 3e02797..0000000 --- a/.history/controllers/auth_20210509164829.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509165526.js b/.history/controllers/auth_20210509165526.js deleted file mode 100644 index cb03924..0000000 --- a/.history/controllers/auth_20210509165526.js +++ /dev/null @@ -1,130 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509165744.js b/.history/controllers/auth_20210509165744.js deleted file mode 100644 index 812d0a7..0000000 --- a/.history/controllers/auth_20210509165744.js +++ /dev/null @@ -1,134 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("uNNYosMopvvCW9RTR1tRWJmYC"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509165914.js b/.history/controllers/auth_20210509165914.js deleted file mode 100644 index d9b71a4..0000000 --- a/.history/controllers/auth_20210509165914.js +++ /dev/null @@ -1,134 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/models/Coupon_20210503151008.js b/.history/models/Coupon_20210503151008.js deleted file mode 100644 index e69de29..0000000 diff --git a/.history/models/Coupon_20210503151143.js b/.history/models/Coupon_20210503151143.js deleted file mode 100644 index 9b0b365..0000000 --- a/.history/models/Coupon_20210503151143.js +++ /dev/null @@ -1,7 +0,0 @@ -const mongoose=require('mongoose') -const coupon=mongoose.Schema({ - coupon:{ - type:String, - required:true - } -}) diff --git a/.history/models/Coupon_20210503151154.js b/.history/models/Coupon_20210503151154.js deleted file mode 100644 index e2d580b..0000000 --- a/.history/models/Coupon_20210503151154.js +++ /dev/null @@ -1,6 +0,0 @@ -const mongoose=require('mongoose') -const coupon=mongoose.Schema({ - coupon:{ - type:String - } -}) diff --git a/.history/models/Coupon_20210503151227.js b/.history/models/Coupon_20210503151227.js deleted file mode 100644 index 2efa4c6..0000000 --- a/.history/models/Coupon_20210503151227.js +++ /dev/null @@ -1,8 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=mongoose.Schema({ - coupon:{ - type:String - } -}) - -module.exports=mongoose.model('Coupon',CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503151229.js b/.history/models/Coupon_20210503151229.js deleted file mode 100644 index 2efa4c6..0000000 --- a/.history/models/Coupon_20210503151229.js +++ /dev/null @@ -1,8 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=mongoose.Schema({ - coupon:{ - type:String - } -}) - -module.exports=mongoose.model('Coupon',CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503152726.js b/.history/models/Coupon_20210503152726.js deleted file mode 100644 index 5a0c169..0000000 --- a/.history/models/Coupon_20210503152726.js +++ /dev/null @@ -1,8 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=new mongoose.Schema({ - coupon:{ - type:String - } -}) - -module.exports=mongoose.model('Coupon',CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503153800.js b/.history/models/Coupon_20210503153800.js deleted file mode 100644 index 6aa1d0e..0000000 --- a/.history/models/Coupon_20210503153800.js +++ /dev/null @@ -1,8 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=new mongoose.Schema({ - coupon:{ - type:String - } -}) - -module.exports=mongoose.model("Coupon",CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503154746.js b/.history/models/Coupon_20210503154746.js deleted file mode 100644 index e69ad70..0000000 --- a/.history/models/Coupon_20210503154746.js +++ /dev/null @@ -1,11 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=new mongoose.Schema({ - coupon_code:{ - type:String - }, - percentage:{ - type:String - } -}) - -module.exports=mongoose.model("Coupon",CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503200331.js b/.history/models/Coupon_20210503200331.js deleted file mode 100644 index a68a548..0000000 --- a/.history/models/Coupon_20210503200331.js +++ /dev/null @@ -1,16 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=new mongoose.Schema({ - coupon_code:{ - type:String, - required:true - }, - percentage:{ - type:String, - required:true - }, - remainingTimes:{ - type:Number - } -}) - -module.exports=mongoose.model("Coupon",CouponSchema) \ No newline at end of file diff --git a/.history/models/Coupon_20210503200625.js b/.history/models/Coupon_20210503200625.js deleted file mode 100644 index a68a548..0000000 --- a/.history/models/Coupon_20210503200625.js +++ /dev/null @@ -1,16 +0,0 @@ -const mongoose=require('mongoose') -const CouponSchema=new mongoose.Schema({ - coupon_code:{ - type:String, - required:true - }, - percentage:{ - type:String, - required:true - }, - remainingTimes:{ - type:Number - } -}) - -module.exports=mongoose.model("Coupon",CouponSchema) \ No newline at end of file diff --git a/.history/models/User_20210503150708.js b/.history/models/User_20210503150708.js deleted file mode 100644 index 205349f..0000000 --- a/.history/models/User_20210503150708.js +++ /dev/null @@ -1,34 +0,0 @@ -const mongoose = require('mongoose') ; - -const Schema = mongoose.Schema ; - -const userSchema = new Schema({ - firstName : { - type :String , - required : true - } , - lastName : { - type:String , - required: true - } , - email : { - type:String , - required: true - } , - password : { - type : String - } , - googleId : { - type : String - } , - student : { - type : mongoose.Types.ObjectId , - ref: 'Student' - } , - isAdmin : { - type : Boolean - } - //need to add isAdmin -}) ; - -module.exports = mongoose.model("User" , userSchema) ; \ No newline at end of file diff --git a/.history/models/User_20210509151714.js b/.history/models/User_20210509151714.js deleted file mode 100644 index 434b290..0000000 --- a/.history/models/User_20210509151714.js +++ /dev/null @@ -1,37 +0,0 @@ -const mongoose = require("mongoose"); - -const Schema = mongoose.Schema; - -const userSchema = new Schema({ - firstName: { - type: String, - required: true, - }, - lastName: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - password: { - type: String, - }, - googleId: { - type: String, - }, - student: { - type: mongoose.Types.ObjectId, - ref: "Student", - }, - isAdmin: { - type: Boolean, - }, - otp: { - type: String, - }, - //need to add isAdmin -}); - -module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210509151719.js b/.history/models/User_20210509151719.js deleted file mode 100644 index 434b290..0000000 --- a/.history/models/User_20210509151719.js +++ /dev/null @@ -1,37 +0,0 @@ -const mongoose = require("mongoose"); - -const Schema = mongoose.Schema; - -const userSchema = new Schema({ - firstName: { - type: String, - required: true, - }, - lastName: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - password: { - type: String, - }, - googleId: { - type: String, - }, - student: { - type: mongoose.Types.ObjectId, - ref: "Student", - }, - isAdmin: { - type: Boolean, - }, - otp: { - type: String, - }, - //need to add isAdmin -}); - -module.exports = mongoose.model("User", userSchema); diff --git a/.history/routes/Coupon_20210503151244.js b/.history/routes/Coupon_20210503151244.js deleted file mode 100644 index e69de29..0000000 diff --git a/.history/routes/Coupon_20210503151301.js b/.history/routes/Coupon_20210503151301.js deleted file mode 100644 index ab6990b..0000000 --- a/.history/routes/Coupon_20210503151301.js +++ /dev/null @@ -1,5 +0,0 @@ -const express = require('express') ; -const authController = require('../controllers/auth') ; -const isAuth = require('../middleware/requirelogin') ; -const router = express.Router() ; - diff --git a/.history/routes/Coupon_20210503151644.js b/.history/routes/Coupon_20210503151644.js deleted file mode 100644 index a987d87..0000000 --- a/.history/routes/Coupon_20210503151644.js +++ /dev/null @@ -1,11 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const coupon=require('../models/Coupon'); - -router.get('/',(req,res)=>{ - coupon.find() - .then(res=>{ - res.status(200).json({coupon:res}) - }) -}) \ No newline at end of file diff --git a/.history/routes/Coupon_20210503152048.js b/.history/routes/Coupon_20210503152048.js deleted file mode 100644 index c8911fa..0000000 --- a/.history/routes/Coupon_20210503152048.js +++ /dev/null @@ -1,25 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - coupon.find() - .then(res=>{ - res.status(200).json({coupon:res}) - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - res=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) \ No newline at end of file diff --git a/.history/routes/Coupon_20210503152427.js b/.history/routes/Coupon_20210503152427.js deleted file mode 100644 index df96b10..0000000 --- a/.history/routes/Coupon_20210503152427.js +++ /dev/null @@ -1,27 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - coupon.find() - .then(res=>{ - res.status(200).json({coupon:res}) - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - res=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503152622.js b/.history/routes/Coupon_20210503152622.js deleted file mode 100644 index d084e4e..0000000 --- a/.history/routes/Coupon_20210503152622.js +++ /dev/null @@ -1,27 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - coupon.find() - .then(res=>{ - res.status(200).json({coupon:res}) - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503152827.js b/.history/routes/Coupon_20210503152827.js deleted file mode 100644 index 72f252b..0000000 --- a/.history/routes/Coupon_20210503152827.js +++ /dev/null @@ -1,27 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503153143.js b/.history/routes/Coupon_20210503153143.js deleted file mode 100644 index 5a33aec..0000000 --- a/.history/routes/Coupon_20210503153143.js +++ /dev/null @@ -1,28 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503153304.js b/.history/routes/Coupon_20210503153304.js deleted file mode 100644 index 30dcd9e..0000000 --- a/.history/routes/Coupon_20210503153304.js +++ /dev/null @@ -1,28 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503153306.js b/.history/routes/Coupon_20210503153306.js deleted file mode 100644 index 30dcd9e..0000000 --- a/.history/routes/Coupon_20210503153306.js +++ /dev/null @@ -1,28 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = require('../models/Coupon'); - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503153356.js b/.history/routes/Coupon_20210503153356.js deleted file mode 100644 index b93052a..0000000 --- a/.history/routes/Coupon_20210503153356.js +++ /dev/null @@ -1,28 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503153430.js b/.history/routes/Coupon_20210503153430.js deleted file mode 100644 index b93052a..0000000 --- a/.history/routes/Coupon_20210503153430.js +++ /dev/null @@ -1,28 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) - - -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503154437.js b/.history/routes/Coupon_20210503154437.js deleted file mode 100644 index ce7371d..0000000 --- a/.history/routes/Coupon_20210503154437.js +++ /dev/null @@ -1,33 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {discount}=req.body; - const coupon=new Coupon({ - coupon:discount - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503154828.js b/.history/routes/Coupon_20210503154828.js deleted file mode 100644 index 4434613..0000000 --- a/.history/routes/Coupon_20210503154828.js +++ /dev/null @@ -1,34 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155530.js b/.history/routes/Coupon_20210503155530.js deleted file mode 100644 index c794196..0000000 --- a/.history/routes/Coupon_20210503155530.js +++ /dev/null @@ -1,41 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate({_id:req.body.id},{$push:{coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:"Coupon Updated"}) - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155602.js b/.history/routes/Coupon_20210503155602.js deleted file mode 100644 index 690aad5..0000000 --- a/.history/routes/Coupon_20210503155602.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate({_id:req.body.id},{$push:{coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:"Coupon Updated"}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155643.js b/.history/routes/Coupon_20210503155643.js deleted file mode 100644 index b57ad04..0000000 --- a/.history/routes/Coupon_20210503155643.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate({_id:req.body.id},{$push:{percentage:req.body.percentage,coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:"Coupon Updated"}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155753.js b/.history/routes/Coupon_20210503155753.js deleted file mode 100644 index 1ed31b8..0000000 --- a/.history/routes/Coupon_20210503155753.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate(_id:req.body.id,{$push:{percentage:req.body.percentage,coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:"Coupon Updated"}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155800.js b/.history/routes/Coupon_20210503155800.js deleted file mode 100644 index 1ed31b8..0000000 --- a/.history/routes/Coupon_20210503155800.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate(_id:req.body.id,{$push:{percentage:req.body.percentage,coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:"Coupon Updated"}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155845.js b/.history/routes/Coupon_20210503155845.js deleted file mode 100644 index b5c9c47..0000000 --- a/.history/routes/Coupon_20210503155845.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate(req.body._id,{$set:{percentage:req.body.percentage,coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:"Coupon Updated"}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503155915.js b/.history/routes/Coupon_20210503155915.js deleted file mode 100644 index 65d5e6d..0000000 --- a/.history/routes/Coupon_20210503155915.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate(req.body._id,{$set:{percentage:req.body.percentage,coupon_code:req.body.coupon_code}}) - .then((result)=>{ - res.status(200).json({message:result}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503160010.js b/.history/routes/Coupon_20210503160010.js deleted file mode 100644 index 2af6cdf..0000000 --- a/.history/routes/Coupon_20210503160010.js +++ /dev/null @@ -1,43 +0,0 @@ -const express = require('express') ; -const router = express.Router() ; -const mongoose=require('mongoose'); -const Coupon = mongoose.model('Coupon') - -router.get('/get-coupon',(req,res)=>{ - Coupon.find() - .then(result=>{ - res.status(200).json({coupon:result}) - console.log(result); - }) -}) - -router.post('/set-coupon',(req,res)=>{ - const {percentage,coupon_code}=req.body; - const coupon=new Coupon({ - coupon_code, - percentage - }); - coupon.save().then( - result=>{ - res.status(200).json({message:"Coupon set Successfully"}) - } - ) -}) - -router.delete('/delete-coupon',(req,res)=>{ - Coupon.remove({_id:req.body.id}) - .then((result)=>{ - res.status(200).json({message:"Coupon Deleted"}) - }) -}) - -router.put("/update-coupon",(req,res)=>{ - Coupon.findByIdAndUpdate(req.body._id,{$set:{percentage:req.body.percentage,coupon_code:req.body.coupon_code}},{new:true}) - .then((result)=>{ - res.status(200).json({message:result}) - }).catch(err=>{ - console.log(err); - }) -}) - -module.exports=router \ No newline at end of file diff --git a/.history/routes/Coupon_20210503160014.js b/.history/routes/Coupon_20210503160014.js deleted file mode 100644 index 4c21c39..0000000 --- a/.history/routes/Coupon_20210503160014.js +++ /dev/null @@ -1,50 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - - { - $set: { - percentage: req.body.percentage, - coupon_code: req.body.coupon_code, - }, - }, - { new: true } - ) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160018.js b/.history/routes/Coupon_20210503160018.js deleted file mode 100644 index cb3110f..0000000 --- a/.history/routes/Coupon_20210503160018.js +++ /dev/null @@ -1,49 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - percentage: req.body.percentage, - coupon_code: req.body.coupon_code, - }, - }, - { new: true } - ) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160037.js b/.history/routes/Coupon_20210503160037.js deleted file mode 100644 index 3f41149..0000000 --- a/.history/routes/Coupon_20210503160037.js +++ /dev/null @@ -1,48 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code, - }, - }, - { new: true } - ) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160039.js b/.history/routes/Coupon_20210503160039.js deleted file mode 100644 index 8a53f22..0000000 --- a/.history/routes/Coupon_20210503160039.js +++ /dev/null @@ -1,48 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - }, - }, - { new: true } - ) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160151.js b/.history/routes/Coupon_20210503160151.js deleted file mode 100644 index bed7eac..0000000 --- a/.history/routes/Coupon_20210503160151.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - }, - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160427.js b/.history/routes/Coupon_20210503160427.js deleted file mode 100644 index 317ccc8..0000000 --- a/.history/routes/Coupon_20210503160427.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - {_id:req.body._id}, - { - $set: { - coupon_code: req.body.coupon_code - }, - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160555.js b/.history/routes/Coupon_20210503160555.js deleted file mode 100644 index 527ec89..0000000 --- a/.history/routes/Coupon_20210503160555.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - {_id:req.body._id}, - { - $set: { - coupon_code: req.body.coupon_code - }, - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: req.body.coupon_code }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160634.js b/.history/routes/Coupon_20210503160634.js deleted file mode 100644 index 317ccc8..0000000 --- a/.history/routes/Coupon_20210503160634.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - {_id:req.body._id}, - { - $set: { - coupon_code: req.body.coupon_code - }, - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160748.js b/.history/routes/Coupon_20210503160748.js deleted file mode 100644 index 45f4363..0000000 --- a/.history/routes/Coupon_20210503160748.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160850.js b/.history/routes/Coupon_20210503160850.js deleted file mode 100644 index 32442f3..0000000 --- a/.history/routes/Coupon_20210503160850.js +++ /dev/null @@ -1,51 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true },(err,result)=>{ - if(err){ - return res.status(422).json({error:err}) - }else{ - return res.status(200).json({ message: result }); - } - - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160852.js b/.history/routes/Coupon_20210503160852.js deleted file mode 100644 index 953dbcc..0000000 --- a/.history/routes/Coupon_20210503160852.js +++ /dev/null @@ -1,50 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true },(err,result)=>{ - if(err){ - return res.status(422).json({error:err}) - }else{ - return res.status(200).json({ message: result }); - } - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160913.js b/.history/routes/Coupon_20210503160913.js deleted file mode 100644 index 58a684a..0000000 --- a/.history/routes/Coupon_20210503160913.js +++ /dev/null @@ -1,50 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $push: { - coupon_code: req.body.coupon_code - } - }, - { new: true },(err,result)=>{ - if(err){ - return res.status(422).json({error:err}) - }else{ - return res.status(200).json({ message: result }); - } - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503160949.js b/.history/routes/Coupon_20210503160949.js deleted file mode 100644 index 953dbcc..0000000 --- a/.history/routes/Coupon_20210503160949.js +++ /dev/null @@ -1,50 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true },(err,result)=>{ - if(err){ - return res.status(422).json({error:err}) - }else{ - return res.status(200).json({ message: result }); - } - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503161113.js b/.history/routes/Coupon_20210503161113.js deleted file mode 100644 index 42a9321..0000000 --- a/.history/routes/Coupon_20210503161113.js +++ /dev/null @@ -1,50 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findOneAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true },(err,result)=>{ - if(err){ - return res.status(422).json({error:err}) - }else{ - return res.status(200).json({ message: result }); - } - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503161127.js b/.history/routes/Coupon_20210503161127.js deleted file mode 100644 index 953dbcc..0000000 --- a/.history/routes/Coupon_20210503161127.js +++ /dev/null @@ -1,50 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true },(err,result)=>{ - if(err){ - return res.status(422).json({error:err}) - }else{ - return res.status(200).json({ message: result }); - } - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503161157.js b/.history/routes/Coupon_20210503161157.js deleted file mode 100644 index 45f4363..0000000 --- a/.history/routes/Coupon_20210503161157.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503161211.js b/.history/routes/Coupon_20210503161211.js deleted file mode 100644 index 45f4363..0000000 --- a/.history/routes/Coupon_20210503161211.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code: req.body.coupon_code - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503161322.js b/.history/routes/Coupon_20210503161322.js deleted file mode 100644 index 7813150..0000000 --- a/.history/routes/Coupon_20210503161322.js +++ /dev/null @@ -1,48 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - const {coupon_code,percentage} =req.body; - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code,percentage - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503161402.js b/.history/routes/Coupon_20210503161402.js deleted file mode 100644 index 7813150..0000000 --- a/.history/routes/Coupon_20210503161402.js +++ /dev/null @@ -1,48 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code } = req.body; - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - const {coupon_code,percentage} =req.body; - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code,percentage - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503200453.js b/.history/routes/Coupon_20210503200453.js deleted file mode 100644 index 82be28f..0000000 --- a/.history/routes/Coupon_20210503200453.js +++ /dev/null @@ -1,54 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code ,remainingTimes} = req.body; - if(!coupon_code || !percentage || !remainingTimes){ - return res.status(422).json({error:"Add all fields"}) - }else{ - const coupon = new Coupon({ - coupon_code, - percentage, - remainingTimes - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); -}); - } - - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - const {coupon_code,percentage} =req.body; - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code,percentage - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503200528.js b/.history/routes/Coupon_20210503200528.js deleted file mode 100644 index 7cccf4b..0000000 --- a/.history/routes/Coupon_20210503200528.js +++ /dev/null @@ -1,52 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code ,remainingTimes} = req.body; - if(!coupon_code || !percentage || !remainingTimes){ - return res.status(422).json({error:"Add all fields"}) - }else{ - const coupon = new Coupon({ - coupon_code, - percentage, - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); - } -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - const {coupon_code,percentage} =req.body; - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code,percentage - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503200538.js b/.history/routes/Coupon_20210503200538.js deleted file mode 100644 index 36980c3..0000000 --- a/.history/routes/Coupon_20210503200538.js +++ /dev/null @@ -1,53 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code ,remainingTimes} = req.body; - if(!coupon_code || !percentage || !remainingTimes){ - return res.status(422).json({error:"Add all fields"}) - }else{ - const coupon = new Coupon({ - coupon_code, - percentage, - remainingTimes - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); - } -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - const {coupon_code,percentage} =req.body; - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code,percentage - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/Coupon_20210503200623.js b/.history/routes/Coupon_20210503200623.js deleted file mode 100644 index 36980c3..0000000 --- a/.history/routes/Coupon_20210503200623.js +++ /dev/null @@ -1,53 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const mongoose = require("mongoose"); -const Coupon = mongoose.model("Coupon"); - -router.get("/get-coupon", (req, res) => { - Coupon.find().then((result) => { - res.status(200).json({ coupon: result }); - console.log(result); - }); -}); - -router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code ,remainingTimes} = req.body; - if(!coupon_code || !percentage || !remainingTimes){ - return res.status(422).json({error:"Add all fields"}) - }else{ - const coupon = new Coupon({ - coupon_code, - percentage, - remainingTimes - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); - } -}); - -router.delete("/delete-coupon", (req, res) => { - Coupon.remove({ _id: req.body.id }).then((result) => { - res.status(200).json({ message: "Coupon Deleted" }); - }); -}); - -router.put("/update-coupon", (req, res) => { - const {coupon_code,percentage} =req.body; - Coupon.findByIdAndUpdate( - req.body._id, - { - $set: { - coupon_code,percentage - } - }, - { new: true }) - .then((result) => { - res.status(200).json({ message: result }); - }) - .catch((err) => { - console.log(err); - }); -}); - -module.exports = router; diff --git a/.history/routes/auth_20210503150708.js b/.history/routes/auth_20210503150708.js deleted file mode 100644 index 0eeb700..0000000 --- a/.history/routes/auth_20210503150708.js +++ /dev/null @@ -1,12 +0,0 @@ -const express = require('express') ; -const authController = require('../controllers/auth') ; -const isAuth = require('../middleware/requirelogin') ; -const router = express.Router() ; - -router.get('/protected' ,isAuth,authController.checkProtected) ; - -router.post('/signup' , authController.postSignup) ; - -router.post('/signin' , authController.postSignin) ; - -module.exports = router ; \ No newline at end of file diff --git a/.history/routes/auth_20210509154824.js b/.history/routes/auth_20210509154824.js deleted file mode 100644 index 59ba658..0000000 --- a/.history/routes/auth_20210509154824.js +++ /dev/null @@ -1,16 +0,0 @@ -const express = require("express"); -const authController = require("../controllers/auth"); -const isAuth = require("../middleware/requirelogin"); -const router = express.Router(); - -router.get("/protected", isAuth, authController.checkProtected); - -router.post("/signup", authController.postSignup); - -router.post("/signin", authController.postSignin); - -router.post("/sendotp", authController.sendOTP); - -router.get("/getotp", authController.getOTP); - -module.exports = router; diff --git a/.history/routes/auth_20210509164314.js b/.history/routes/auth_20210509164314.js deleted file mode 100644 index 6c04fe6..0000000 --- a/.history/routes/auth_20210509164314.js +++ /dev/null @@ -1,16 +0,0 @@ -const express = require("express"); -const authController = require("../controllers/auth"); -const isAuth = require("../middleware/requirelogin"); -const router = express.Router(); - -router.get("/protected", isAuth, authController.checkProtected); - -router.post("/signup", authController.postSignup); - -router.post("/signin", authController.postSignin); - -router.post("/sendotp", authController.sendOTP); - -router.post("/getotp", authController.getOTP); - -module.exports = router; From 7c66f436ae2201ba81880b8735649d55e1b14f54 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Tue, 11 May 2021 19:48:54 +0530 Subject: [PATCH 09/39] Added forgot password --- .history/app_20210509182623.js | 102 +++++++++++ .history/app_20210511125853.js | 102 +++++++++++ .history/controllers/auth_20210509165913.js | 134 ++++++++++++++ .history/controllers/auth_20210511124920.js | 144 +++++++++++++++ .history/controllers/auth_20210511125553.js | 147 +++++++++++++++ .history/controllers/auth_20210511130304.js | 147 +++++++++++++++ .history/controllers/auth_20210511130652.js | 148 +++++++++++++++ .history/controllers/auth_20210511130704.js | 148 +++++++++++++++ .history/controllers/auth_20210511130706.js | 148 +++++++++++++++ .history/controllers/auth_20210511130738.js | 148 +++++++++++++++ .history/controllers/auth_20210511130806.js | 148 +++++++++++++++ .history/controllers/auth_20210511130823.js | 148 +++++++++++++++ .history/controllers/auth_20210511153608.js | 154 ++++++++++++++++ .history/controllers/auth_20210511153626.js | 154 ++++++++++++++++ .history/controllers/auth_20210511172833.js | 179 +++++++++++++++++++ .history/controllers/auth_20210511172847.js | 179 +++++++++++++++++++ .history/controllers/auth_20210511173119.js | 179 +++++++++++++++++++ .history/controllers/auth_20210511173233.js | 181 +++++++++++++++++++ .history/controllers/auth_20210511193324.js | 186 +++++++++++++++++++ .history/controllers/auth_20210511193420.js | 186 +++++++++++++++++++ .history/controllers/auth_20210511193801.js | 188 ++++++++++++++++++++ .history/models/User_20210509151718.js | 37 ++++ .history/models/User_20210511124914.js | 44 +++++ .history/models/User_20210511125400.js | 51 ++++++ .history/models/User_20210511132742.js | 39 ++++ .history/routes/auth_20210509164313.js | 16 ++ .history/routes/auth_20210511125551.js | 20 +++ .history/routes/auth_20210511171625.js | 20 +++ .history/routes/auth_20210511171726.js | 20 +++ .history/utils/emailSend_20210511130922.js | 0 .history/utils/emailSend_20210511130932.js | 1 + app.js | 2 +- controllers/auth.js | 54 ++++++ models/User.js | 4 +- package-lock.json | 14 ++ package.json | 1 + routes/auth.js | 4 + 37 files changed, 3575 insertions(+), 2 deletions(-) create mode 100644 .history/app_20210509182623.js create mode 100644 .history/app_20210511125853.js create mode 100644 .history/controllers/auth_20210509165913.js create mode 100644 .history/controllers/auth_20210511124920.js create mode 100644 .history/controllers/auth_20210511125553.js create mode 100644 .history/controllers/auth_20210511130304.js create mode 100644 .history/controllers/auth_20210511130652.js create mode 100644 .history/controllers/auth_20210511130704.js create mode 100644 .history/controllers/auth_20210511130706.js create mode 100644 .history/controllers/auth_20210511130738.js create mode 100644 .history/controllers/auth_20210511130806.js create mode 100644 .history/controllers/auth_20210511130823.js create mode 100644 .history/controllers/auth_20210511153608.js create mode 100644 .history/controllers/auth_20210511153626.js create mode 100644 .history/controllers/auth_20210511172833.js create mode 100644 .history/controllers/auth_20210511172847.js create mode 100644 .history/controllers/auth_20210511173119.js create mode 100644 .history/controllers/auth_20210511173233.js create mode 100644 .history/controllers/auth_20210511193324.js create mode 100644 .history/controllers/auth_20210511193420.js create mode 100644 .history/controllers/auth_20210511193801.js create mode 100644 .history/models/User_20210509151718.js create mode 100644 .history/models/User_20210511124914.js create mode 100644 .history/models/User_20210511125400.js create mode 100644 .history/models/User_20210511132742.js create mode 100644 .history/routes/auth_20210509164313.js create mode 100644 .history/routes/auth_20210511125551.js create mode 100644 .history/routes/auth_20210511171625.js create mode 100644 .history/routes/auth_20210511171726.js create mode 100644 .history/utils/emailSend_20210511130922.js create mode 100644 .history/utils/emailSend_20210511130932.js diff --git a/.history/app_20210509182623.js b/.history/app_20210509182623.js new file mode 100644 index 0000000..9dec7ab --- /dev/null +++ b/.history/app_20210509182623.js @@ -0,0 +1,102 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/app_20210511125853.js b/.history/app_20210511125853.js new file mode 100644 index 0000000..c3b4e48 --- /dev/null +++ b/.history/app_20210511125853.js @@ -0,0 +1,102 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; + +const cors = require("cors"); +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +app.use(require("./routes/Coupon")); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); diff --git a/.history/controllers/auth_20210509165913.js b/.history/controllers/auth_20210509165913.js new file mode 100644 index 0000000..d9b71a4 --- /dev/null +++ b/.history/controllers/auth_20210509165913.js @@ -0,0 +1,134 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511124920.js b/.history/controllers/auth_20210511124920.js new file mode 100644 index 0000000..f14256a --- /dev/null +++ b/.history/controllers/auth_20210511124920.js @@ -0,0 +1,144 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await user.findOne({ email }); + //verify email then set password. + if (!user) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511125553.js b/.history/controllers/auth_20210511125553.js new file mode 100644 index 0000000..c606687 --- /dev/null +++ b/.history/controllers/auth_20210511125553.js @@ -0,0 +1,147 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await user.findOne({ email }); + //verify email then set password. + if (!user) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + const resetToken = user.createPasswordResetToken(); + await user.save(); + } +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130304.js b/.history/controllers/auth_20210511130304.js new file mode 100644 index 0000000..52ad595 --- /dev/null +++ b/.history/controllers/auth_20210511130304.js @@ -0,0 +1,147 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await user.findOne({ email }); + //verify email then set password. + if (!user) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + // const resetToken = user.createPasswordResetToken(); + // await user.save(); + } +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130652.js b/.history/controllers/auth_20210511130652.js new file mode 100644 index 0000000..89683fa --- /dev/null +++ b/.history/controllers/auth_20210511130652.js @@ -0,0 +1,148 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await user.findOne({ email }).then((result) => { + if (!result) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + const resetToken = user.createPasswordResetToken(); + await user.save(); + } + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130704.js b/.history/controllers/auth_20210511130704.js new file mode 100644 index 0000000..0c75d23 --- /dev/null +++ b/.history/controllers/auth_20210511130704.js @@ -0,0 +1,148 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await user.findOne({ email }).then((result) => { + if (!result) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + const resetToken = user.createPasswordResetToken(); + user.save(); + } + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130706.js b/.history/controllers/auth_20210511130706.js new file mode 100644 index 0000000..09c28ea --- /dev/null +++ b/.history/controllers/auth_20210511130706.js @@ -0,0 +1,148 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await user.findOne({ email }).then((result) => { + if (!result) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + // const resetToken = user.createPasswordResetToken(); + // user.save(); + } + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130738.js b/.history/controllers/auth_20210511130738.js new file mode 100644 index 0000000..7f4fa1d --- /dev/null +++ b/.history/controllers/auth_20210511130738.js @@ -0,0 +1,148 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await User.findOne({ email }).then((result) => { + if (!result) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + // const resetToken = user.createPasswordResetToken(); + // user.save(); + } + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130806.js b/.history/controllers/auth_20210511130806.js new file mode 100644 index 0000000..728a15d --- /dev/null +++ b/.history/controllers/auth_20210511130806.js @@ -0,0 +1,148 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await User.findOne({ email }).then((result) => { + if (!result) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + const resetToken = user.createPasswordResetToken(); + user.save(); + } + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511130823.js b/.history/controllers/auth_20210511130823.js new file mode 100644 index 0000000..7f4fa1d --- /dev/null +++ b/.history/controllers/auth_20210511130823.js @@ -0,0 +1,148 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + const user = await User.findOne({ email }).then((result) => { + if (!result) { + return res.status(404).json({ error: "No user with that Email id" }); + } else { + // const resetToken = user.createPasswordResetToken(); + // user.save(); + } + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511153608.js b/.history/controllers/auth_20210511153608.js new file mode 100644 index 0000000..fc612e9 --- /dev/null +++ b/.history/controllers/auth_20210511153608.js @@ -0,0 +1,154 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + crypto.randomBytes(32, (err, buffer) => { + if (err) { + console.log("error in crypto"); + } + const token = buffer.toString("hex"); + User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this email." }); + } + user.passwordResetToken = token; //generated token; + user.passwordResetExpires = Date.now() + 10 * 6 * 1000; //valid for 10 mins. + user.save().then((res) => {}); + }); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511153626.js b/.history/controllers/auth_20210511153626.js new file mode 100644 index 0000000..9edae01 --- /dev/null +++ b/.history/controllers/auth_20210511153626.js @@ -0,0 +1,154 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email } = req.body; + crypto.randomBytes(32, (err, buffer) => { + if (err) { + console.log("error in crypto"); + } + const token = buffer.toString("hex"); + User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this email." }); + } + user.passwordResetToken = token; //generated token; + user.passwordResetExpires = Date.now() + 10 * 6 * 1000; //valid for 10 mins. + user.save().then((res) => {}); //need to do the task. + }); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => {}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511172833.js b/.history/controllers/auth_20210511172833.js new file mode 100644 index 0000000..ed79012 --- /dev/null +++ b/.history/controllers/auth_20210511172833.js @@ -0,0 +1,179 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const reset_link = `${link}/${result._id}/${token}`; + res.status(200).json({ reset_link }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const payload = jwt.verify(token, secret); + if (payload) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511172847.js b/.history/controllers/auth_20210511172847.js new file mode 100644 index 0000000..6847cb1 --- /dev/null +++ b/.history/controllers/auth_20210511172847.js @@ -0,0 +1,179 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const reset_link = `${link}/${result._id}/${token}`; + res.status(200).json({ reset_link }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const payload = jwt.verify(token, secret); + if (payload) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511173119.js b/.history/controllers/auth_20210511173119.js new file mode 100644 index 0000000..fef654c --- /dev/null +++ b/.history/controllers/auth_20210511173119.js @@ -0,0 +1,179 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const reset_link = `${link}/${result._id}/${token}`; + res.status(200).json({ reset_link }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const payload = jwt.verify(token, secret); + if (payload) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511173233.js b/.history/controllers/auth_20210511173233.js new file mode 100644 index 0000000..434735d --- /dev/null +++ b/.history/controllers/auth_20210511173233.js @@ -0,0 +1,181 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const payload = jwt.verify(token, secret); + if (payload) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511193324.js b/.history/controllers/auth_20210511193324.js new file mode 100644 index 0000000..624a403 --- /dev/null +++ b/.history/controllers/auth_20210511193324.js @@ -0,0 +1,186 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const user_token=new User({ + passwordResetToken=token + }); + user_token.save(); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const user_token=User.findOne({passwordResetToken:result.passwordResetToken}); + const payload = jwt.verify(token, secret); + if (token==user_token) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511193420.js b/.history/controllers/auth_20210511193420.js new file mode 100644 index 0000000..624a403 --- /dev/null +++ b/.history/controllers/auth_20210511193420.js @@ -0,0 +1,186 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const user_token=new User({ + passwordResetToken=token + }); + user_token.save(); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const user_token=User.findOne({passwordResetToken:result.passwordResetToken}); + const payload = jwt.verify(token, secret); + if (token==user_token) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210511193801.js b/.history/controllers/auth_20210511193801.js new file mode 100644 index 0000000..edae889 --- /dev/null +++ b/.history/controllers/auth_20210511193801.js @@ -0,0 +1,188 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const user_token = new User({ + passwordResetToken: token, + }); + user_token.save(); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const user_token = User.findOne({ + passwordResetToken: result.passwordResetToken, + }); + const payload = jwt.verify(token, secret); + if (token == user_token) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/models/User_20210509151718.js b/.history/models/User_20210509151718.js new file mode 100644 index 0000000..434b290 --- /dev/null +++ b/.history/models/User_20210509151718.js @@ -0,0 +1,37 @@ +const mongoose = require("mongoose"); + +const Schema = mongoose.Schema; + +const userSchema = new Schema({ + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + //need to add isAdmin +}); + +module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210511124914.js b/.history/models/User_20210511124914.js new file mode 100644 index 0000000..7c368cd --- /dev/null +++ b/.history/models/User_20210511124914.js @@ -0,0 +1,44 @@ +const mongoose = require("mongoose"); +const crypto = require("crypto"); +const Schema = mongoose.Schema; + +const userSchema = new Schema({ + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + passwordResetToken: String, + passwordResetExpires: Date, + //need to add isAdmin +}); + +userSchema.methods.createPasswordResetToken = function () { + const resetToken = crypto.randomBytes(32).toString("hex"); + crypto.createHash("sha256").update(resetToken).digest("hex"); +}; + +module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210511125400.js b/.history/models/User_20210511125400.js new file mode 100644 index 0000000..8f499eb --- /dev/null +++ b/.history/models/User_20210511125400.js @@ -0,0 +1,51 @@ +const mongoose = require("mongoose"); +const crypto = require("crypto"); +const Schema = mongoose.Schema; + +const userSchema = new Schema({ + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + passwordResetToken: String, + passwordResetExpires: Date, + //need to add isAdmin +}); + +userSchema.methods.createPasswordResetToken = function () { + const resetToken = crypto.randomBytes(32).toString("hex"); + this.passwordResetToken = crypto + .createHash("sha256") + .update(resetToken) + .digest("hex"); + this.passwordResetExpires = Date.now() + 10 * 60 * 1000; + console.log("resetToken:" + resetToken); + + return resetToken; +}; + +module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210511132742.js b/.history/models/User_20210511132742.js new file mode 100644 index 0000000..a9efe6e --- /dev/null +++ b/.history/models/User_20210511132742.js @@ -0,0 +1,39 @@ +const mongoose = require("mongoose"); +const crypto = require("crypto"); +const Schema = mongoose.Schema; + +const userSchema = new Schema({ + firstName: { + type: String, + required: true, + }, + lastName: { + type: String, + required: true, + }, + email: { + type: String, + required: true, + }, + password: { + type: String, + }, + googleId: { + type: String, + }, + student: { + type: mongoose.Types.ObjectId, + ref: "Student", + }, + isAdmin: { + type: Boolean, + }, + otp: { + type: String, + }, + passwordResetToken: String, + passwordResetExpires: Date, + //need to add isAdmin +}); + +module.exports = mongoose.model("User", userSchema); diff --git a/.history/routes/auth_20210509164313.js b/.history/routes/auth_20210509164313.js new file mode 100644 index 0000000..6c04fe6 --- /dev/null +++ b/.history/routes/auth_20210509164313.js @@ -0,0 +1,16 @@ +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); + +router.get("/protected", isAuth, authController.checkProtected); + +router.post("/signup", authController.postSignup); + +router.post("/signin", authController.postSignin); + +router.post("/sendotp", authController.sendOTP); + +router.post("/getotp", authController.getOTP); + +module.exports = router; diff --git a/.history/routes/auth_20210511125551.js b/.history/routes/auth_20210511125551.js new file mode 100644 index 0000000..3ff11bc --- /dev/null +++ b/.history/routes/auth_20210511125551.js @@ -0,0 +1,20 @@ +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); + +router.get("/protected", isAuth, authController.checkProtected); + +router.post("/signup", authController.postSignup); + +router.post("/signin", authController.postSignin); + +router.post("/sendotp", authController.sendOTP); + +router.post("/getotp", authController.getOTP); + +router.post("/forgotpassword", authController.forgotpassword); + +router.post("/resetpassword", authController.resetpassword); + +module.exports = router; diff --git a/.history/routes/auth_20210511171625.js b/.history/routes/auth_20210511171625.js new file mode 100644 index 0000000..279b73d --- /dev/null +++ b/.history/routes/auth_20210511171625.js @@ -0,0 +1,20 @@ +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); + +router.get("/protected", isAuth, authController.checkProtected); + +router.post("/signup", authController.postSignup); + +router.post("/signin", authController.postSignin); + +router.post("/sendotp", authController.sendOTP); + +router.post("/getotp", authController.getOTP); + +router.post("/forgotpassword", authController.forgotpassword); + +router.post("/resetpassword/:id/:token", authController.resetpassword); + +module.exports = router; diff --git a/.history/routes/auth_20210511171726.js b/.history/routes/auth_20210511171726.js new file mode 100644 index 0000000..17b3c92 --- /dev/null +++ b/.history/routes/auth_20210511171726.js @@ -0,0 +1,20 @@ +const express = require("express"); +const authController = require("../controllers/auth"); +const isAuth = require("../middleware/requirelogin"); +const router = express.Router(); + +router.get("/protected", isAuth, authController.checkProtected); + +router.post("/signup", authController.postSignup); + +router.post("/signin", authController.postSignin); + +router.post("/sendotp", authController.sendOTP); + +router.post("/getotp", authController.getOTP); + +router.post("/forgotpassword", authController.forgotpassword); + +router.post("/resetpassword/:_id/:token", authController.resetpassword); + +module.exports = router; diff --git a/.history/utils/emailSend_20210511130922.js b/.history/utils/emailSend_20210511130922.js new file mode 100644 index 0000000..e69de29 diff --git a/.history/utils/emailSend_20210511130932.js b/.history/utils/emailSend_20210511130932.js new file mode 100644 index 0000000..226990e --- /dev/null +++ b/.history/utils/emailSend_20210511130932.js @@ -0,0 +1 @@ +const nodemailer = require("nodemailer"); diff --git a/app.js b/app.js index 9dec7ab..c3b4e48 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,7 @@ const cors = require("cors"); const app = express(); -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; app.use(cors()); app.use(bodyparser.json()); diff --git a/controllers/auth.js b/controllers/auth.js index d9b71a4..edae889 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -125,6 +125,60 @@ module.exports.getOTP = (req, res, next) => { } }; +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const user_token = new User({ + passwordResetToken: token, + }); + user_token.save(); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const user_token = User.findOne({ + passwordResetToken: result.passwordResetToken, + }); + const payload = jwt.verify(token, secret); + if (token == user_token) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + module.exports.checkProtected = (req, res, next) => { console.log(req.user); res.json({ diff --git a/models/User.js b/models/User.js index 434b290..a9efe6e 100644 --- a/models/User.js +++ b/models/User.js @@ -1,5 +1,5 @@ const mongoose = require("mongoose"); - +const crypto = require("crypto"); const Schema = mongoose.Schema; const userSchema = new Schema({ @@ -31,6 +31,8 @@ const userSchema = new Schema({ otp: { type: String, }, + passwordResetToken: String, + passwordResetExpires: Date, //need to add isAdmin }); diff --git a/package-lock.json b/package-lock.json index 2ba48fb..15bf75a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "jsonwebtoken": "^8.5.1", "messagebird": "^3.6.1", "mongoose": "^5.12.2", + "nodemailer": "^6.6.0", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", "razorpay": "^2.0.6", @@ -1654,6 +1655,14 @@ "node": ">= 0.6" } }, + "node_modules/nodemailer": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", + "integrity": "sha512-ikSMDU1nZqpo2WUPE0wTTw/NGGImTkwpJKDIFPZT+YvvR9Sj+ze5wzu95JHkBMglQLoG2ITxU21WukCC/XsFkg==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/nodemon": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", @@ -4051,6 +4060,11 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "nodemailer": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", + "integrity": "sha512-ikSMDU1nZqpo2WUPE0wTTw/NGGImTkwpJKDIFPZT+YvvR9Sj+ze5wzu95JHkBMglQLoG2ITxU21WukCC/XsFkg==" + }, "nodemon": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", diff --git a/package.json b/package.json index 57493f3..4ed182b 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "jsonwebtoken": "^8.5.1", "messagebird": "^3.6.1", "mongoose": "^5.12.2", + "nodemailer": "^6.6.0", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", "razorpay": "^2.0.6", diff --git a/routes/auth.js b/routes/auth.js index 6c04fe6..17b3c92 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -13,4 +13,8 @@ router.post("/sendotp", authController.sendOTP); router.post("/getotp", authController.getOTP); +router.post("/forgotpassword", authController.forgotpassword); + +router.post("/resetpassword/:_id/:token", authController.resetpassword); + module.exports = router; From 09161a2379ef1d8efd9d935c1420c57863c39cb3 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Tue, 11 May 2021 19:52:30 +0530 Subject: [PATCH 10/39] Added forgot pass --- .history/app_20210509182623.js | 102 ---------- .history/app_20210511125853.js | 102 ---------- .history/controllers/auth_20210511124920.js | 144 -------------- .history/controllers/auth_20210511125553.js | 147 -------------- .history/controllers/auth_20210511130304.js | 147 -------------- .history/controllers/auth_20210511130652.js | 148 -------------- .history/controllers/auth_20210511130704.js | 148 -------------- .history/controllers/auth_20210511130706.js | 148 -------------- .history/controllers/auth_20210511130738.js | 148 -------------- .history/controllers/auth_20210511130806.js | 148 -------------- .history/controllers/auth_20210511130823.js | 148 -------------- .history/controllers/auth_20210511153608.js | 154 --------------- .history/controllers/auth_20210511153626.js | 154 --------------- .history/controllers/auth_20210511172833.js | 179 ----------------- .history/controllers/auth_20210511172847.js | 179 ----------------- .history/controllers/auth_20210511173119.js | 179 ----------------- .history/controllers/auth_20210511173233.js | 181 ----------------- .history/controllers/auth_20210511193324.js | 186 ------------------ .history/controllers/auth_20210511193420.js | 186 ------------------ ...210509165913.js => auth_20210511194950.js} | 0 ...210511193801.js => auth_20210511195210.js} | 0 .history/models/User_20210509151718.js | 37 ---- .history/models/User_20210511124914.js | 44 ----- .history/models/User_20210511125400.js | 51 ----- .history/models/User_20210511132742.js | 39 ---- .history/routes/auth_20210509164313.js | 16 -- .history/routes/auth_20210511125551.js | 20 -- .history/routes/auth_20210511171625.js | 20 -- .history/routes/auth_20210511171726.js | 20 -- .history/utils/emailSend_20210511130922.js | 0 .history/utils/emailSend_20210511130932.js | 1 - 31 files changed, 3176 deletions(-) delete mode 100644 .history/app_20210509182623.js delete mode 100644 .history/app_20210511125853.js delete mode 100644 .history/controllers/auth_20210511124920.js delete mode 100644 .history/controllers/auth_20210511125553.js delete mode 100644 .history/controllers/auth_20210511130304.js delete mode 100644 .history/controllers/auth_20210511130652.js delete mode 100644 .history/controllers/auth_20210511130704.js delete mode 100644 .history/controllers/auth_20210511130706.js delete mode 100644 .history/controllers/auth_20210511130738.js delete mode 100644 .history/controllers/auth_20210511130806.js delete mode 100644 .history/controllers/auth_20210511130823.js delete mode 100644 .history/controllers/auth_20210511153608.js delete mode 100644 .history/controllers/auth_20210511153626.js delete mode 100644 .history/controllers/auth_20210511172833.js delete mode 100644 .history/controllers/auth_20210511172847.js delete mode 100644 .history/controllers/auth_20210511173119.js delete mode 100644 .history/controllers/auth_20210511173233.js delete mode 100644 .history/controllers/auth_20210511193324.js delete mode 100644 .history/controllers/auth_20210511193420.js rename .history/controllers/{auth_20210509165913.js => auth_20210511194950.js} (100%) rename .history/controllers/{auth_20210511193801.js => auth_20210511195210.js} (100%) delete mode 100644 .history/models/User_20210509151718.js delete mode 100644 .history/models/User_20210511124914.js delete mode 100644 .history/models/User_20210511125400.js delete mode 100644 .history/models/User_20210511132742.js delete mode 100644 .history/routes/auth_20210509164313.js delete mode 100644 .history/routes/auth_20210511125551.js delete mode 100644 .history/routes/auth_20210511171625.js delete mode 100644 .history/routes/auth_20210511171726.js delete mode 100644 .history/utils/emailSend_20210511130922.js delete mode 100644 .history/utils/emailSend_20210511130932.js diff --git a/.history/app_20210509182623.js b/.history/app_20210509182623.js deleted file mode 100644 index 9dec7ab..0000000 --- a/.history/app_20210509182623.js +++ /dev/null @@ -1,102 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/app_20210511125853.js b/.history/app_20210511125853.js deleted file mode 100644 index c3b4e48..0000000 --- a/.history/app_20210511125853.js +++ /dev/null @@ -1,102 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; - -const cors = require("cors"); -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); diff --git a/.history/controllers/auth_20210511124920.js b/.history/controllers/auth_20210511124920.js deleted file mode 100644 index f14256a..0000000 --- a/.history/controllers/auth_20210511124920.js +++ /dev/null @@ -1,144 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await user.findOne({ email }); - //verify email then set password. - if (!user) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511125553.js b/.history/controllers/auth_20210511125553.js deleted file mode 100644 index c606687..0000000 --- a/.history/controllers/auth_20210511125553.js +++ /dev/null @@ -1,147 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await user.findOne({ email }); - //verify email then set password. - if (!user) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - const resetToken = user.createPasswordResetToken(); - await user.save(); - } -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130304.js b/.history/controllers/auth_20210511130304.js deleted file mode 100644 index 52ad595..0000000 --- a/.history/controllers/auth_20210511130304.js +++ /dev/null @@ -1,147 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await user.findOne({ email }); - //verify email then set password. - if (!user) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - // const resetToken = user.createPasswordResetToken(); - // await user.save(); - } -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130652.js b/.history/controllers/auth_20210511130652.js deleted file mode 100644 index 89683fa..0000000 --- a/.history/controllers/auth_20210511130652.js +++ /dev/null @@ -1,148 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await user.findOne({ email }).then((result) => { - if (!result) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - const resetToken = user.createPasswordResetToken(); - await user.save(); - } - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130704.js b/.history/controllers/auth_20210511130704.js deleted file mode 100644 index 0c75d23..0000000 --- a/.history/controllers/auth_20210511130704.js +++ /dev/null @@ -1,148 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await user.findOne({ email }).then((result) => { - if (!result) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - const resetToken = user.createPasswordResetToken(); - user.save(); - } - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130706.js b/.history/controllers/auth_20210511130706.js deleted file mode 100644 index 09c28ea..0000000 --- a/.history/controllers/auth_20210511130706.js +++ /dev/null @@ -1,148 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await user.findOne({ email }).then((result) => { - if (!result) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - // const resetToken = user.createPasswordResetToken(); - // user.save(); - } - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130738.js b/.history/controllers/auth_20210511130738.js deleted file mode 100644 index 7f4fa1d..0000000 --- a/.history/controllers/auth_20210511130738.js +++ /dev/null @@ -1,148 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await User.findOne({ email }).then((result) => { - if (!result) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - // const resetToken = user.createPasswordResetToken(); - // user.save(); - } - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130806.js b/.history/controllers/auth_20210511130806.js deleted file mode 100644 index 728a15d..0000000 --- a/.history/controllers/auth_20210511130806.js +++ /dev/null @@ -1,148 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await User.findOne({ email }).then((result) => { - if (!result) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - const resetToken = user.createPasswordResetToken(); - user.save(); - } - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511130823.js b/.history/controllers/auth_20210511130823.js deleted file mode 100644 index 7f4fa1d..0000000 --- a/.history/controllers/auth_20210511130823.js +++ /dev/null @@ -1,148 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - const user = await User.findOne({ email }).then((result) => { - if (!result) { - return res.status(404).json({ error: "No user with that Email id" }); - } else { - // const resetToken = user.createPasswordResetToken(); - // user.save(); - } - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511153608.js b/.history/controllers/auth_20210511153608.js deleted file mode 100644 index fc612e9..0000000 --- a/.history/controllers/auth_20210511153608.js +++ /dev/null @@ -1,154 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - crypto.randomBytes(32, (err, buffer) => { - if (err) { - console.log("error in crypto"); - } - const token = buffer.toString("hex"); - User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this email." }); - } - user.passwordResetToken = token; //generated token; - user.passwordResetExpires = Date.now() + 10 * 6 * 1000; //valid for 10 mins. - user.save().then((res) => {}); - }); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511153626.js b/.history/controllers/auth_20210511153626.js deleted file mode 100644 index 9edae01..0000000 --- a/.history/controllers/auth_20210511153626.js +++ /dev/null @@ -1,154 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email } = req.body; - crypto.randomBytes(32, (err, buffer) => { - if (err) { - console.log("error in crypto"); - } - const token = buffer.toString("hex"); - User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this email." }); - } - user.passwordResetToken = token; //generated token; - user.passwordResetExpires = Date.now() + 10 * 6 * 1000; //valid for 10 mins. - user.save().then((res) => {}); //need to do the task. - }); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => {}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511172833.js b/.history/controllers/auth_20210511172833.js deleted file mode 100644 index ed79012..0000000 --- a/.history/controllers/auth_20210511172833.js +++ /dev/null @@ -1,179 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const reset_link = `${link}/${result._id}/${token}`; - res.status(200).json({ reset_link }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const payload = jwt.verify(token, secret); - if (payload) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511172847.js b/.history/controllers/auth_20210511172847.js deleted file mode 100644 index 6847cb1..0000000 --- a/.history/controllers/auth_20210511172847.js +++ /dev/null @@ -1,179 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const reset_link = `${link}/${result._id}/${token}`; - res.status(200).json({ reset_link }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const payload = jwt.verify(token, secret); - if (payload) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511173119.js b/.history/controllers/auth_20210511173119.js deleted file mode 100644 index fef654c..0000000 --- a/.history/controllers/auth_20210511173119.js +++ /dev/null @@ -1,179 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const reset_link = `${link}/${result._id}/${token}`; - res.status(200).json({ reset_link }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const payload = jwt.verify(token, secret); - if (payload) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511173233.js b/.history/controllers/auth_20210511173233.js deleted file mode 100644 index 434735d..0000000 --- a/.history/controllers/auth_20210511173233.js +++ /dev/null @@ -1,181 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const payload = jwt.verify(token, secret); - if (payload) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511193324.js b/.history/controllers/auth_20210511193324.js deleted file mode 100644 index 624a403..0000000 --- a/.history/controllers/auth_20210511193324.js +++ /dev/null @@ -1,186 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const user_token=new User({ - passwordResetToken=token - }); - user_token.save(); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const user_token=User.findOne({passwordResetToken:result.passwordResetToken}); - const payload = jwt.verify(token, secret); - if (token==user_token) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511193420.js b/.history/controllers/auth_20210511193420.js deleted file mode 100644 index 624a403..0000000 --- a/.history/controllers/auth_20210511193420.js +++ /dev/null @@ -1,186 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const user_token=new User({ - passwordResetToken=token - }); - user_token.save(); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const user_token=User.findOne({passwordResetToken:result.passwordResetToken}); - const payload = jwt.verify(token, secret); - if (token==user_token) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210509165913.js b/.history/controllers/auth_20210511194950.js similarity index 100% rename from .history/controllers/auth_20210509165913.js rename to .history/controllers/auth_20210511194950.js diff --git a/.history/controllers/auth_20210511193801.js b/.history/controllers/auth_20210511195210.js similarity index 100% rename from .history/controllers/auth_20210511193801.js rename to .history/controllers/auth_20210511195210.js diff --git a/.history/models/User_20210509151718.js b/.history/models/User_20210509151718.js deleted file mode 100644 index 434b290..0000000 --- a/.history/models/User_20210509151718.js +++ /dev/null @@ -1,37 +0,0 @@ -const mongoose = require("mongoose"); - -const Schema = mongoose.Schema; - -const userSchema = new Schema({ - firstName: { - type: String, - required: true, - }, - lastName: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - password: { - type: String, - }, - googleId: { - type: String, - }, - student: { - type: mongoose.Types.ObjectId, - ref: "Student", - }, - isAdmin: { - type: Boolean, - }, - otp: { - type: String, - }, - //need to add isAdmin -}); - -module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210511124914.js b/.history/models/User_20210511124914.js deleted file mode 100644 index 7c368cd..0000000 --- a/.history/models/User_20210511124914.js +++ /dev/null @@ -1,44 +0,0 @@ -const mongoose = require("mongoose"); -const crypto = require("crypto"); -const Schema = mongoose.Schema; - -const userSchema = new Schema({ - firstName: { - type: String, - required: true, - }, - lastName: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - password: { - type: String, - }, - googleId: { - type: String, - }, - student: { - type: mongoose.Types.ObjectId, - ref: "Student", - }, - isAdmin: { - type: Boolean, - }, - otp: { - type: String, - }, - passwordResetToken: String, - passwordResetExpires: Date, - //need to add isAdmin -}); - -userSchema.methods.createPasswordResetToken = function () { - const resetToken = crypto.randomBytes(32).toString("hex"); - crypto.createHash("sha256").update(resetToken).digest("hex"); -}; - -module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210511125400.js b/.history/models/User_20210511125400.js deleted file mode 100644 index 8f499eb..0000000 --- a/.history/models/User_20210511125400.js +++ /dev/null @@ -1,51 +0,0 @@ -const mongoose = require("mongoose"); -const crypto = require("crypto"); -const Schema = mongoose.Schema; - -const userSchema = new Schema({ - firstName: { - type: String, - required: true, - }, - lastName: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - password: { - type: String, - }, - googleId: { - type: String, - }, - student: { - type: mongoose.Types.ObjectId, - ref: "Student", - }, - isAdmin: { - type: Boolean, - }, - otp: { - type: String, - }, - passwordResetToken: String, - passwordResetExpires: Date, - //need to add isAdmin -}); - -userSchema.methods.createPasswordResetToken = function () { - const resetToken = crypto.randomBytes(32).toString("hex"); - this.passwordResetToken = crypto - .createHash("sha256") - .update(resetToken) - .digest("hex"); - this.passwordResetExpires = Date.now() + 10 * 60 * 1000; - console.log("resetToken:" + resetToken); - - return resetToken; -}; - -module.exports = mongoose.model("User", userSchema); diff --git a/.history/models/User_20210511132742.js b/.history/models/User_20210511132742.js deleted file mode 100644 index a9efe6e..0000000 --- a/.history/models/User_20210511132742.js +++ /dev/null @@ -1,39 +0,0 @@ -const mongoose = require("mongoose"); -const crypto = require("crypto"); -const Schema = mongoose.Schema; - -const userSchema = new Schema({ - firstName: { - type: String, - required: true, - }, - lastName: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - password: { - type: String, - }, - googleId: { - type: String, - }, - student: { - type: mongoose.Types.ObjectId, - ref: "Student", - }, - isAdmin: { - type: Boolean, - }, - otp: { - type: String, - }, - passwordResetToken: String, - passwordResetExpires: Date, - //need to add isAdmin -}); - -module.exports = mongoose.model("User", userSchema); diff --git a/.history/routes/auth_20210509164313.js b/.history/routes/auth_20210509164313.js deleted file mode 100644 index 6c04fe6..0000000 --- a/.history/routes/auth_20210509164313.js +++ /dev/null @@ -1,16 +0,0 @@ -const express = require("express"); -const authController = require("../controllers/auth"); -const isAuth = require("../middleware/requirelogin"); -const router = express.Router(); - -router.get("/protected", isAuth, authController.checkProtected); - -router.post("/signup", authController.postSignup); - -router.post("/signin", authController.postSignin); - -router.post("/sendotp", authController.sendOTP); - -router.post("/getotp", authController.getOTP); - -module.exports = router; diff --git a/.history/routes/auth_20210511125551.js b/.history/routes/auth_20210511125551.js deleted file mode 100644 index 3ff11bc..0000000 --- a/.history/routes/auth_20210511125551.js +++ /dev/null @@ -1,20 +0,0 @@ -const express = require("express"); -const authController = require("../controllers/auth"); -const isAuth = require("../middleware/requirelogin"); -const router = express.Router(); - -router.get("/protected", isAuth, authController.checkProtected); - -router.post("/signup", authController.postSignup); - -router.post("/signin", authController.postSignin); - -router.post("/sendotp", authController.sendOTP); - -router.post("/getotp", authController.getOTP); - -router.post("/forgotpassword", authController.forgotpassword); - -router.post("/resetpassword", authController.resetpassword); - -module.exports = router; diff --git a/.history/routes/auth_20210511171625.js b/.history/routes/auth_20210511171625.js deleted file mode 100644 index 279b73d..0000000 --- a/.history/routes/auth_20210511171625.js +++ /dev/null @@ -1,20 +0,0 @@ -const express = require("express"); -const authController = require("../controllers/auth"); -const isAuth = require("../middleware/requirelogin"); -const router = express.Router(); - -router.get("/protected", isAuth, authController.checkProtected); - -router.post("/signup", authController.postSignup); - -router.post("/signin", authController.postSignin); - -router.post("/sendotp", authController.sendOTP); - -router.post("/getotp", authController.getOTP); - -router.post("/forgotpassword", authController.forgotpassword); - -router.post("/resetpassword/:id/:token", authController.resetpassword); - -module.exports = router; diff --git a/.history/routes/auth_20210511171726.js b/.history/routes/auth_20210511171726.js deleted file mode 100644 index 17b3c92..0000000 --- a/.history/routes/auth_20210511171726.js +++ /dev/null @@ -1,20 +0,0 @@ -const express = require("express"); -const authController = require("../controllers/auth"); -const isAuth = require("../middleware/requirelogin"); -const router = express.Router(); - -router.get("/protected", isAuth, authController.checkProtected); - -router.post("/signup", authController.postSignup); - -router.post("/signin", authController.postSignin); - -router.post("/sendotp", authController.sendOTP); - -router.post("/getotp", authController.getOTP); - -router.post("/forgotpassword", authController.forgotpassword); - -router.post("/resetpassword/:_id/:token", authController.resetpassword); - -module.exports = router; diff --git a/.history/utils/emailSend_20210511130922.js b/.history/utils/emailSend_20210511130922.js deleted file mode 100644 index e69de29..0000000 diff --git a/.history/utils/emailSend_20210511130932.js b/.history/utils/emailSend_20210511130932.js deleted file mode 100644 index 226990e..0000000 --- a/.history/utils/emailSend_20210511130932.js +++ /dev/null @@ -1 +0,0 @@ -const nodemailer = require("nodemailer"); From 65e40798f44a55d7ce128c6c65f39dbfb452ce0e Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Tue, 11 May 2021 19:53:32 +0530 Subject: [PATCH 11/39] Added phone auth --- .history/controllers/auth_20210511195315.js | 134 ++++++++++++++++++++ controllers/auth.js | 54 -------- 2 files changed, 134 insertions(+), 54 deletions(-) create mode 100644 .history/controllers/auth_20210511195315.js diff --git a/.history/controllers/auth_20210511195315.js b/.history/controllers/auth_20210511195315.js new file mode 100644 index 0000000..d9b71a4 --- /dev/null +++ b/.history/controllers/auth_20210511195315.js @@ -0,0 +1,134 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/controllers/auth.js b/controllers/auth.js index edae889..d9b71a4 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -125,60 +125,6 @@ module.exports.getOTP = (req, res, next) => { } }; -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const user_token = new User({ - passwordResetToken: token, - }); - user_token.save(); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const user_token = User.findOne({ - passwordResetToken: result.passwordResetToken, - }); - const payload = jwt.verify(token, secret); - if (token == user_token) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - module.exports.checkProtected = (req, res, next) => { console.log(req.user); res.json({ From 9b30947c7b0de6fd01ea6a9bc602e0ec21456750 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Tue, 11 May 2021 19:55:34 +0530 Subject: [PATCH 12/39] Added forgot pass --- .history/controllers/auth_20210511195522.js | 187 ++++++++++++++++++++ controllers/auth.js | 91 ++++++---- 2 files changed, 240 insertions(+), 38 deletions(-) create mode 100644 .history/controllers/auth_20210511195522.js diff --git a/.history/controllers/auth_20210511195522.js b/.history/controllers/auth_20210511195522.js new file mode 100644 index 0000000..70fab0a --- /dev/null +++ b/.history/controllers/auth_20210511195522.js @@ -0,0 +1,187 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const user_token = new User({ + passwordResetToken: token, + }); + user_token.save(); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const user_token = User.findOne({ + passwordResetToken: result.passwordResetToken, + }); + const payload = jwt.verify(token, secret); + if (token == user_token) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/controllers/auth.js b/controllers/auth.js index 75289d9..70fab0a 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -78,7 +78,6 @@ module.exports.postSignin = async (req, res, next) => { } }; - module.exports.sendOTP = (req, res, next) => { //uNNYosMopvvCW9RTR1tRWJmYC test //llVKD53ve6QRpbCKOHzWBADaS live @@ -90,43 +89,6 @@ module.exports.sendOTP = (req, res, next) => { } else { messagebird.verify.create( phoneNumber, - -module.exports.postSignin = async (req , res , next) => { - try - { - //we need email and password as input - let email = req.body.email ; - let password = req.body.password ; - let user = await User.findOne({email : email}) ; - if(user) - { - const isMatched = await bcrypt.compare(password , user.password) ; - if(isMatched) - { - const token = jwt.sign({_id:user._id},JWT_secret) - if(!user.numLoggedIn) - { - user.numLoggedIn = 0 ; - } - user.numLoggedIn = user.numLoggedIn + 1 ; - res.json( - { - token:token , - isAdmin : user.isAdmin - } - ) - await user.save() ; - } - else - { - res.json({ - message:"email and password doesn't match" , - type:"error" - }) - } - } - else - { template: "Your verification code is %token", }, @@ -162,6 +124,59 @@ module.exports.getOTP = (req, res, next) => { console.log(err); } }; +module.exports.forgotpassword = async (req, res, next) => { + const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + User.findOne({ email }) + .then((result) => { + if (!result) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: result.email, + _id: result._id, + }; + const secret = JWT_secret + result.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + const user_token = new User({ + passwordResetToken: token, + }); + user_token.save(); + const reset_link = `${link}/${result._id}/${token}`; + res + .status(200) + .json({ reset_link, message: "link is active for 10 mins" }); + } + }) + .catch((err) => { + console.log(err); + }); + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + await User.findById({ _id }).then((result) => { + if (result) { + const secret = JWT_secret + result.password; + const user_token = User.findOne({ + passwordResetToken: result.passwordResetToken, + }); + const payload = jwt.verify(token, secret); + if (token == user_token) { + User.findByIdAndUpdate(_id, { $set: { password } }) + .then((data) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log(err); + }); + } else { + res.status(422).json({ error: "some error occured" }); + } + } + }); +}; module.exports.checkProtected = (req, res, next) => { console.log(req.user); From 1a53c17cb1976afc5e965f5526e4c5a66ffa7ceb Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Tue, 11 May 2021 19:56:47 +0530 Subject: [PATCH 13/39] Added forgot pass --- .history/controllers/auth_20210511194950.js | 134 -------------- .history/controllers/auth_20210511195210.js | 188 -------------------- .history/controllers/auth_20210511195315.js | 134 -------------- .history/controllers/auth_20210511195522.js | 187 ------------------- models/User.js | 36 ---- 5 files changed, 679 deletions(-) delete mode 100644 .history/controllers/auth_20210511194950.js delete mode 100644 .history/controllers/auth_20210511195210.js delete mode 100644 .history/controllers/auth_20210511195315.js delete mode 100644 .history/controllers/auth_20210511195522.js diff --git a/.history/controllers/auth_20210511194950.js b/.history/controllers/auth_20210511194950.js deleted file mode 100644 index d9b71a4..0000000 --- a/.history/controllers/auth_20210511194950.js +++ /dev/null @@ -1,134 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511195210.js b/.history/controllers/auth_20210511195210.js deleted file mode 100644 index edae889..0000000 --- a/.history/controllers/auth_20210511195210.js +++ /dev/null @@ -1,188 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const user_token = new User({ - passwordResetToken: token, - }); - user_token.save(); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const user_token = User.findOne({ - passwordResetToken: result.passwordResetToken, - }); - const payload = jwt.verify(token, secret); - if (token == user_token) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511195315.js b/.history/controllers/auth_20210511195315.js deleted file mode 100644 index d9b71a4..0000000 --- a/.history/controllers/auth_20210511195315.js +++ /dev/null @@ -1,134 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210511195522.js b/.history/controllers/auth_20210511195522.js deleted file mode 100644 index 70fab0a..0000000 --- a/.history/controllers/auth_20210511195522.js +++ /dev/null @@ -1,187 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: result.email, - _id: result._id, - }; - const secret = JWT_secret + result.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const user_token = new User({ - passwordResetToken: token, - }); - user_token.save(); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); - } - }) - .catch((err) => { - console.log(err); - }); - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const user_token = User.findOne({ - passwordResetToken: result.passwordResetToken, - }); - const payload = jwt.verify(token, secret); - if (token == user_token) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log(err); - }); - } else { - res.status(422).json({ error: "some error occured" }); - } - } - }); -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/models/User.js b/models/User.js index db9528a..a9efe6e 100644 --- a/models/User.js +++ b/models/User.js @@ -3,7 +3,6 @@ const crypto = require("crypto"); const Schema = mongoose.Schema; const userSchema = new Schema({ - firstName: { type: String, required: true, @@ -37,39 +36,4 @@ const userSchema = new Schema({ //need to add isAdmin }); - firstName : { - type :String , - required : true - } , - lastName : { - type:String , - required: true - } , - email : { - type:String , - required: true - } , - password : { - type : String - } , - googleId : { - type : String - } , - student : { - type : mongoose.Types.ObjectId , - ref: 'Student' - } , - isAdmin : { - type : Boolean - } , - numLoggedIn : { - type : Number - } , - clicked : { - type : Object - } - //need to add isAdmin -}) ; - - module.exports = mongoose.model("User", userSchema); From f9a018de8d2daea4258c136cc5eaaf3d89b53f2d Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 12 May 2021 14:46:11 +0530 Subject: [PATCH 14/39] Added forgot pass --- app.js | 66 +++++++++------------------------------ controllers/auth.js | 76 ++++++++++++++++++++++++++++----------------- models/Coupon.js | 48 ++++++++++++---------------- routes/Coupon.js | 37 ++++++++++------------ 4 files changed, 100 insertions(+), 127 deletions(-) diff --git a/app.js b/app.js index ca5c804..217a4fa 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,3 @@ - const express = require("express"); const mongoose = require("mongoose"); const bodyparser = require("body-parser"); @@ -6,25 +5,13 @@ const authRoute = require("./routes/auth"); const profileRoute = require("./routes/profile"); const paymentRoute = require("./routes/payment"); const courseRoute = require("./routes/course"); +const couponRoute = require("./routes/Coupon"); +const queryRoute = require("./routes/query"); const adminRoute = require("./routes/admin"); const port = process.env.PORT || 5000; const cors = require("cors"); -const express = require('express') ; -const mongoose = require('mongoose') ; -const bodyparser = require('body-parser') ; -const authRoute = require('./routes/auth') ; -const profileRoute = require('./routes/profile') ; -const paymentRoute = require('./routes/payment') ; -const courseRoute = require('./routes/course') ; -const adminRoute = require('./routes/admin') ; -const couponRoute = require('./routes/Coupon') ; -const queryRoute = require('./routes/query') ; -const port=process.env.PORT || 5000; - -const cors = require('cors') ; - //const passport = require('passport'); //const cookieSession = require('cookie-session') ; //require('./passport-setup') ; @@ -90,18 +77,6 @@ require("./models/Coupon"); // req.logout() ; // res.redirect('/') ; // }) - -app.use(require("./routes/Coupon")); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - mongoose .connect(MONGO_URI, { useNewUrlParser: true, @@ -115,29 +90,18 @@ mongoose }); }) .catch((err) => { - - -app.use(authRoute) ; - -app.use(profileRoute) ; - -app.use(paymentRoute) ; - -app.use(courseRoute) ; - -app.use(adminRoute) ; - -app.use(couponRoute) ; - -app.use(queryRoute) ; - -mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true ,useFindAndModify:false}). -then(result => { - console.log('connected'); - app.listen(port,()=>{ - console.log("server is running on port",port); - }) ; -}) -.catch(err => { console.log(err); }); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +app.use(couponRoute); + +app.use(queryRoute); diff --git a/controllers/auth.js b/controllers/auth.js index 70fab0a..2b72670 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -126,56 +126,76 @@ module.exports.getOTP = (req, res, next) => { }; module.exports.forgotpassword = async (req, res, next) => { const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - User.findOne({ email }) - .then((result) => { - if (!result) { + try { + await User.findOne({ email }).then((user) => { + console.log("user before", user); + if (!user) { res.status(404).json({ error: "User not found with this Email" }); return; } else { const payload = { - email: result.email, - _id: result._id, + email: user.email, + _id: user._id, }; - const secret = JWT_secret + result.password; + const secret = JWT_secret + user.password; const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - const user_token = new User({ - passwordResetToken: token, - }); - user_token.save(); - const reset_link = `${link}/${result._id}/${token}`; - res - .status(200) - .json({ reset_link, message: "link is active for 10 mins" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + + console.log("user after", user); } - }) - .catch((err) => { - console.log(err); }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } //verify email then set password. }; module.exports.resetpassword = async (req, res, next) => { const { _id, token } = req.params; const { password } = req.body; - await User.findById({ _id }).then((result) => { - if (result) { - const secret = JWT_secret + result.password; - const user_token = User.findOne({ - passwordResetToken: result.passwordResetToken, - }); + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); if (token == user_token) { - User.findByIdAndUpdate(_id, { $set: { password } }) - .then((data) => { + user.password = hashedPass; + await user + .save() + .then((ok) => { res.json({ message: "Password Updated!" }); }) .catch((err) => { - console.log(err); + console.log("Error in save", err); }); } else { - res.status(422).json({ error: "some error occured" }); + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; } } - }); + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } }; module.exports.checkProtected = (req, res, next) => { diff --git a/models/Coupon.js b/models/Coupon.js index 20e4fb9..08963e3 100644 --- a/models/Coupon.js +++ b/models/Coupon.js @@ -1,29 +1,21 @@ -const mongoose=require('mongoose') -const CouponSchema=new mongoose.Schema({ +const mongoose = require("mongoose"); +const CouponSchema = new mongoose.Schema({ + couponCode: { + type: String, + required: true, + }, + percentage: { + type: String, + required: true, + }, + remainingTimes: { + type: Number, + required: true, + }, + numAllowed: { + type: Number, + required: true, + }, +}); - coupon_code:{ - - couponCode:{ - - type:String, - required:true - }, - percentage:{ - - type:String, - required:true - }, - remainingTimes:{ - type:Number - - type:Number , - required:true - }, - numAllowed:{ - type:Number , - required:true - - } -}) - -module.exports = mongoose.model('Coupon' , CouponSchema) ; \ No newline at end of file +module.exports = mongoose.model("Coupon", CouponSchema); diff --git a/routes/Coupon.js b/routes/Coupon.js index 7241a15..dc53f24 100644 --- a/routes/Coupon.js +++ b/routes/Coupon.js @@ -1,33 +1,30 @@ const express = require("express"); -const couponController = require('../controllers/coupon') ; +const couponController = require("../controllers/coupon"); -const isAuth = require('../middleware/requirelogin') ; -const isAdmin = require('../middleware/isAdmin') ; +const isAuth = require("../middleware/requirelogin"); +const isAdmin = require("../middleware/isAdmin"); const router = express.Router(); - router.post("/set-coupon", (req, res) => { - const { percentage, coupon_code ,remainingTimes} = req.body; - if(!coupon_code || !percentage || !remainingTimes){ - return res.status(422).json({error:"Add all fields"}) - }else{ + const { percentage, coupon_code, remainingTimes } = req.body; + if (!coupon_code || !percentage || !remainingTimes) { + return res.status(422).json({ error: "Add all fields" }); + } else { const coupon = new Coupon({ - coupon_code, - percentage, - remainingTimes - }); - coupon.save().then((result) => { - res.status(200).json({ message: "Coupon set Successfully" }); - }); + coupon_code, + percentage, + remainingTimes, + }); + coupon.save().then((result) => { + res.status(200).json({ message: "Coupon set Successfully" }); + }); } }); -======= -router.get("/getAllCoupons",isAuth , isAdmin , couponController.getAllCoupons); +router.get("/getAllCoupons", isAuth, isAdmin, couponController.getAllCoupons); +router.post("/addCoupon", isAuth, isAdmin, couponController.addCoupon); -router.post("/addCoupon", isAuth , isAdmin ,couponController.addCoupon); - -router.post("/deleteCoupon", isAuth , isAdmin ,couponController.deleteCoupon); +router.post("/deleteCoupon", isAuth, isAdmin, couponController.deleteCoupon); module.exports = router; From 6665eb761f96fab76a4912bc2e4c0576eb803e67 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 12 May 2021 16:14:03 +0530 Subject: [PATCH 15/39] Push Emails Added --- controllers/auth.js | 27 +++++++++++++++++++++++---- routes/auth.js | 2 ++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index 2b72670..807b04e 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -4,6 +4,7 @@ const Student = require("../models/Student"); const jwt = require("jsonwebtoken"); const JWT_secret = "Cantileverlabs"; const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); module.exports.Protected = async (req, res, next) => { res.send("Hello User"); @@ -124,11 +125,18 @@ module.exports.getOTP = (req, res, next) => { console.log(err); } }; +var transport = nodemailer.createTransport({ + host: "smtp.mailtrap.io", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); module.exports.forgotpassword = async (req, res, next) => { - const { email, link } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token try { await User.findOne({ email }).then((user) => { - console.log("user before", user); if (!user) { res.status(404).json({ error: "User not found with this Email" }); return; @@ -144,6 +152,19 @@ module.exports.forgotpassword = async (req, res, next) => { }) .then((data) => { const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); res.status(200).json({ message: "Token Saved and link is active for 10 mins", reset_link, @@ -152,8 +173,6 @@ module.exports.forgotpassword = async (req, res, next) => { .catch((err) => { console.log(err); }); - - console.log("user after", user); } }); } catch { diff --git a/routes/auth.js b/routes/auth.js index 17b3c92..496e1e5 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -17,4 +17,6 @@ router.post("/forgotpassword", authController.forgotpassword); router.post("/resetpassword/:_id/:token", authController.resetpassword); +router.get("/resetpassword/:_id/:token", authController.resetpassword); + module.exports = router; From 500f73b78ae8f78dbbe8b4938c6ef35e0e7c3e00 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 12 May 2021 16:30:38 +0530 Subject: [PATCH 16/39] Added Push Emails --- .history/app_20210512123231.js | 107 +++++++++ .history/app_20210512162202.js | 107 +++++++++ .history/controllers/auth_20210512161317.js | 226 +++++++++++++++++++ .history/controllers/auth_20210512162616.js | 226 +++++++++++++++++++ .history/controllers/auth_20210512162619.js | 226 +++++++++++++++++++ .history/controllers/auth_20210512162622.js | 226 +++++++++++++++++++ .history/controllers/auth_20210512162827.js | 238 ++++++++++++++++++++ .history/controllers/auth_20210512162910.js | 238 ++++++++++++++++++++ .history/controllers/auth_20210512162916.js | 237 +++++++++++++++++++ .history/controllers/auth_20210512163012.js | 237 +++++++++++++++++++ app.js | 2 +- controllers/auth.js | 23 +- 12 files changed, 2086 insertions(+), 7 deletions(-) create mode 100644 .history/app_20210512123231.js create mode 100644 .history/app_20210512162202.js create mode 100644 .history/controllers/auth_20210512161317.js create mode 100644 .history/controllers/auth_20210512162616.js create mode 100644 .history/controllers/auth_20210512162619.js create mode 100644 .history/controllers/auth_20210512162622.js create mode 100644 .history/controllers/auth_20210512162827.js create mode 100644 .history/controllers/auth_20210512162910.js create mode 100644 .history/controllers/auth_20210512162916.js create mode 100644 .history/controllers/auth_20210512163012.js diff --git a/.history/app_20210512123231.js b/.history/app_20210512123231.js new file mode 100644 index 0000000..217a4fa --- /dev/null +++ b/.history/app_20210512123231.js @@ -0,0 +1,107 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const couponRoute = require("./routes/Coupon"); +const queryRoute = require("./routes/query"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; + +const cors = require("cors"); + +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +app.use(couponRoute); + +app.use(queryRoute); diff --git a/.history/app_20210512162202.js b/.history/app_20210512162202.js new file mode 100644 index 0000000..43635e8 --- /dev/null +++ b/.history/app_20210512162202.js @@ -0,0 +1,107 @@ +const express = require("express"); +const mongoose = require("mongoose"); +const bodyparser = require("body-parser"); +const authRoute = require("./routes/auth"); +const profileRoute = require("./routes/profile"); +const paymentRoute = require("./routes/payment"); +const courseRoute = require("./routes/course"); +const couponRoute = require("./routes/Coupon"); +const queryRoute = require("./routes/query"); +const adminRoute = require("./routes/admin"); +const port = process.env.PORT || 5000; + +const cors = require("cors"); + +//const passport = require('passport'); +//const cookieSession = require('cookie-session') ; +//require('./passport-setup') ; + +const app = express(); + +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; + +app.use(cors()); +app.use(bodyparser.json()); +require("./models/Coupon"); + +// app.use(cookieSession({ +// name: 'test-session', +// keys: ['key1', 'key2'] +// })) + +// const isLoggedIn = (req , res , next) => { +// if(req.user) +// { +// next() +// } +// else +// { +// res.json({ +// error : "No user" +// }) +// } +// } + +// app.use(passport.initialize()); +// app.use(passport.session()); + +// app.get('/failed' , (req , res) => { +// res.json({ +// error : "You have failed to login" +// }) +// }) + +// app.get('/' , (req , res) => { +// console.log('you are not logged in'); + +// }) + +// app.get('/good' ,isLoggedIn , (req , res) => { +// res.json({ +// message:"success" , +// user : req.user +// }) +// }) + +// app.get('/auth/google', +// passport.authenticate('google', { scope: ['profile' , 'email'] })); + +// app.get('/auth/google/callback', +// passport.authenticate('google', { failureRedirect: '/failed' }), +// function(req, res) { +// res.redirect('/good'); +// }); + +// app.get('/logout', (req , res) => { +// req.session = null ; +// req.logout() ; +// res.redirect('/') ; +// }) +mongoose + .connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + }) + .then((result) => { + console.log("connected"); + app.listen(port, () => { + console.log("server is running on port", port); + }); + }) + .catch((err) => { + console.log(err); + }); +app.use(authRoute); + +app.use(profileRoute); + +app.use(paymentRoute); + +app.use(courseRoute); + +app.use(adminRoute); + +app.use(couponRoute); + +app.use(queryRoute); diff --git a/.history/controllers/auth_20210512161317.js b/.history/controllers/auth_20210512161317.js new file mode 100644 index 0000000..807b04e --- /dev/null +++ b/.history/controllers/auth_20210512161317.js @@ -0,0 +1,226 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, token } = req.body; + messagebird.verify.verify(id, token, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +var transport = nodemailer.createTransport({ + host: "smtp.mailtrap.io", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512162616.js b/.history/controllers/auth_20210512162616.js new file mode 100644 index 0000000..1f373e1 --- /dev/null +++ b/.history/controllers/auth_20210512162616.js @@ -0,0 +1,226 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +var transport = nodemailer.createTransport({ + host: "smtp.mailtrap.io", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512162619.js b/.history/controllers/auth_20210512162619.js new file mode 100644 index 0000000..1f373e1 --- /dev/null +++ b/.history/controllers/auth_20210512162619.js @@ -0,0 +1,226 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +var transport = nodemailer.createTransport({ + host: "smtp.mailtrap.io", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512162622.js b/.history/controllers/auth_20210512162622.js new file mode 100644 index 0000000..1f373e1 --- /dev/null +++ b/.history/controllers/auth_20210512162622.js @@ -0,0 +1,226 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +var transport = nodemailer.createTransport({ + host: "smtp.mailtrap.io", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } + //verify email then set password. +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512162827.js b/.history/controllers/auth_20210512162827.js new file mode 100644 index 0000000..62c1413 --- /dev/null +++ b/.history/controllers/auth_20210512162827.js @@ -0,0 +1,238 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + +var transport = nodemailer.createTransport({ + host: "smtp.mailtrap.io", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512162910.js b/.history/controllers/auth_20210512162910.js new file mode 100644 index 0000000..2a52b56 --- /dev/null +++ b/.history/controllers/auth_20210512162910.js @@ -0,0 +1,238 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + +var transport = nodemailer.createTransport({ + service: "gmail", + port: 2525, + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512162916.js b/.history/controllers/auth_20210512162916.js new file mode 100644 index 0000000..5884d9e --- /dev/null +++ b/.history/controllers/auth_20210512162916.js @@ -0,0 +1,237 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + +var transport = nodemailer.createTransport({ + service: "gmail", + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512163012.js b/.history/controllers/auth_20210512163012.js new file mode 100644 index 0000000..5884d9e --- /dev/null +++ b/.history/controllers/auth_20210512163012.js @@ -0,0 +1,237 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + +var transport = nodemailer.createTransport({ + service: "gmail", + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/app.js b/app.js index 217a4fa..43635e8 100644 --- a/app.js +++ b/app.js @@ -18,7 +18,7 @@ const cors = require("cors"); const app = express(); -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; app.use(cors()); app.use(bodyparser.json()); diff --git a/controllers/auth.js b/controllers/auth.js index 807b04e..5884d9e 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -79,6 +79,9 @@ module.exports.postSignin = async (req, res, next) => { } }; +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + module.exports.sendOTP = (req, res, next) => { //uNNYosMopvvCW9RTR1tRWJmYC test //llVKD53ve6QRpbCKOHzWBADaS live @@ -111,8 +114,8 @@ module.exports.sendOTP = (req, res, next) => { module.exports.getOTP = (req, res, next) => { try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { if (err) { console.log({ error: err.errors[0].description, id: id }); res.json({ error: err.errors[0].description, id: id }); @@ -125,16 +128,22 @@ module.exports.getOTP = (req, res, next) => { console.log(err); } }; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, + service: "gmail", auth: { user: "5578544cc56856", pass: "a510d3d969d3b3", }, }); module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token try { await User.findOne({ email }).then((user) => { if (!user) { @@ -180,7 +189,6 @@ module.exports.forgotpassword = async (req, res, next) => { console.log("Error from forgot pass", error); }; } - //verify email then set password. }; module.exports.resetpassword = async (req, res, next) => { const { _id, token } = req.params; @@ -217,6 +225,9 @@ module.exports.resetpassword = async (req, res, next) => { } }; +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + module.exports.checkProtected = (req, res, next) => { console.log(req.user); res.json({ From f8e5fa306ab015a49289f08542baf30d2a69cdb4 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 12 May 2021 16:37:12 +0530 Subject: [PATCH 17/39] Push Emails --- .history/app_20210512123231.js | 107 --------- .history/app_20210512162202.js | 107 --------- .history/controllers/auth_20210512161317.js | 226 ------------------- .history/controllers/auth_20210512162616.js | 226 ------------------- .history/controllers/auth_20210512162619.js | 226 ------------------- .history/controllers/auth_20210512162622.js | 226 ------------------- .history/controllers/auth_20210512162827.js | 238 -------------------- .history/controllers/auth_20210512162910.js | 238 -------------------- .history/controllers/auth_20210512162916.js | 237 ------------------- .history/controllers/auth_20210512163012.js | 237 ------------------- 10 files changed, 2068 deletions(-) delete mode 100644 .history/app_20210512123231.js delete mode 100644 .history/app_20210512162202.js delete mode 100644 .history/controllers/auth_20210512161317.js delete mode 100644 .history/controllers/auth_20210512162616.js delete mode 100644 .history/controllers/auth_20210512162619.js delete mode 100644 .history/controllers/auth_20210512162622.js delete mode 100644 .history/controllers/auth_20210512162827.js delete mode 100644 .history/controllers/auth_20210512162910.js delete mode 100644 .history/controllers/auth_20210512162916.js delete mode 100644 .history/controllers/auth_20210512163012.js diff --git a/.history/app_20210512123231.js b/.history/app_20210512123231.js deleted file mode 100644 index 217a4fa..0000000 --- a/.history/app_20210512123231.js +++ /dev/null @@ -1,107 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const couponRoute = require("./routes/Coupon"); -const queryRoute = require("./routes/query"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; - -const cors = require("cors"); - -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -app.use(couponRoute); - -app.use(queryRoute); diff --git a/.history/app_20210512162202.js b/.history/app_20210512162202.js deleted file mode 100644 index 43635e8..0000000 --- a/.history/app_20210512162202.js +++ /dev/null @@ -1,107 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const couponRoute = require("./routes/Coupon"); -const queryRoute = require("./routes/query"); -const adminRoute = require("./routes/admin"); -const port = process.env.PORT || 5000; - -const cors = require("cors"); - -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const app = express(); - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); -require("./models/Coupon"); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -app.use(couponRoute); - -app.use(queryRoute); diff --git a/.history/controllers/auth_20210512161317.js b/.history/controllers/auth_20210512161317.js deleted file mode 100644 index 807b04e..0000000 --- a/.history/controllers/auth_20210512161317.js +++ /dev/null @@ -1,226 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512162616.js b/.history/controllers/auth_20210512162616.js deleted file mode 100644 index 1f373e1..0000000 --- a/.history/controllers/auth_20210512162616.js +++ /dev/null @@ -1,226 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512162619.js b/.history/controllers/auth_20210512162619.js deleted file mode 100644 index 1f373e1..0000000 --- a/.history/controllers/auth_20210512162619.js +++ /dev/null @@ -1,226 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512162622.js b/.history/controllers/auth_20210512162622.js deleted file mode 100644 index 1f373e1..0000000 --- a/.history/controllers/auth_20210512162622.js +++ /dev/null @@ -1,226 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } - //verify email then set password. -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512162827.js b/.history/controllers/auth_20210512162827.js deleted file mode 100644 index 62c1413..0000000 --- a/.history/controllers/auth_20210512162827.js +++ /dev/null @@ -1,238 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Email verification Starts - -var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Email verification Ends -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512162910.js b/.history/controllers/auth_20210512162910.js deleted file mode 100644 index 2a52b56..0000000 --- a/.history/controllers/auth_20210512162910.js +++ /dev/null @@ -1,238 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - port: 2525, - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Email verification Ends -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512162916.js b/.history/controllers/auth_20210512162916.js deleted file mode 100644 index 5884d9e..0000000 --- a/.history/controllers/auth_20210512162916.js +++ /dev/null @@ -1,237 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Email verification Ends -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512163012.js b/.history/controllers/auth_20210512163012.js deleted file mode 100644 index 5884d9e..0000000 --- a/.history/controllers/auth_20210512163012.js +++ /dev/null @@ -1,237 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Email verification Ends -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; From ac20694b2a1ed9032023040bd480c157a67406ef Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 12 May 2021 17:00:43 +0530 Subject: [PATCH 18/39] Push Emails from company --- .history/controllers/auth_20210512163011.js | 237 ++++++++++++++++++++ .history/controllers/auth_20210512170016.js | 237 ++++++++++++++++++++ controllers/auth.js | 4 +- 3 files changed, 476 insertions(+), 2 deletions(-) create mode 100644 .history/controllers/auth_20210512163011.js create mode 100644 .history/controllers/auth_20210512170016.js diff --git a/.history/controllers/auth_20210512163011.js b/.history/controllers/auth_20210512163011.js new file mode 100644 index 0000000..5884d9e --- /dev/null +++ b/.history/controllers/auth_20210512163011.js @@ -0,0 +1,237 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + +var transport = nodemailer.createTransport({ + service: "gmail", + auth: { + user: "5578544cc56856", + pass: "a510d3d969d3b3", + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/.history/controllers/auth_20210512170016.js b/.history/controllers/auth_20210512170016.js new file mode 100644 index 0000000..92e390f --- /dev/null +++ b/.history/controllers/auth_20210512170016.js @@ -0,0 +1,237 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const nodemailer = require("nodemailer"); + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + res.json({ + message: "Successfully signed Up", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + try { + const { phoneNumber } = req.body; + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + +var transport = nodemailer.createTransport({ + service: "gmail", + auth: { + user: "5578544cc56856", //replace it with the companies mail + pass: "a510d3d969d3b3", //replace it with the companies pass + }, +}); +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Token Saved and link is active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/controllers/auth.js b/controllers/auth.js index 5884d9e..92e390f 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -137,8 +137,8 @@ module.exports.getOTP = (req, res, next) => { var transport = nodemailer.createTransport({ service: "gmail", auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", + user: "5578544cc56856", //replace it with the companies mail + pass: "a510d3d969d3b3", //replace it with the companies pass }, }); module.exports.forgotpassword = async (req, res, next) => { From 3636c85a418d270154cefca3370e7285c103e087 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 12 May 2021 17:00:52 +0530 Subject: [PATCH 19/39] Push Emails from company --- .history/controllers/auth_20210512163011.js | 237 -------------------- .history/controllers/auth_20210512170016.js | 237 -------------------- 2 files changed, 474 deletions(-) delete mode 100644 .history/controllers/auth_20210512163011.js delete mode 100644 .history/controllers/auth_20210512170016.js diff --git a/.history/controllers/auth_20210512163011.js b/.history/controllers/auth_20210512163011.js deleted file mode 100644 index 5884d9e..0000000 --- a/.history/controllers/auth_20210512163011.js +++ /dev/null @@ -1,237 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Email verification Ends -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210512170016.js b/.history/controllers/auth_20210512170016.js deleted file mode 100644 index 92e390f..0000000 --- a/.history/controllers/auth_20210512170016.js +++ /dev/null @@ -1,237 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); -const nodemailer = require("nodemailer"); - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - res.json({ - message: "Successfully signed Up", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - try { - const { phoneNumber } = req.body; - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", //replace it with the companies mail - pass: "a510d3d969d3b3", //replace it with the companies pass - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Token Saved and link is active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Email verification Ends -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; From f1c5ba4b2bdaacbacbf7e1bca5a39d973d077d13 Mon Sep 17 00:00:00 2001 From: yashraj verma Date: Wed, 12 May 2021 17:18:25 +0530 Subject: [PATCH 20/39] Push Emails added --- controllers/auth.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index 807b04e..92e390f 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -79,6 +79,9 @@ module.exports.postSignin = async (req, res, next) => { } }; +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + module.exports.sendOTP = (req, res, next) => { //uNNYosMopvvCW9RTR1tRWJmYC test //llVKD53ve6QRpbCKOHzWBADaS live @@ -111,8 +114,8 @@ module.exports.sendOTP = (req, res, next) => { module.exports.getOTP = (req, res, next) => { try { - const { id, token } = req.body; - messagebird.verify.verify(id, token, function (err, response) { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { if (err) { console.log({ error: err.errors[0].description, id: id }); res.json({ error: err.errors[0].description, id: id }); @@ -125,16 +128,22 @@ module.exports.getOTP = (req, res, next) => { console.log(err); } }; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Email verification Starts + var transport = nodemailer.createTransport({ - host: "smtp.mailtrap.io", - port: 2525, + service: "gmail", auth: { - user: "5578544cc56856", - pass: "a510d3d969d3b3", + user: "5578544cc56856", //replace it with the companies mail + pass: "a510d3d969d3b3", //replace it with the companies pass }, }); module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + const { email, link, _html, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token try { await User.findOne({ email }).then((user) => { if (!user) { @@ -180,7 +189,6 @@ module.exports.forgotpassword = async (req, res, next) => { console.log("Error from forgot pass", error); }; } - //verify email then set password. }; module.exports.resetpassword = async (req, res, next) => { const { _id, token } = req.params; @@ -217,6 +225,9 @@ module.exports.resetpassword = async (req, res, next) => { } }; +// Email verification Ends +// ----------------------------------------------------------------------------------------------- + module.exports.checkProtected = (req, res, next) => { console.log(req.user); res.json({ From ef4c9b6a526e0ef10b94f271654809ce636d8ab0 Mon Sep 17 00:00:00 2001 From: yashraj verma Date: Wed, 12 May 2021 17:19:42 +0530 Subject: [PATCH 21/39] done --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 217a4fa..43635e8 100644 --- a/app.js +++ b/app.js @@ -18,7 +18,7 @@ const cors = require("cors"); const app = express(); -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; +const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; app.use(cors()); app.use(bodyparser.json()); From 803a68f3e0eae467da6591bd4aada1edbf94174f Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Sun, 16 May 2021 16:01:39 +0530 Subject: [PATCH 22/39] Added Verify Email, Send OTP , GET OTP , Forgot password , Reset Password --- controllers/auth.js | 245 ++- models/User.js | 6 +- package-lock.json | 2234 +++++++++++++++++++++- package.json | 7 +- routes/auth.js | 2 +- views/images/Icon feather-lock.png | Bin 0 -> 1291 bytes views/images/Icon material-copyright.png | Bin 0 -> 537 bytes views/images/Rectangle 1048.png | Bin 0 -> 5948 bytes views/images/certificate design-11.png | Bin 0 -> 4928 bytes views/reset.css | 66 + views/reset.html | 147 ++ 11 files changed, 2651 insertions(+), 56 deletions(-) create mode 100644 views/images/Icon feather-lock.png create mode 100644 views/images/Icon material-copyright.png create mode 100644 views/images/Rectangle 1048.png create mode 100644 views/images/certificate design-11.png create mode 100644 views/reset.css create mode 100644 views/reset.html diff --git a/controllers/auth.js b/controllers/auth.js index 92e390f..a661619 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -3,8 +3,26 @@ const User = require("../models/User"); const Student = require("../models/Student"); const jwt = require("jsonwebtoken"); const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS"); +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ + "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", +]); const nodemailer = require("nodemailer"); +const smtpTransport = require("nodemailer-smtp-transport"); + +// -------------------------------------------- mail transporter ----------------------------------------- + +var transport = nodemailer.createTransport( + smtpTransport({ + host: "email-smtp.us-east-1.amazonaws.com", //`${process.env.HOST}` + port: 465, + auth: { + user: "AKIA2G7743RRTZMVXE3X", //`${process.env.EMAIL}` + pass: "BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c", //`${process.env.PASS}` + }, + }) +); + +// -------------------------------------------- mail transporter ----------------------------------------- module.exports.Protected = async (req, res, next) => { res.send("Hello User"); @@ -14,8 +32,7 @@ module.exports.postSignup = async (req, res, next) => { //we need firstName , lastName , email , password as input let firstName = req.body.firstName || " "; let lastName = req.body.lastName || " "; - let email = req.body.email; - let password = req.body.password; + const { sending_company_email, email, password, subject, _html } = req.body; let user = await User.findOne({ email: email }); if (user) { res.json({ @@ -23,6 +40,8 @@ module.exports.postSignup = async (req, res, next) => { type: "error", }); } else { + const email_otp = Math.floor(100000 + Math.random() * 900000); + console.log("otp", email_otp); const hashedPass = await bcrypt.hash(password, 12); user = new User({ firstName: firstName, @@ -30,6 +49,7 @@ module.exports.postSignup = async (req, res, next) => { email: email, password: hashedPass, isAdmin: false, + email_otp, }); user = await user.save(); await Student.deleteOne({ user: user._id }); @@ -39,8 +59,21 @@ module.exports.postSignup = async (req, res, next) => { student = await student.save(); user.student = student._id; await user.save(); + const message = { + from: `${sending_company_email}`, // Sender address + to: `${email}`, // List of recipients + subject: `${subject}`, // Subject line + html: `${_html}`, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); res.json({ - message: "Successfully signed Up", + message: "OTP has sent to the Email", type: "success", }); } @@ -49,6 +82,43 @@ module.exports.postSignup = async (req, res, next) => { } }; +module.exports.verfiyemail = async (req, res, next) => { + const { email, otp } = req.body; + try { + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await (user.email_otp == otp ? true : false); + if (isMatched) { + if (!user.isVerified) { + user.isVerified = true; + await user.save(); + res.json({ + message: "User Verified, Please Login", + }); + } else { + res.json({ + message: "User Already Verified, Please Login", + }); + } + } else { + res.json({ + message: "OTP Doesn't Matched!", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch { + (err) => { + console.log(err); + }; + } +}; + module.exports.postSignin = async (req, res, next) => { try { //we need email and password as input @@ -85,8 +155,8 @@ module.exports.postSignin = async (req, res, next) => { module.exports.sendOTP = (req, res, next) => { //uNNYosMopvvCW9RTR1tRWJmYC test //llVKD53ve6QRpbCKOHzWBADaS live + const { phoneNumber } = req.body; try { - const { phoneNumber } = req.body; if (!phoneNumber) { res.status(422).json({ message: "Please Add All Required Fields" }); return; @@ -132,17 +202,10 @@ module.exports.getOTP = (req, res, next) => { // ----------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------- -// Email verification Starts +// Forgot password Starts -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", //replace it with the companies mail - pass: "a510d3d969d3b3", //replace it with the companies pass - }, -}); module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; + const { email, link, sending_company_email, subject } = req.body; //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token try { await User.findOne({ email }).then((user) => { @@ -161,11 +224,159 @@ module.exports.forgotpassword = async (req, res, next) => { }) .then((data) => { const reset_link = `${link}/${user._id}/${token}`; + const message = { from: `${sending_company_email}`, // Sender address to: `${user.email}`, // List of recipients subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. + html: ` + + + + + Forgot password + + + + + + + + + +
+
+
+
+ +
+
+
+

Hello

+
+

+ We got a request to reset your Password. No need to worry you can + reset your Password by clicking the Reset Button. +

+ + +
+

+ Facing any other issue write us at + info@cantileverlabs.com +

+
+ +
+ +
+
+

Privacy Policy | Terms of Use | Contact us

+
+
+
+ + copyright + 2018 Cantilever Labs +
+
+
+
+ + + + + + `, // design html for email message. }; transport.sendMail(message, function (err, info) { if (err) { @@ -175,7 +386,7 @@ module.exports.forgotpassword = async (req, res, next) => { } }); res.status(200).json({ - message: "Token Saved and link is active for 10 mins", + message: "Link is Active for 10 mins", reset_link, }); }) @@ -225,7 +436,7 @@ module.exports.resetpassword = async (req, res, next) => { } }; -// Email verification Ends +// Forgot password Ends // ----------------------------------------------------------------------------------------------- module.exports.checkProtected = (req, res, next) => { diff --git a/models/User.js b/models/User.js index a9efe6e..116ec6d 100644 --- a/models/User.js +++ b/models/User.js @@ -28,9 +28,13 @@ const userSchema = new Schema({ isAdmin: { type: Boolean, }, - otp: { + email_otp: { type: String, }, + isVerified: { + type: Boolean, + default: false, + }, passwordResetToken: String, passwordResetExpires: Date, //need to add isAdmin diff --git a/package-lock.json b/package-lock.json index 15bf75a..7e74e2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "aws-sdk": "^2.907.0", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", "cookie-session": "^1.4.0", @@ -16,10 +17,14 @@ "crypto": "^1.0.1", "dotenv": "^9.0.1", "express": "^4.17.1", + "grandjs": "^2.2.30", + "handlebars": "^4.7.7", "jsonwebtoken": "^8.5.1", "messagebird": "^3.6.1", "mongoose": "^5.12.2", "nodemailer": "^6.6.0", + "nodemailer-express-handlebars": "^4.0.0", + "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", "razorpay": "^2.0.6", @@ -29,6 +34,413 @@ "nodemon": "^2.0.7" } }, + "node_modules/@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "dependencies": { + "@babel/highlight": "^7.12.13" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.14.0.tgz", + "integrity": "sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q==" + }, + "node_modules/@babel/core": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.14.2.tgz", + "integrity": "sha512-OgC1mON+l4U4B4wiohJlQNUU3H73mpTyYY3j/c8U9dr9UagGGSm+WFpzjy/YLdoyjiG++c1kIDgxCo/mLwQJeQ==", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@babel/generator": "^7.14.2", + "@babel/helper-compilation-targets": "^7.13.16", + "@babel/helper-module-transforms": "^7.14.2", + "@babel/helpers": "^7.14.0", + "@babel/parser": "^7.14.2", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.14.2", + "@babel/types": "^7.14.2", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.2.tgz", + "integrity": "sha512-OnADYbKrffDVai5qcpkMxQ7caomHOoEwjkouqnN2QhydAjowFAZcsdecFIRUBdb+ZcruwYE4ythYmF1UBZU5xQ==", + "dependencies": { + "@babel/types": "^7.14.2", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz", + "integrity": "sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==", + "dependencies": { + "@babel/types": "^7.12.13" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.13.16", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.16.tgz", + "integrity": "sha512-3gmkYIrpqsLlieFwjkGgLaSHmhnvlAYzZLlYVjlW+QwI+1zE17kGxuJGmIqDQdYp56XdmGeD+Bswx0UTyG18xA==", + "dependencies": { + "@babel/compat-data": "^7.13.15", + "@babel/helper-validator-option": "^7.12.17", + "browserslist": "^4.14.5", + "semver": "^6.3.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz", + "integrity": "sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==", + "dependencies": { + "@babel/helper-get-function-arity": "^7.12.13", + "@babel/template": "^7.12.13", + "@babel/types": "^7.14.2" + } + }, + "node_modules/@babel/helper-get-function-arity": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", + "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "dependencies": { + "@babel/types": "^7.12.13" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz", + "integrity": "sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==", + "dependencies": { + "@babel/types": "^7.13.12" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz", + "integrity": "sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==", + "dependencies": { + "@babel/types": "^7.13.12" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.14.2.tgz", + "integrity": "sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA==", + "dependencies": { + "@babel/helper-module-imports": "^7.13.12", + "@babel/helper-replace-supers": "^7.13.12", + "@babel/helper-simple-access": "^7.13.12", + "@babel/helper-split-export-declaration": "^7.12.13", + "@babel/helper-validator-identifier": "^7.14.0", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.14.2", + "@babel/types": "^7.14.2" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz", + "integrity": "sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==", + "dependencies": { + "@babel/types": "^7.12.13" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz", + "integrity": "sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==" + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.13.12.tgz", + "integrity": "sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw==", + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.13.12", + "@babel/helper-optimise-call-expression": "^7.12.13", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.12" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz", + "integrity": "sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==", + "dependencies": { + "@babel/types": "^7.13.12" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", + "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "dependencies": { + "@babel/types": "^7.12.13" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", + "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==" + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.12.17", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz", + "integrity": "sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==" + }, + "node_modules/@babel/helpers": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.14.0.tgz", + "integrity": "sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg==", + "dependencies": { + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.14.0", + "@babel/types": "^7.14.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", + "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.14.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/@babel/parser": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.2.tgz", + "integrity": "sha512-IoVDIHpsgE/fu7eXBeRWt8zLbDrSvD7H1gpomOkPpBoEN8KCruCqSDdqo8dddwQQrui30KSvQBaMUOJiuFu6QQ==", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-proposal-object-rest-spread": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.14.2.tgz", + "integrity": "sha512-hBIQFxwZi8GIp934+nj5uV31mqclC1aYDhctDu5khTi9PCCUOczyy0b34W0oE9U/eJXiqQaKyVsmjeagOaSlbw==", + "dependencies": { + "@babel/compat-data": "^7.14.0", + "@babel/helper-compilation-targets": "^7.13.16", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.13.tgz", + "integrity": "sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.13.17", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.13.17.tgz", + "integrity": "sha512-UAUqiLv+uRLO+xuBKKMEpC+t7YRNVRqBsWWq1yKXbBZBje/t3IXCiSinZhjn/DC3qzBfICeYd2EFGEbHsh5RLA==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.13.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.14.2.tgz", + "integrity": "sha512-NxoVmA3APNCC1JdMXkdYXuQS+EMdqy0vIwyDHeKHiJKRxmp1qGSdb0JLEIoPRhkx6H/8Qi3RJ3uqOCYw8giy9A==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.13.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.13.12.tgz", + "integrity": "sha512-jcEI2UqIcpCqB5U5DRxIl0tQEProI2gcu+g8VTIqxLO5Iidojb4d77q+fwGseCvd8af/lJ9masp4QWzBXFE2xA==", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.12.13", + "@babel/helper-module-imports": "^7.13.12", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-jsx": "^7.12.13", + "@babel/types": "^7.13.12" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", + "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@babel/parser": "^7.12.13", + "@babel/types": "^7.12.13" + } + }, + "node_modules/@babel/traverse": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.2.tgz", + "integrity": "sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@babel/generator": "^7.14.2", + "@babel/helper-function-name": "^7.14.2", + "@babel/helper-split-export-declaration": "^7.12.13", + "@babel/parser": "^7.14.2", + "@babel/types": "^7.14.2", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "node_modules/@babel/traverse/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/traverse/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/@babel/types": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.2.tgz", + "integrity": "sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.14.0", + "to-fast-properties": "^2.0.0" + } + }, "node_modules/@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -58,6 +470,11 @@ "@types/node": "*" } }, + "node_modules/@types/cors": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", + "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" + }, "node_modules/@types/mongodb": { "version": "3.6.10", "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.10.tgz", @@ -67,11 +484,27 @@ "@types/node": "*" } }, + "node_modules/@types/multiparty": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/multiparty/-/multiparty-0.0.32.tgz", + "integrity": "sha512-zuQEcL9pHiW3u1fgkOWE6T/RwskrFZ3W63aKQPDs7EokIjtbsGL7aVlI4tI86qjL4B3hcFxDRtIGxwRwMTS2Dw==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/node": { "version": "14.14.35", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.35.tgz", "integrity": "sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==" }, + "node_modules/@types/type-is": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@types/type-is/-/type-is-1.6.3.tgz", + "integrity": "sha512-PNs5wHaNcBgCQG5nAeeZ7OvosrEsI9O4W2jAOO9BCCg4ux9ZZvH2+0iSCOIDBiKuQsiNS8CBlmfX9f5YBQ22cA==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -189,6 +622,34 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, + "node_modules/aws-sdk": { + "version": "2.907.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.907.0.tgz", + "integrity": "sha512-P1gth8sVqXCIjKN78kyD3OosEzqUSYxDG04Cpp2wVGx/djsd5OSv4NkayOhKZ5OMXwk6IdA82oXV/HQR8EjbwQ==", + "hasInstallScript": true, + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/aws-sdk/node_modules/uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -205,8 +666,26 @@ "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, "node_modules/base64url": { "version": "3.0.1", @@ -295,7 +774,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -313,6 +791,28 @@ "node": ">=8" } }, + "node_modules/browserslist": { + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", + "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", + "dependencies": { + "caniuse-lite": "^1.0.30001219", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.723", + "escalade": "^3.1.1", + "node-releases": "^1.1.71" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, "node_modules/bson": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", @@ -321,6 +821,16 @@ "node": ">=0.6.19" } }, + "node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, "node_modules/buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", @@ -373,6 +883,48 @@ "node": ">=8" } }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "dependencies": { + "callsites": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "dependencies": { + "caller-callsite": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "engines": { + "node": ">=4" + } + }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -382,6 +934,15 @@ "node": ">=6" } }, + "node_modules/caniuse-lite": { + "version": "1.0.30001228", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz", + "integrity": "sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -484,6 +1045,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -495,11 +1061,15 @@ "node": ">= 0.8" } }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "node_modules/configstore": { "version": "5.0.1", @@ -537,6 +1107,14 @@ "node": ">= 0.6" } }, + "node_modules/convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, "node_modules/cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", @@ -734,6 +1312,11 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "node_modules/electron-to-chromium": { + "version": "1.3.727", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.727.tgz", + "integrity": "sha512-Mfz4FIB4FSvEwBpDfdipRIrwd6uo8gUDoRDF4QEYb4h4tSuI3ov594OrjU6on042UlFHouIJpClDODGkPcBSbg==" + }, "node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -757,6 +1340,14 @@ "once": "^1.4.0" } }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", @@ -771,6 +1362,14 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -779,6 +1378,14 @@ "node": ">= 0.6" } }, + "node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/express": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", @@ -819,6 +1426,19 @@ "node": ">= 0.10.0" } }, + "node_modules/express-handlebars": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-4.0.6.tgz", + "integrity": "sha512-SWwmp4ERN/hPySdRnQYiNcJP/LHAeTz1qq0MXQ2ztZiMC6sKw1WathtVWWY+AUPkjV6eDmQXqybJQwnUsoI9vw==", + "dependencies": { + "glob": "^7.1.6", + "graceful-fs": "^4.2.4", + "handlebars": "^4.7.6" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -871,6 +1491,34 @@ "node": ">= 0.8" } }, + "node_modules/find-cache-dir": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -908,6 +1556,11 @@ "node": ">= 0.6" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -921,6 +1574,32 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -941,6 +1620,25 @@ "assert-plus": "^1.0.0" } }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -965,6 +1663,14 @@ "node": ">=8" } }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "engines": { + "node": ">=4" + } + }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -990,8 +1696,76 @@ "node_modules/graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "node_modules/grandjs": { + "version": "2.2.30", + "resolved": "https://registry.npmjs.org/grandjs/-/grandjs-2.2.30.tgz", + "integrity": "sha512-exiKrEI/67XiYn1hsp5DquCpy0KabnbLjTXUWxO1yHimmW0KgMlPrDN4cenLCPOEMs800jjnhvQK+TuLw7nb2A==", + "dependencies": { + "@types/cors": "*", + "@types/multiparty": "*", + "@types/type-is": "^1.6.3", + "accepts": "^1.3.7", + "content-type": "^1.0.4", + "cors": "^2.8.5", + "import-jsx": "^4.0.0", + "multiparty": "^4.2.1", + "proxy-addr": "^2.0.6", + "qs": "^6.9.3", + "range-parser": "^1.2.1", + "send": "^0.17.1", + "setprototypeof": "^1.2.0", + "type-is": "^1.6.18", + "url-pattern": "^1.0.3" + } + }, + "node_modules/grandjs/node_modules/qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/grandjs/node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } }, "node_modules/har-schema": { "version": "2.0.0", @@ -1013,15 +1787,36 @@ "node": ">=6" } }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, "engines": { "node": ">=4" } }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", @@ -1066,6 +1861,26 @@ "npm": ">=1.3.7" } }, + "node_modules/httpntlm": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.6.1.tgz", + "integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=", + "dependencies": { + "httpreq": ">=0.4.22", + "underscore": "~1.7.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/httpreq": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz", + "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8=", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -1077,12 +1892,44 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, + "node_modules/import-jsx": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-jsx/-/import-jsx-4.0.0.tgz", + "integrity": "sha512-CnjJ2BZFJzbFDmYG5S47xPQjMlSbZLyLJuG4znzL4TdPtJBxHtFP1xVmR+EYX4synFSldiY3B6m00XkPM3zVnA==", + "dependencies": { + "@babel/core": "^7.5.5", + "@babel/plugin-proposal-object-rest-spread": "^7.5.5", + "@babel/plugin-transform-destructuring": "^7.5.0", + "@babel/plugin-transform-react-jsx": "^7.3.0", + "caller-path": "^2.0.0", + "find-cache-dir": "^3.2.0", + "make-dir": "^3.0.2", + "resolve-from": "^3.0.0", + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/import-jsx/node_modules/resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "engines": { + "node": ">=4" + } + }, "node_modules/import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", @@ -1101,6 +1948,15 @@ "node": ">=0.8.19" } }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -1244,11 +2100,35 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "node_modules/jmespath": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", + "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, "node_modules/jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -1270,6 +2150,20 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "node_modules/json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/jsonwebtoken": { "version": "8.5.1", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", @@ -1366,6 +2260,17 @@ "node": ">=8" } }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1419,7 +2324,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, "dependencies": { "semver": "^6.0.0" }, @@ -1431,7 +2335,6 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, "bin": { "semver": "bin/semver.js" } @@ -1537,7 +2440,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1548,8 +2450,7 @@ "node_modules/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "node_modules/mongodb": { "version": "3.6.5", @@ -1642,6 +2543,63 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "node_modules/multiparty": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", + "integrity": "sha512-NtZLjlvsjcoGrzojtwQwn/Tm90aWJ6XXtPppYF4WmOk/6ncdwMMKggFY2NlRRN9yiCEIVxpOfPWahVEG2HAG8Q==", + "dependencies": { + "http-errors": "~1.8.0", + "safe-buffer": "5.2.1", + "uid-safe": "2.1.5" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/multiparty/node_modules/http-errors": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", + "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multiparty/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/multiparty/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/multiparty/node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, "node_modules/nanoid": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", @@ -1655,6 +2613,16 @@ "node": ">= 0.6" } }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node_modules/node-releases": { + "version": "1.1.71", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", + "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" + }, "node_modules/nodemailer": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", @@ -1663,6 +2631,42 @@ "node": ">=6.0.0" } }, + "node_modules/nodemailer-express-handlebars": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/nodemailer-express-handlebars/-/nodemailer-express-handlebars-4.0.0.tgz", + "integrity": "sha512-oUYl2D1AkFNwRe7RXt8iNTtmQGmI4Bt4PXRkE9lX891FHNNUB3I5yRDGL1WQPOujYIHH79uAvD3QzsBStG4SFA==", + "dependencies": { + "express-handlebars": "^4.0.0" + } + }, + "node_modules/nodemailer-fetch": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz", + "integrity": "sha1-ecSQihwPXzdbc/6IjamCj23JY6Q=" + }, + "node_modules/nodemailer-shared": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/nodemailer-shared/-/nodemailer-shared-1.1.0.tgz", + "integrity": "sha1-z1mU4v0mjQD1zw+nZ6CBae2wfsA=", + "dependencies": { + "nodemailer-fetch": "1.6.0" + } + }, + "node_modules/nodemailer-smtp-transport": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-2.7.4.tgz", + "integrity": "sha1-DYmvAZoUSkgP2OzJmZfZ+DjxNoU=", + "dependencies": { + "nodemailer-shared": "1.1.0", + "nodemailer-wellknown": "0.1.10", + "smtp-connection": "2.12.0" + } + }, + "node_modules/nodemailer-wellknown": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/nodemailer-wellknown/-/nodemailer-wellknown-0.1.10.tgz", + "integrity": "sha1-WG24EB2zDLRDjrVGc3pBqtDPE9U=" + }, "node_modules/nodemon": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", @@ -1754,6 +2758,14 @@ "node": ">=0.10.0" } }, + "node_modules/object-inspect": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -1777,7 +2789,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "dependencies": { "wrappy": "1" } @@ -1791,6 +2802,39 @@ "node": ">=6" } }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/package-json": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", @@ -1902,6 +2946,22 @@ "node": ">= 0.4.0" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -1926,6 +2986,17 @@ "node": ">=8.6" } }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -2009,6 +3080,22 @@ "node": ">=0.6" } }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/random-bytes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -2200,6 +3287,20 @@ "lowercase-keys": "^1.0.0" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -2222,6 +3323,11 @@ "node": ">=6" } }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, "node_modules/scmp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", @@ -2311,6 +3417,19 @@ "nanoid": "^2.1.0" } }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/sift": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/sift/-/sift-7.0.1.tgz", @@ -2327,6 +3446,23 @@ "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" }, + "node_modules/smtp-connection": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", + "integrity": "sha1-1275EnyyPCJZ7bHoNJwujV4tdME=", + "dependencies": { + "httpntlm": "1.6.1", + "nodemailer-shared": "1.1.0" + } + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/sparse-bitfield": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", @@ -2454,7 +3590,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -2471,6 +3606,14 @@ "node": ">=8" } }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "engines": { + "node": ">=4" + } + }, "node_modules/to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", @@ -2578,6 +3721,29 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/uglify-js": { + "version": "3.13.6", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.6.tgz", + "integrity": "sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/uid-safe": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", + "dependencies": { + "random-bytes": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/uid2": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", @@ -2592,6 +3758,11 @@ "debug": "^2.2.0" } }, + "node_modules/underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" + }, "node_modules/unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", @@ -2644,6 +3815,15 @@ "punycode": "^2.1.0" } }, + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, "node_modules/url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -2656,6 +3836,19 @@ "node": ">=4" } }, + "node_modules/url-pattern": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/url-pattern/-/url-pattern-1.0.3.tgz", + "integrity": "sha1-BAkpJHGyTyPFDWWkeTF5PStaz8E=", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/url/node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2710,11 +3903,15 @@ "node": ">=8" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/write-file-atomic": { "version": "3.0.3", @@ -2736,9 +3933,379 @@ "engines": { "node": ">=8" } + }, + "node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "engines": { + "node": ">=4.0" + } } }, "dependencies": { + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/compat-data": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.14.0.tgz", + "integrity": "sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q==" + }, + "@babel/core": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.14.2.tgz", + "integrity": "sha512-OgC1mON+l4U4B4wiohJlQNUU3H73mpTyYY3j/c8U9dr9UagGGSm+WFpzjy/YLdoyjiG++c1kIDgxCo/mLwQJeQ==", + "requires": { + "@babel/code-frame": "^7.12.13", + "@babel/generator": "^7.14.2", + "@babel/helper-compilation-targets": "^7.13.16", + "@babel/helper-module-transforms": "^7.14.2", + "@babel/helpers": "^7.14.0", + "@babel/parser": "^7.14.2", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.14.2", + "@babel/types": "^7.14.2", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "@babel/generator": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.2.tgz", + "integrity": "sha512-OnADYbKrffDVai5qcpkMxQ7caomHOoEwjkouqnN2QhydAjowFAZcsdecFIRUBdb+ZcruwYE4ythYmF1UBZU5xQ==", + "requires": { + "@babel/types": "^7.14.2", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz", + "integrity": "sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==", + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.13.16", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.16.tgz", + "integrity": "sha512-3gmkYIrpqsLlieFwjkGgLaSHmhnvlAYzZLlYVjlW+QwI+1zE17kGxuJGmIqDQdYp56XdmGeD+Bswx0UTyG18xA==", + "requires": { + "@babel/compat-data": "^7.13.15", + "@babel/helper-validator-option": "^7.12.17", + "browserslist": "^4.14.5", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "@babel/helper-function-name": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz", + "integrity": "sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==", + "requires": { + "@babel/helper-get-function-arity": "^7.12.13", + "@babel/template": "^7.12.13", + "@babel/types": "^7.14.2" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", + "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz", + "integrity": "sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==", + "requires": { + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-module-imports": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz", + "integrity": "sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==", + "requires": { + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-module-transforms": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.14.2.tgz", + "integrity": "sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA==", + "requires": { + "@babel/helper-module-imports": "^7.13.12", + "@babel/helper-replace-supers": "^7.13.12", + "@babel/helper-simple-access": "^7.13.12", + "@babel/helper-split-export-declaration": "^7.12.13", + "@babel/helper-validator-identifier": "^7.14.0", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.14.2", + "@babel/types": "^7.14.2" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz", + "integrity": "sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==", + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz", + "integrity": "sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==" + }, + "@babel/helper-replace-supers": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.13.12.tgz", + "integrity": "sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw==", + "requires": { + "@babel/helper-member-expression-to-functions": "^7.13.12", + "@babel/helper-optimise-call-expression": "^7.12.13", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-simple-access": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz", + "integrity": "sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==", + "requires": { + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", + "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", + "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==" + }, + "@babel/helper-validator-option": { + "version": "7.12.17", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz", + "integrity": "sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==" + }, + "@babel/helpers": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.14.0.tgz", + "integrity": "sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg==", + "requires": { + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.14.0", + "@babel/types": "^7.14.0" + } + }, + "@babel/highlight": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", + "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", + "requires": { + "@babel/helper-validator-identifier": "^7.14.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + } + } + }, + "@babel/parser": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.2.tgz", + "integrity": "sha512-IoVDIHpsgE/fu7eXBeRWt8zLbDrSvD7H1gpomOkPpBoEN8KCruCqSDdqo8dddwQQrui30KSvQBaMUOJiuFu6QQ==" + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.14.2.tgz", + "integrity": "sha512-hBIQFxwZi8GIp934+nj5uV31mqclC1aYDhctDu5khTi9PCCUOczyy0b34W0oE9U/eJXiqQaKyVsmjeagOaSlbw==", + "requires": { + "@babel/compat-data": "^7.14.0", + "@babel/helper-compilation-targets": "^7.13.16", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.14.2" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.13.tgz", + "integrity": "sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==", + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.13.17", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.13.17.tgz", + "integrity": "sha512-UAUqiLv+uRLO+xuBKKMEpC+t7YRNVRqBsWWq1yKXbBZBje/t3IXCiSinZhjn/DC3qzBfICeYd2EFGEbHsh5RLA==", + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.14.2.tgz", + "integrity": "sha512-NxoVmA3APNCC1JdMXkdYXuQS+EMdqy0vIwyDHeKHiJKRxmp1qGSdb0JLEIoPRhkx6H/8Qi3RJ3uqOCYw8giy9A==", + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-react-jsx": { + "version": "7.13.12", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.13.12.tgz", + "integrity": "sha512-jcEI2UqIcpCqB5U5DRxIl0tQEProI2gcu+g8VTIqxLO5Iidojb4d77q+fwGseCvd8af/lJ9masp4QWzBXFE2xA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.12.13", + "@babel/helper-module-imports": "^7.13.12", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-jsx": "^7.12.13", + "@babel/types": "^7.13.12" + } + }, + "@babel/template": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", + "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "requires": { + "@babel/code-frame": "^7.12.13", + "@babel/parser": "^7.12.13", + "@babel/types": "^7.12.13" + } + }, + "@babel/traverse": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.2.tgz", + "integrity": "sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==", + "requires": { + "@babel/code-frame": "^7.12.13", + "@babel/generator": "^7.14.2", + "@babel/helper-function-name": "^7.14.2", + "@babel/helper-split-export-declaration": "^7.12.13", + "@babel/parser": "^7.14.2", + "@babel/types": "^7.14.2", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@babel/types": { + "version": "7.14.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.2.tgz", + "integrity": "sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==", + "requires": { + "@babel/helper-validator-identifier": "^7.14.0", + "to-fast-properties": "^2.0.0" + } + }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -2762,6 +4329,11 @@ "@types/node": "*" } }, + "@types/cors": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", + "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" + }, "@types/mongodb": { "version": "3.6.10", "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.10.tgz", @@ -2771,11 +4343,27 @@ "@types/node": "*" } }, + "@types/multiparty": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/multiparty/-/multiparty-0.0.32.tgz", + "integrity": "sha512-zuQEcL9pHiW3u1fgkOWE6T/RwskrFZ3W63aKQPDs7EokIjtbsGL7aVlI4tI86qjL4B3hcFxDRtIGxwRwMTS2Dw==", + "requires": { + "@types/node": "*" + } + }, "@types/node": { "version": "14.14.35", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.35.tgz", "integrity": "sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==" }, + "@types/type-is": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@types/type-is/-/type-is-1.6.3.tgz", + "integrity": "sha512-PNs5wHaNcBgCQG5nAeeZ7OvosrEsI9O4W2jAOO9BCCg4ux9ZZvH2+0iSCOIDBiKuQsiNS8CBlmfX9f5YBQ22cA==", + "requires": { + "@types/node": "*" + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -2877,6 +4465,29 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, + "aws-sdk": { + "version": "2.907.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.907.0.tgz", + "integrity": "sha512-P1gth8sVqXCIjKN78kyD3OosEzqUSYxDG04Cpp2wVGx/djsd5OSv4NkayOhKZ5OMXwk6IdA82oXV/HQR8EjbwQ==", + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "dependencies": { + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + } + } + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -2890,8 +4501,12 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "base64url": { "version": "3.0.1", @@ -2968,7 +4583,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2983,11 +4597,33 @@ "fill-range": "^7.0.1" } }, + "browserslist": { + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", + "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", + "requires": { + "caniuse-lite": "^1.0.30001219", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.723", + "escalade": "^3.1.1", + "node-releases": "^1.1.71" + } + }, "bson": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==" }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, "buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", @@ -3030,12 +4666,47 @@ } } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=" + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, + "caniuse-lite": { + "version": "1.0.30001228", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz", + "integrity": "sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==" + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -3120,6 +4791,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -3128,11 +4804,15 @@ "delayed-stream": "~1.0.0" } }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "configstore": { "version": "5.0.1", @@ -3161,6 +4841,14 @@ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "requires": { + "safe-buffer": "~5.1.1" + } + }, "cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", @@ -3321,6 +5009,11 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "electron-to-chromium": { + "version": "1.3.727", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.727.tgz", + "integrity": "sha512-Mfz4FIB4FSvEwBpDfdipRIrwd6uo8gUDoRDF4QEYb4h4tSuI3ov594OrjU6on042UlFHouIJpClDODGkPcBSbg==" + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -3341,6 +5034,11 @@ "once": "^1.4.0" } }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, "escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", @@ -3352,11 +5050,21 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" + }, "express": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", @@ -3394,6 +5102,16 @@ "vary": "~1.1.2" } }, + "express-handlebars": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-4.0.6.tgz", + "integrity": "sha512-SWwmp4ERN/hPySdRnQYiNcJP/LHAeTz1qq0MXQ2ztZiMC6sKw1WathtVWWY+AUPkjV6eDmQXqybJQwnUsoI9vw==", + "requires": { + "glob": "^7.1.6", + "graceful-fs": "^4.2.4", + "handlebars": "^4.7.6" + } + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -3437,6 +5155,25 @@ "unpipe": "~1.0.0" } }, + "find-cache-dir": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -3462,6 +5199,11 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, "fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -3469,6 +5211,26 @@ "dev": true, "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -3486,6 +5248,19 @@ "assert-plus": "^1.0.0" } }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -3504,6 +5279,11 @@ "ini": "1.3.7" } }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -3526,8 +5306,63 @@ "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "grandjs": { + "version": "2.2.30", + "resolved": "https://registry.npmjs.org/grandjs/-/grandjs-2.2.30.tgz", + "integrity": "sha512-exiKrEI/67XiYn1hsp5DquCpy0KabnbLjTXUWxO1yHimmW0KgMlPrDN4cenLCPOEMs800jjnhvQK+TuLw7nb2A==", + "requires": { + "@types/cors": "*", + "@types/multiparty": "*", + "@types/type-is": "^1.6.3", + "accepts": "^1.3.7", + "content-type": "^1.0.4", + "cors": "^2.8.5", + "import-jsx": "^4.0.0", + "multiparty": "^4.2.1", + "proxy-addr": "^2.0.6", + "qs": "^6.9.3", + "range-parser": "^1.2.1", + "send": "^0.17.1", + "setprototypeof": "^1.2.0", + "type-is": "^1.6.18", + "url-pattern": "^1.0.3" + }, + "dependencies": { + "qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + } + } + }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } }, "har-schema": { "version": "2.0.0", @@ -3543,11 +5378,23 @@ "har-schema": "^2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" }, "has-yarn": { "version": "2.1.0", @@ -3583,6 +5430,20 @@ "sshpk": "^1.7.0" } }, + "httpntlm": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.6.1.tgz", + "integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=", + "requires": { + "httpreq": ">=0.4.22", + "underscore": "~1.7.0" + } + }, + "httpreq": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz", + "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8=" + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3591,12 +5452,40 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, + "import-jsx": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-jsx/-/import-jsx-4.0.0.tgz", + "integrity": "sha512-CnjJ2BZFJzbFDmYG5S47xPQjMlSbZLyLJuG4znzL4TdPtJBxHtFP1xVmR+EYX4synFSldiY3B6m00XkPM3zVnA==", + "requires": { + "@babel/core": "^7.5.5", + "@babel/plugin-proposal-object-rest-spread": "^7.5.5", + "@babel/plugin-transform-destructuring": "^7.5.0", + "@babel/plugin-transform-react-jsx": "^7.3.0", + "caller-path": "^2.0.0", + "find-cache-dir": "^3.2.0", + "make-dir": "^3.0.2", + "resolve-from": "^3.0.0", + "rimraf": "^3.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + } + } + }, "import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", @@ -3609,6 +5498,15 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -3719,11 +5617,26 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "jmespath": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", + "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" + }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -3745,6 +5658,14 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "requires": { + "minimist": "^1.2.5" + } + }, "jsonwebtoken": { "version": "8.5.1", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", @@ -3830,6 +5751,14 @@ "package-json": "^6.3.0" } }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -3880,7 +5809,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, "requires": { "semver": "^6.0.0" }, @@ -3888,8 +5816,7 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" } } }, @@ -3958,7 +5885,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3966,8 +5892,7 @@ "minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "mongodb": { "version": "3.6.5", @@ -4050,6 +5975,45 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "multiparty": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", + "integrity": "sha512-NtZLjlvsjcoGrzojtwQwn/Tm90aWJ6XXtPppYF4WmOk/6ncdwMMKggFY2NlRRN9yiCEIVxpOfPWahVEG2HAG8Q==", + "requires": { + "http-errors": "~1.8.0", + "safe-buffer": "5.2.1", + "uid-safe": "2.1.5" + }, + "dependencies": { + "http-errors": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", + "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + } + } + }, "nanoid": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", @@ -4060,11 +6024,57 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node-releases": { + "version": "1.1.71", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", + "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" + }, "nodemailer": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", "integrity": "sha512-ikSMDU1nZqpo2WUPE0wTTw/NGGImTkwpJKDIFPZT+YvvR9Sj+ze5wzu95JHkBMglQLoG2ITxU21WukCC/XsFkg==" }, + "nodemailer-express-handlebars": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/nodemailer-express-handlebars/-/nodemailer-express-handlebars-4.0.0.tgz", + "integrity": "sha512-oUYl2D1AkFNwRe7RXt8iNTtmQGmI4Bt4PXRkE9lX891FHNNUB3I5yRDGL1WQPOujYIHH79uAvD3QzsBStG4SFA==", + "requires": { + "express-handlebars": "^4.0.0" + } + }, + "nodemailer-fetch": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz", + "integrity": "sha1-ecSQihwPXzdbc/6IjamCj23JY6Q=" + }, + "nodemailer-shared": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/nodemailer-shared/-/nodemailer-shared-1.1.0.tgz", + "integrity": "sha1-z1mU4v0mjQD1zw+nZ6CBae2wfsA=", + "requires": { + "nodemailer-fetch": "1.6.0" + } + }, + "nodemailer-smtp-transport": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-2.7.4.tgz", + "integrity": "sha1-DYmvAZoUSkgP2OzJmZfZ+DjxNoU=", + "requires": { + "nodemailer-shared": "1.1.0", + "nodemailer-wellknown": "0.1.10", + "smtp-connection": "2.12.0" + } + }, + "nodemailer-wellknown": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/nodemailer-wellknown/-/nodemailer-wellknown-0.1.10.tgz", + "integrity": "sha1-WG24EB2zDLRDjrVGc3pBqtDPE9U=" + }, "nodemon": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", @@ -4136,6 +6146,11 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "object-inspect": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==" + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -4153,7 +6168,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -4164,6 +6178,27 @@ "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, "package-json": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", @@ -4250,6 +6285,16 @@ "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", "integrity": "sha1-tVOaqPwiWj0a0XlHbd8ja0QPUuQ=" }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -4271,6 +6316,14 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "requires": { + "find-up": "^4.0.0" + } + }, "prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -4339,6 +6392,16 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, + "random-bytes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=" + }, "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -4499,6 +6562,14 @@ "lowercase-keys": "^1.0.0" } }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -4518,6 +6589,11 @@ "sparse-bitfield": "^3.0.3" } }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, "scmp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", @@ -4596,6 +6672,16 @@ "nanoid": "^2.1.0" } }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "sift": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/sift/-/sift-7.0.1.tgz", @@ -4612,6 +6698,20 @@ "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" }, + "smtp-connection": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", + "integrity": "sha1-1275EnyyPCJZ7bHoNJwujV4tdME=", + "requires": { + "httpntlm": "1.6.1", + "nodemailer-shared": "1.1.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, "sparse-bitfield": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", @@ -4714,7 +6814,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -4725,6 +6824,11 @@ "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", "dev": true }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + }, "to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", @@ -4805,6 +6909,20 @@ "is-typedarray": "^1.0.0" } }, + "uglify-js": { + "version": "3.13.6", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.6.tgz", + "integrity": "sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA==", + "optional": true + }, + "uid-safe": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", + "requires": { + "random-bytes": "~1.0.0" + } + }, "uid2": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", @@ -4819,6 +6937,11 @@ "debug": "^2.2.0" } }, + "underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" + }, "unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", @@ -4862,6 +6985,22 @@ "punycode": "^2.1.0" } }, + "url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + } + } + }, "url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -4871,6 +7010,11 @@ "prepend-http": "^2.0.0" } }, + "url-pattern": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/url-pattern/-/url-pattern-1.0.3.tgz", + "integrity": "sha1-BAkpJHGyTyPFDWWkeTF5PStaz8E=" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -4910,11 +7054,15 @@ "string-width": "^4.0.0" } }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "3.0.3", @@ -4933,6 +7081,20 @@ "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" } } } diff --git a/package.json b/package.json index 4ed182b..75b58db 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "cantilever-labs", "version": "1.0.0", "description": "", - "main": "index.js", + "main": "app.js", "scripts": { "start:dev": "nodemon app.js", "start": "node app.js" @@ -10,6 +10,7 @@ "author": "", "license": "ISC", "dependencies": { + "aws-sdk": "^2.907.0", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", "cookie-session": "^1.4.0", @@ -17,10 +18,14 @@ "crypto": "^1.0.1", "dotenv": "^9.0.1", "express": "^4.17.1", + "grandjs": "^2.2.30", + "handlebars": "^4.7.7", "jsonwebtoken": "^8.5.1", "messagebird": "^3.6.1", "mongoose": "^5.12.2", "nodemailer": "^6.6.0", + "nodemailer-express-handlebars": "^4.0.0", + "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", "razorpay": "^2.0.6", diff --git a/routes/auth.js b/routes/auth.js index 496e1e5..bd71d77 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -17,6 +17,6 @@ router.post("/forgotpassword", authController.forgotpassword); router.post("/resetpassword/:_id/:token", authController.resetpassword); -router.get("/resetpassword/:_id/:token", authController.resetpassword); +router.post("/verifyemail", authController.verfiyemail); module.exports = router; diff --git a/views/images/Icon feather-lock.png b/views/images/Icon feather-lock.png new file mode 100644 index 0000000000000000000000000000000000000000..190e5308d4e02ff9e4f5a5d43441eaa7113b1402 GIT binary patch literal 1291 zcmV+m1@!ufP)j)Ksd$p0z3iftw$MLJ^5~XXf+#toIw6L6%4BCJ)x{ z9bkMH#pXw%%kC$K2VihJ`VK#>bEs@zWvL#^L|Es#iqFrLgEfMKL-nXt|I#-?^6J{@(aVr%7f!zPGP$^$Ez_$pFpK}U>Xp!V0b`Wq7i;_ z4D{u^1I}6l>RS&}8*$bzV`4=wU~dz~U@lp$&orMxusJZs0>Q6f2sNz)*zMPVvy%i* zX`_eKrv^6@Fx-;)bQ4RI!W*iknh|9M*u&v@%u6^{nrf+OLWUX7=-2{?NZI6dX#zK7oSVo6&<+|XYY)z>;#MhQUlgt%v3V5t>1fvJx4V07&UN<0op z)lwvt_DQ*;QcP`A>VeShV~JxQLPp>{L-8b)Q96UV{eiUhVEp6r5`V^d&4Hnz#Ed%2 zr*~|zGW~4gqG*6&b4e==_tXO;QqeS$IDrwm63Y*UduPio1Dnz>`Unj2jN~juopE)&y0iNu~&jQk5hyTuvIBiSRidCh<}tTh8{BdNKMLZ z4#6mopb`8>>ODlI;`2Bm3I<0om=X-HIR>DKe9Nh?Rxqk-i`(F+>yKA|TA}j*AU0>n z8)BZKP$0y{d0-^*9~^$-FKz6H5bV_;aZ1kKU`RcJ%eskG1@QIGknFmwkWRwn~%Hu=ot};Fe|Qf(P$-548k*B#+HB9 z;KYb)enepS7XkSe0)xOvSX+^2gc@xK3!n>^_##TFp`&ZacT>D zp8R)PEK2El$UVD0#CC+HG&P4)Y-ehCojXbW3f|d0{KL*2HvKy<=3#(|IYmbx$Cnqx zUU?JrqlA09Jxxnqp!*ykhv=ytnB^Z9(0_c6X< zI2=xJe8E9(fRX~XCOpb4Pq0XEn=C~HcY z#niyGJxsv)9b8u=F_#^T$~F09Q+;rf?2>J}0;R=PZK%suDg8(Cfs>*Yei;%jN6mw; z1e>~ZaPql7DSz&7j!`!J*4+ClY%(7dvf(=8iVYw{?wR+%rk5%M6KXK=yH`4yc6pIB zy-A%Qh}25=X4`+@zE=jx#M*W}s?zyMEhMtW5xS1T_&gnt?DH$1MsX>bQV|aSh{+ z(Kw=+8JAJxBpO!~myyWkZrsQiGwvt~F`^;@vNfx$-9UF&zOPf&Q&d-XRd+QY{d-r> zuV1~o%em*C|GDR!dy7aAmQVtr1ZtH)B$Q7mflvaqOCSVEs3D;Q(nuf#NvI;B1VWI6 zIuJ@AI|=NlounyjwS?9{<=L?qwhkq*YbCHFK$1%tSzcZ~l&Sp+TCi)U7>*uFAUg>( zI7kW#3Wjgpy7hM0`UJWVT9zG)Ve3!=yH)}X36fj@auNV}m?_PIE`t8LYo`~E9!em4 z2{aT)n&M&&!^Qd!SXu~O76VH59ELrF64=EOXb6zRV~}4mm#>0?=GO+t-nls_4Dy4r zO$&o5mzV6~IflcB639vdS%W0DgWLfZe}S$FPMa{eG8TzM3WAF0i@{Sbj|+k+VTLQK zWeOYbN(p2Ol0Gp1Av6a%KRE5)%|WE#GoDQWTPpbfm|)U*uf;w$&&kQTCO<#_@hw}n ze6cGh9*!MKAX5os3zA_BGzrE3Wkp5B?ZL0Jf>IUhO zjimmy)W5&7Mp!}#e8(k_ElBz@zc*q#$(6xzH!lrZc6>GnB8OK3B@%oQl$M+rJblR~ zK3@w7s(T;-vKRC%q?=aX@^>(%FYIX5igQmle?goI$cb%J^_@6as=AqsooZH9{LH*R z$nV{}U17Uq1j~!o&nq*enc*%XFU(x@s5g)HU{HI&HDxube zA?qH@PB4g_;8UL8BPRJLvRc34c_wseF#NuPATR%Q3eF;&@%$ z#dEi9+jdCov##d7P)!0K%Xf|y&~75_-sSPvP+=y#C)RIu>$AcnrausFmZ{lXhJz zEyGoi*5S91VA%)K-BPi%Hm^gOX1g9Q_%h~p}57)uVp;H(k(d82Nw1d7S_4WO#u=YRmD(AoL5z;0VK*Yo&k*4HL>wi zNEgJN*d1?aVqeI+Lhu)E#+#h0RW{l(s5PW(@dR`*q?ORhj1G>!r8p>TvsX}&vox6YGh>!aiZP8_w61}IaYy((lZMoB zp-d)BgnC0?LZcwB&(u~_*mx|mgy$0-I|(EvAKVoLiiHDOt^xqIjbW2$@ za&^;T#Sg&L9WbSjekEjmQ7SnBl~RHGc~o%1gR6t)k!LW?`{7Qn4j$H#tsVSXyv?;w>f=-apN zF$W%a;EIL<33GacIi<724y~KzTEyL6W$-4{9ufq)FnSSw@A~Un>4~_;>eMJmBPpm7 zcaqtBc2`PQ+=0}s{6vu8(VUCncCB688Z)5Ga}4vmg*wflI7l>x+m)I?QoukbGmw@+ zMKq}Sc_Z91OGwc0tysUDYd3P)C zG?vQYV@QLcGMhPj6dDK_ud1AqFLEHf%`&5?$*NkckCBnOx-0gh4+@ zV=Qk1wOa6A6G&9n>tUh~On3lj3=#m6C+Ye0n4=IaD-T|5dP=bX(4yUkfO;Vy&p)aP z?;hrzuFe?ft>E;Bh*2Wm5RR8+!OE5U1g~Es)20P~4o!meTbC!)+Yunq+NC?EiOZ-q zkW8Z=;|Yz53ap^@ah0JiRC0DJQACx`jRho3We>>R#2wM#+xSaYTVr%RWCBKgIt7Z~ z65kOZnMnV-`6i7HttRm8Ul^|%d!}?TYXXVy-O{xXRlf(>IJNBo1v&ZmM}o+n(MT{q zQc-b5{_vIh^#*8yWjy5en&@sB&`p7~DnAcK-rqimPa&deC@}H2|OLw?xC2ioI+#>pX*Jc~GZ0Wgv)7F*U&)J|Q)=GE|VsP&{ zh-VSwnP>-h5ri`hrca5TqX?*Tf)T%KALQf@3Mwk*2UE^BICYydy(&O_-Y$(A3|}B9wp#RNN7Cu4s;WZIpZZ6 zBu~@UohFka|1E0(NxZ!~iJ4IizdCRB?P2ut4fNt;fR-v%T{U){L6X3=V9+1c@6#Wb zO#c~Bn!Q;K>4tfz_$)SHRW+td)aCrqi@qx@}%z0DLPD#Cb3Yia_bO2#{JC)tWzo@d@^Pux+i zzmUmNNvc4C@@S0AAf_!HI&^rpxVSiZ&D=>f7Ro{QDqgn1)1~NvI+9qD-K|;hV3HdgN^#*NOiRvoG@NK{l6-jt~4Ai7HiL0V7+WNL3d z0vU@yM)I6|jxrM=Ji+c_8+}1hZrj8_Jy}3nV;9mLC4ShpT@Jn`i6X$8;N$(B1QOXW zO|5*)dYL(?EISb-%17CxJ%?)2q{%&4Qq!P`C+?JNbYD)}A9^Slp^L1%JVmsHt^|%pg8$fVq;jckeMms`mjFt%B0C^}@X*+kOrb(ilk221ukY^g58TT9h zsu<}`+zYAuwEgmT4Q+G>zhptiafV@Pkqma!emo#cRl4xfFTGx(-3FUcE*Y6&0;|^UXJ}=bed?j0;({r%|$} z=3ml@y2tq&j59ZPtjhDFq@s&@B6ZZQI+fJ^xEt>H`vkJagY(3o!uml-;e-z?;OT{YV&F1_p#E|buAKi$8`Os;wy2iOl2Ft!&aZRj*-r#i}RUI=E?KVhW~W3 zOCGCM-s%GqnYW$kJcBE@Fb@a+sKB;N>og@dCz6nvh%Wy6n-zWgjSU9#{Ue}w3SiL> z3`;11-9iHO1&Nb$tJmN3j*M5yD=o^Vshv+~k{e9qernrjG}yYWB6@S-@D;jdrcy5j zB;x={MwyGJLJ5&VC`IgcE9k(J|*Ml46nO^y6fFWz`!mIRs;ivMKrFAVk z3M8JTm=iZAZ64a4q}mnax-z@F)<^kzliod&c&wPen*hr@yz5CCa<8skyUtp?cyTX4 z@-bjJ2x{M|RV#r|#!2!5(#8Xc;Yzqhzkr2q%0d^@wl(R}&b)6!+VjuIWgDqn>$Rr; z68lfEnjHbx_Zj{OwM^Uip#sqR#gi z*M3#94b(l7zpzy5b^4Zke;|Em08Lp}z-NEz{*+Yg3yd)rU?0YF9({U$&%08Ug>gLh z>I>hioIlS+^wpPVKYLwCo_aIh7xdqeK3dUlDdfM%(}MQ{JO-fOkC53`=H3(ewFc)O z^4+1-D{0fFP06ZNt4iTv1TvV;JQmUCq14^T_wwI?&->Ab{8wJ&O)fhEB&HI*C5NmP?-L-E8@8rrSKZXk$f)W`78eJ&En7DZyy$Z7XALVfB*ic&YnHnpC07U&#&lj z0*c!N1=&R1b9sK4J_qo;0$v89fUgJ=+OLOx!1pim{lFNgk7V3QDA6$9f5P{kq`x0K zqw+%FQH=38fYFuF5b9zTQTGTG{)P4H*N;TGKZdVOv>gyT7xT!V4|NWr?OTkc%SV++ z59+=Tp9fIS>+k+!A8%1-9)I;pJn!;qdk%GVMV;S#>YoXZuTy6b^LUPPlOf6k9`pHp zDxYuR?@ur!&+t5&w$}Algm>JAGUh~Ntvj{=s+P{*5g^f*_Ik2?dy?K@uEFk#9v09W zsC%Ml?y9+5ARNQO%*SeLc^7#Sk0LLDv}W^Lw{Cqfb@yeFi}~xJSTE}DkJ1zf5*GFV z6x&^45lV6;?>KSfc$=DQpA-+%wx1xd@6Ej#e;6qL|g5fPg2kAigb<}PFU8=!vF z-;=&xih-mjyfqO#v}uY$=INsF?8Vd}xMpkkd?Ee5#+a468av)<#_rGOFX7*M0;dae zKFImf?+x(akFC6Ma5m5W&Z88CJxpsJbAcl6qVgEqLE6LXkC}50%Io|iv^|ct{x~m( z=j#~jJxGJGlDfkguN=M?Bh#7mJ&tx>?#zMLaqP(VP-ie>JxjfNnd57W-JJdwL0cJH z;C;c^_E+sX%#Hww^6;eDz-_zVXz#8{o-N;k1j}_a{k)Abbz+g-SpXcm1g6PIDnYz`EeW z4?i>!P{8-@JDX$ne@GfJ4I|KnPE(#t42S2(a-0Q^}mI$!>RW<&$>+S z^1d&hz3jP-=lLjOM}XRbcim7z&&s^)*opD9=I_Dpq0kcQZsBh?`tiqN&c8SP?F%gu zaPZ~W8Ut@bbfNxw+IIqI-e$<7zYD4757;Naf6Q7$geouJQh*e9j>?n|At5=P!y;;5@ z79^iVMVGdIg*9u%;(3kUJ55^k6@aNHi`yK~tVa>nVgZ}7;H^-WE`0W%h@FK}`g3BF zBDx#4)e7oo7b!FrdJKx-1=DzDsSCpjh|MURE?s*S13pUNV@q)E)B%w?((S zyD=ENZG<=5cIIe+6Ayh6q>EpXjN@cunWfN5MD!?>;qua>oK+qUu-g@8o4wB|cy zTJGkHnEfYpjeq=3H?+I&;mJ6&t-doy9WLY5uNtOcK3C+zE zYCTi_YA#`XV?iyxma-v>I^yqY9Di3PVCsF&k*zR7kYp>tuzjPKKnRjXzr^7Lvz0&y zl58aywr}(j2tm^5mpGhYwh{8_KjWwAxIki5{DDaRstbNvXx-izR^n{1WBV` e;&6i5O5kso>-WiW4d*cc0000HYxLjmb!3#O6$M(wI>V-IwN|VMgFql;C1iQ;&i8k7ABK<+ zlDF{MPwwY)c=x?~?z!jxJHP*WZm>+-(P{*&R^QonqiF*#3=*_~*9Kk~2!wHK8}t6z zz)Me0@0gsN{N1Xms%<4DC0`<6Fbo-^c5A#b&&tZmI@Ra%-D6qSP^8{``0(Me#l^*2 zqlQ2j1IHD39XobB#q0G7xI2(3$F}V<+VFk*_AL!V#;DyIH{fMvX0}U6NEm^ncLClh ze3k&*qT1Tpf&&K*{9n`%2xH)Q0WUcxCufw$e^V3R^_$h#!b@1T9lBh}_=HMq2JS#0NEju+e^*$Ik9MC!-%K;eo4Ck{8 z3k&yzDO=QUKUv^~ysGTmok*EYI|y(~q^|q-@82DD$s_Q9lL8)W%Y}9K0o)K|$d!!? z1Of{xDk|n5I&|pk2*?$aAx;K(j*UZA?+O8jnl3CaFP{r|dt)MXgdP%W@C4jgoWs4Y zjgzX*fo%e>&F6D5Y;(KunA44I*%Zunm|$SBsj7Ivyf!lKLY7#8r#S9zRP`Zc z4z&FMxEQw0b5yn8q7;+jon$O)IM-4Dt^T}aKyeVcO zcF-Xvxo}Lt1GtND4hv}ij$pO40y2ju@TzsrVc_DcOoHbX&J-XYeb{i(*dGJn2($9e z^^G8x#Q4`U_BgI>$MHPLxSL}EV64Eq8P?4~pwnr8tE{Z-14FhS0U~cnzVTR78!)c! zavgXF_&49|-SxCtH(B6^4guFkz|p?Vj}XT(s3xVd?Gmm}HlNkbH=Bmlxcz*Ldku>+k#-57CGh(um^YCC z`>lT(=22$qfwNc$c>jt})c`nwN=X6dRSpn8STYReE#S;^41jgalX{Of%Xcj|X0q&= z2gY5-cynCFc>wQE05_z8%4)o**}qsYPk5vwY(5N8jjjU%??%vR2)q=Ql$$||y8_

8^s`5EV47}paf&*uDFv;gC5X1sd=?tfkI6LWKOuVayV zacu#=|IIM~5k4XfUIJBMm6lQvt_ENfUO2X=ef#!Zlai9g0^E=JnoRow;bzs;)GVg} zP-^lP-DEsojJ|a~a;7+PTGk6gZDp9A2N^jTKab$X>a$NCP;yBg5Cz>^@e`#Vbhj@e;v#nyRUQ1ZD?&OyMv zN1KibkQc6|ISvHi z0Jc@7t!@I2<4yXE=h>gQKt_~&kx<)|PMtc9WmfmlG6fK=3_+8ad=lq}`TQLWn}iyF zB-Mg}XZZd8(J=S03a#JFDcnMS*qpMA8=uyquw`X1-z91*%yl`C z-!sUC$h*a^8);HQc+ArdUs`j9Qq| zYVc&YVAW72I}|`VGf)wqOIYoB4GNhF^u1opr0>7cPx06W0LTZx{}CWAfTOrRn3k$A z2I1uZ4$-dRdlx<(=fL=nxL#GJp}upF1CeuBEA@AQQ=h0FEmm7Gj^^yEB9L~uiV=1` z8H0+Mjg`)m0I;_Jr0*r%Cjj5!o<|V!eE|qVPebi~&iQRzZ|?#TTHIQxAzvQFspwNG zoj@F?v`n7Y@v5?`05>UCd2MT$m+U%+Vce|Jc`=io&BpZnkt0h=CS8!4Q)Q)m+YZ{N zd3;uBRgJwR-LrqYm1h$0gjbKvlx3`^O#{Gvpood9&l~kK|U7{L(M5I zEi0;7m366YdB-r<9wZ0~asvUIIL!nLl7fXR0I(JYUcvpp0-&>KRe-k^p~uw|IxQn3 zLyqP=?r%ri4VypW8LBW#4dopAa9u?P0W9F&m7{SOchzK%$;dt5Bqa0(H?CU;P0;g> zDKG!PtQpbJi-!&C34!MpG9L(S5AswMG7G4V6qJ>f?YEb9=yKTaf61eg6KeU*tZc3P z-%YS)?E8N%diCnbj*4D}iarf^=ep|l2F!)GB>;WgLvh@7%wZnA&J>ukgV@h;bur`$ z%jA{*lr)db!al>9M_pcAfl@Cr)wMItt9S2f?iubPoe;3ifoHMOolp^ZRqf`h-c~5* zaHNpQ4^=C(#~H`tS&G3L9Li1Y6|m!>l)So~e?X8Ed6ZLyA6yE|LVYKSNlnd~d0gx= z?sD~Wz3Rg-PC;^j{J1ye`{y~&J*Ko}+c40cYl@3!nYTt)H1Z4&b2^LPds5kck8I>~ zEo^fL9v3_&d@4fT%^x)V~3Vf-5z`wdLVSWL-R;eeOKY7BL~q_zjOSu^*@W{o?t z{iaE*s?7Z@cJ9h1A7>du6BGU1-6-_9n+NCmv{^c~4{ zWiI)E{g?xsj(&?eQpW#pR94~8v4_;xGM}No!_D$L*4FDF;4W~1yNTb^82c~CIT&&@ z`)1bhm?w5QwrW=86fip&N;&D6gH<>7Tg3hMCFK=L9dxK< z^b^K?gqFi(x6`gT&RYVS%Y*b)8kk1k#du%MO|hUceHUby^u#p))T2r8jQuI4{JZOy z^2uJ##}wo2ZGtNLRDmqYB6Dmv`$*Y?K@I=6CZVcx-0H#%09SMZ3 z@7c!F$+CloSndx3!OGQXc~0h`bm~ebJX3a#?=l7N0o){v^9L^L5)iBtY}Z~#5=<*1 zjM<6zlOwT7<<0`YhdGzfs@Qy~f+}My1N;&*XvuZPYwp5&T*$RF*d`#bqt^4Lq~axF zy>eK89^+474nN?U^6edrF%Qjpwxw@nMGQO#Kqm9`B9ok&(JrZ7qQAy$*3`sKlj!XZ`8u*;u1Ykuyo|q6h1R_)9%v2&1U}IkF z;dlg~ak_jA7jUE7TYl$rd8RG3fI6jcvg=!R5Q zN=iy6Hl^mfUR4#HJzSpvOP_NWsy@ywI*%53vR{|6+VkX9nUOs8A7Rc!gi@_eN5~FN z;ank$Qvs$;gb{KePO1jDR{`MToT?z|LGZU3M+MbS)dweZmRn(w9ZTkUyBXst7T`bm zo{qT~!*#`R0&bTa48W<}Ul${WaYO?=*|=Uz`Vm)PIfp;Eh0M^NgMbU!L4hLkwt@CA zz{w8Q&vCWgc&)Y)0p=2}N%h}`fl~ocWvW`KCC^iBPhMC6>P>pZb7G_7LOtLsS^>=e zwewb11dd39=dcMue~tk1swx>ZEMzJPzr{`a^a7CjtaW$7Hc`FvRPM<<#pgGjEz9c* zc+H*}uh#4@_%Gjg-HNov71-O{GC1tQ?LDn)-gOH%|fXMOA?!fSWT!B*Alb zxd84LjH~Ldk4b-knv8Y5q_fNAItTSR5BUOIf5Qb~i~V9|`r%~nEo3WsgxF_*5s|-D zXqn)eEnifv=>K@)*|x_sU7?KYMAq|+sjixbwl!~H>;YU?O;A;yPw2Cd#d)`>45_tX zMiM+f;0*!1X-p=I32y_KApob$L24-AzVD`GD&MQTzQ(P`eM*pR)p)aSBS+?bOYiW7 z>Vo76`b!}5%Nx+#eHfrhQB{*HwD4Z;kPQODt+?Z>V7u z3k*(!De@tA^8#cU}` z>Je5U#gUMsp>wEQk=4uN^}Pmg+JbECIP5XOd|&du0;`Xyf#up+Q>rI#UdclIjD>hP zhS){a<~25Nm6Eh4t9S3@RUHS?FdWg1Rj*|Arw~mk$VzM+0H-4T3x8nWV{UauHNN{9 zd%PBiF@HsXtT*gqc0`<>^s{0Cr^3r7ly>CgkJSU~|vy-R4j+6swhmBhbc(=N2j|qTL1rHU@BEna(@m4q1n@W%@J9tdJ z%wF0)qspK7EPZc0dJ{=FI5uyyWe0{Q3_S25lXfaByj(P!{(aN~@bs#N-Y$sQ5moRc zg*M44BV9?1wUx?+su+zH8iB{EeI@&fpk-0u7^E(-O+|zF^&M4!e82 zO4}6EDIEC>M&HE3=vB6u9Z?6bC6d^ad9kc}_JyF82YBBCHoa&3h1afq#aCXm0pO}J z1!n@<^m-|mUQwF@>t3R7)L*fvFHc;77n+zV(`B{k?b4G{Jf?PUnd=~&vQmRWri!6+ z@wCrHIsiVAMUPAH8kxAKkwWGU82BWG%%zdaRZj%4xMyAiA@t{^=hrV}$_8rBf$U^i zOH1c11?YJF + + + + + Forgot password + + + + + + + + + +

+
+
+
+ +
+
+
+ + copyright + 2018 Cantilever Labs +
+
+
+
+ + + + + From 2c624b1040b145abea9308e0b87263dc67409d89 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Mon, 17 May 2021 11:15:42 +0530 Subject: [PATCH 23/39] Added Phone Auth and verify email --- controllers/auth.js | 229 +-- package-lock.json | 3632 ++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- 3 files changed, 3650 insertions(+), 213 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index a661619..791ddf9 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -13,11 +13,11 @@ const smtpTransport = require("nodemailer-smtp-transport"); var transport = nodemailer.createTransport( smtpTransport({ - host: "email-smtp.us-east-1.amazonaws.com", //`${process.env.HOST}` + host: `${process.env.HOST}`, //`${process.env.HOST}` port: 465, auth: { - user: "AKIA2G7743RRTZMVXE3X", //`${process.env.EMAIL}` - pass: "BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c", //`${process.env.PASS}` + user: `${process.env.EMAIL}`, //`${process.env.EMAIL}` + pass: `${process.env.PASS}`, //`${process.env.PASS}` }, }) ); @@ -224,157 +224,94 @@ module.exports.forgotpassword = async (req, res, next) => { }) .then((data) => { const reset_link = `${link}/${user._id}/${token}`; - const message = { from: `${sending_company_email}`, // Sender address to: `${user.email}`, // List of recipients subject: `${subject}`, // Subject line - html: ` - - - - - Forgot password - - + html: ` + + - - - - - - -
-
-
-
- -
-
-
-

Hello

-
-

- We got a request to reset your Password. No need to worry you can - reset your Password by clicking the Reset Button. -

- + -
-

- Facing any other issue write us at - info@cantileverlabs.com -

-
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
 
+ + logo + +
 
+ + + + + + + + + + +
 
+

You have + requested to reset your password

+ +

+ We cannot simply send you your old password. A unique link to reset your + password has been generated for you. To reset your password, click the + following link and follow the instructions. +

+ Reset + Password +
 
+
 
+
+ + copyright 2018 Cantilever Labs +
+
 
+
+ + -
- -
-
-

Privacy Policy | Terms of Use | Contact us

-
-
-
- - copyright - 2018 Cantilever Labs -
-
-
-
- - - - `, // design html for email message. }; diff --git a/package-lock.json b/package-lock.json index 7e74e2c..a93f048 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "aws-sdk": "^2.907.0", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", + "bootstrap-email": "^1.1.1", "cookie-session": "^1.4.0", "cors": "^2.8.5", "crypto": "^1.0.1", @@ -23,7 +24,6 @@ "messagebird": "^3.6.1", "mongoose": "^5.12.2", "nodemailer": "^6.6.0", - "nodemailer-express-handlebars": "^4.0.0", "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", @@ -508,8 +508,7 @@ "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "node_modules/accepts": { "version": "1.3.7", @@ -534,6 +533,14 @@ "uri-js": "^4.2.2" } }, + "node_modules/amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "engines": { + "node": ">=0.4.2" + } + }, "node_modules/ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", @@ -561,7 +568,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true, "engines": { "node": ">=6" } @@ -591,6 +597,28 @@ "node": ">= 8" } }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "node_modules/are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -617,6 +645,19 @@ "node": ">=0.8" } }, + "node_modules/async": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" + }, + "node_modules/async-foreach": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", + "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", + "engines": { + "node": "*" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -726,6 +767,17 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dependencies": { + "inherits": "~2.0.0" + }, + "engines": { + "node": "0.4 || >=0.5.8" + } + }, "node_modules/bluebird": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", @@ -751,6 +803,25 @@ "node": ">= 0.8" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "node_modules/bootstrap-email": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/bootstrap-email/-/bootstrap-email-1.1.1.tgz", + "integrity": "sha512-8O2OMPKR6nz0m1q3P7XXgMuKb6IMfi6RBmWWa9zG7T+e8h9+hMP22WLmqApmwusNkakRVov/cvBFXUmrLe5WHg==", + "dependencies": { + "bunyan": "^1.8.12", + "cheerio": "^1.0.0-rc.3", + "ejs": "^2.6.1", + "juice": "^5.2.0", + "node-sass": "^4.14.1", + "postcss": "^7.0.25", + "sass-extract": "^2.1.0" + } + }, "node_modules/boxen": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", @@ -836,6 +907,23 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, + "node_modules/bunyan": { + "version": "1.8.15", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", + "integrity": "sha512-0tECWShh6wUysgucJcBAoYegf3JJoZWibxdqhTm7OHPeT42qdjkZ29QCMcKwbgU1kiH+auSIasNRXMLWXafXig==", + "engines": [ + "node >=0.10.0" + ], + "bin": { + "bunyan": "bin/bunyan" + }, + "optionalDependencies": { + "dtrace-provider": "~0.8", + "moment": "^2.19.3", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, "node_modules/bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -929,11 +1017,30 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, "engines": { "node": ">=6" } }, + "node_modules/camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dependencies": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/camelcase-keys/node_modules/camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001228", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz", @@ -982,6 +1089,41 @@ "node": ">=8" } }, + "node_modules/cheerio": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.9.tgz", + "integrity": "sha512-QF6XVdrLONO6DXRF5iaolY+odmhj2CLj+xzNod7INPWMi/x9X4SOylH0S/vaPpX+AUU6t04s34SQNh7DbkuCng==", + "dependencies": { + "cheerio-select": "^1.4.0", + "dom-serializer": "^1.3.1", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.4.0.tgz", + "integrity": "sha512-sobR3Yqz27L553Qa7cK6rtJlMDbiKPdNywtR95Sj/YgfpLfy0u6CGJuaBKe5YE/vTc23SCRKxWSdlon/w6I/Ew==", + "dependencies": { + "css-select": "^4.1.2", + "css-what": "^5.0.0", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.6.0" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/chokidar": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", @@ -1018,6 +1160,29 @@ "node": ">=6" } }, + "node_modules/cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -1027,6 +1192,14 @@ "mimic-response": "^1.0.0" } }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1061,6 +1234,11 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -1088,6 +1266,11 @@ "node": ">=8" } }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, "node_modules/content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -1175,6 +1358,21 @@ "node": ">= 0.10" } }, + "node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, "node_modules/crypto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", @@ -1189,6 +1387,43 @@ "node": ">=8" } }, + "node_modules/css-select": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.2.tgz", + "integrity": "sha512-nu5ye2Hg/4ISq4XqdLY2bEatAcLIdt3OYGFc9Tm9n7VSlFBcfRv0gBNksHRgSdUDQGtN3XrZ94ztW+NfzkFSUw==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^5.0.0", + "domhandler": "^4.2.0", + "domutils": "^2.6.0", + "nth-check": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.0.tgz", + "integrity": "sha512-qxyKHQvgKwzwDWC/rGbT821eJalfupxYW2qbSJSAtdSTimsr/MlaGONoNLllaUPZWf8QnbcKM/kPVYUQuEKAFA==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dependencies": { + "array-find-index": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1200,6 +1435,18 @@ "node": ">=0.10" } }, + "node_modules/datauri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/datauri/-/datauri-2.0.0.tgz", + "integrity": "sha512-zS2HSf9pI5XPlNZgIqJg/wCJpecgU/HA6E/uv2EfaWnW1EiTGLfy/EexTIsC9c99yoCOTXlqeeWk4FkCSuO3/g==", + "dependencies": { + "image-size": "^0.7.3", + "mimer": "^1.0.0" + }, + "engines": { + "node": ">= 4" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1208,6 +1455,14 @@ "ms": "2.0.0" } }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -1224,7 +1479,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, "engines": { "node": ">=4.0.0" } @@ -1243,6 +1497,11 @@ "node": ">=0.4.0" } }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, "node_modules/denque": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", @@ -1264,6 +1523,57 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "node_modules/dom-serializer": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.1.tgz", + "integrity": "sha512-Pv2ZluG5ife96udGgEDovOOOA5UELkltfJpnIExPrAk1LTvecolUGn6lIaoLh86d83GiB86CjzciMd9BuRB71Q==", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", + "integrity": "sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA==", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.6.0.tgz", + "integrity": "sha512-y0BezHuy4MDYxh6OvolXYsH+1EMGmFbwv5FKW7ovwMG6zTPWqNPq3WF9ayZssFq+UlKdffGLbOEaghNdaOm1WA==", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -1284,6 +1594,19 @@ "node": ">=10" } }, + "node_modules/dtrace-provider": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz", + "integrity": "sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "nan": "^2.14.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -1312,6 +1635,15 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "node_modules/ejs": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", + "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==", + "hasInstallScript": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/electron-to-chromium": { "version": "1.3.727", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.727.tgz", @@ -1320,8 +1652,7 @@ "node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, "node_modules/encodeurl": { "version": "1.0.2", @@ -1340,6 +1671,22 @@ "once": "^1.4.0" } }, + "node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -1426,19 +1773,6 @@ "node": ">= 0.10.0" } }, - "node_modules/express-handlebars": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-4.0.6.tgz", - "integrity": "sha512-SWwmp4ERN/hPySdRnQYiNcJP/LHAeTz1qq0MXQ2ztZiMC6sKw1WathtVWWY+AUPkjV6eDmQXqybJQwnUsoI9vw==", - "dependencies": { - "glob": "^7.1.6", - "graceful-fs": "^4.2.4", - "handlebars": "^4.7.6" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -1574,11 +1908,105 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dependencies": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/fstream/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/gauge/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gaze": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "dependencies": { + "globule": "^1.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -1587,6 +2015,14 @@ "node": ">=6.9.0" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -1600,6 +2036,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -1671,6 +2115,33 @@ "node": ">=4" } }, + "node_modules/globule": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz", + "integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==", + "dependencies": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/gonzales-pe": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-4.3.0.tgz", + "integrity": "sha512-otgSPpUmdWJ43VXyiNgEYE4luzHCL2pz4wQ0OnDluC6Eg4Ko3Vexy/SrSynglw/eR+OhkzmqFCZa/OFa/RgAOQ==", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "gonzales": "bin/gonzales.js" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -1798,6 +2269,25 @@ "node": ">= 0.4.0" } }, + "node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -1817,6 +2307,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, "node_modules/has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", @@ -1826,6 +2321,29 @@ "node": ">=8" } }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + }, + "node_modules/htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, "node_modules/http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -1903,6 +2421,17 @@ "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, + "node_modules/image-size": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", + "integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g==", + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/import-jsx": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-jsx/-/import-jsx-4.0.0.tgz", @@ -1948,6 +2477,28 @@ "node": ">=0.8.19" } }, + "node_modules/in-publish": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz", + "integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==", + "bin": { + "in-install": "in-install.js", + "in-publish": "in-publish.js", + "not-in-install": "not-in-install.js", + "not-in-publish": "not-in-publish.js" + } + }, + "node_modules/indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dependencies": { + "repeating": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1968,6 +2519,14 @@ "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==", "dev": true }, + "node_modules/invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -1976,6 +2535,11 @@ "node": ">= 0.10" } }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -2000,6 +2564,17 @@ "is-ci": "bin.js" } }, + "node_modules/is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -2009,11 +2584,21 @@ "node": ">=0.10.0" } }, + "node_modules/is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, "engines": { "node": ">=4" } @@ -2084,6 +2669,11 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "node_modules/is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, "node_modules/is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", @@ -2095,6 +2685,11 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -2108,6 +2703,11 @@ "node": ">= 0.6.0" } }, + "node_modules/js-base64": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", + "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2204,6 +2804,141 @@ "verror": "1.10.0" } }, + "node_modules/juice": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/juice/-/juice-5.2.0.tgz", + "integrity": "sha512-0l6GZmT3efexyaaay3SchKT5kG311N59TEFP5lfvEy0nz9SNqjx311plJ3b4jze7arsmDsiHQLh/xnAuk0HFTQ==", + "dependencies": { + "cheerio": "^0.22.0", + "commander": "^2.15.1", + "cross-spawn": "^6.0.5", + "deep-extend": "^0.6.0", + "mensch": "^0.3.3", + "slick": "^1.12.2", + "web-resource-inliner": "^4.3.1" + }, + "bin": { + "juice": "bin/juice" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/juice/node_modules/cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "dependencies": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/juice/node_modules/css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dependencies": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "node_modules/juice/node_modules/css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", + "engines": { + "node": "*" + } + }, + "node_modules/juice/node_modules/dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "dependencies": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "node_modules/juice/node_modules/domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + }, + "node_modules/juice/node_modules/domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dependencies": { + "domelementtype": "1" + } + }, + "node_modules/juice/node_modules/domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dependencies": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "node_modules/juice/node_modules/entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + }, + "node_modules/juice/node_modules/htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dependencies": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "node_modules/juice/node_modules/nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "dependencies": { + "boolbase": "~1.0.0" + } + }, + "node_modules/juice/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -2260,6 +2995,21 @@ "node": ">=8" } }, + "node_modules/load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -2276,6 +3026,36 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash.assignin": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" + }, + "node_modules/lodash.bind": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" + }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "node_modules/lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "node_modules/lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, "node_modules/lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", @@ -2306,11 +3086,69 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" }, + "node_modules/lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" }, + "node_modules/lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "node_modules/lodash.reduce": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" + }, + "node_modules/lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" + }, + "node_modules/lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" + }, + "node_modules/lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dependencies": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -2320,6 +3158,15 @@ "node": ">=0.10.0" } }, + "node_modules/lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -2339,6 +3186,14 @@ "semver": "bin/semver.js" } }, + "node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -2353,6 +3208,31 @@ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", "optional": true }, + "node_modules/mensch": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/mensch/-/mensch-0.3.4.tgz", + "integrity": "sha512-IAeFvcOnV9V0Yk+bFhYR07O3yNina9ANIN5MoXBKYJ/RLYPurd2d0yw14MDhpr9/momp0WofT1bPUh3hkzdi/g==" + }, + "node_modules/meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dependencies": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -2427,6 +3307,17 @@ "node": ">= 0.6" } }, + "node_modules/mimer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimer/-/mimer-1.1.0.tgz", + "integrity": "sha512-y9dVfy2uiycQvDNiAYW6zp49ZhFlXDMr5wfdOiMbdzGM/0N5LNR6HTUn3un+WUQcM0koaw8FMTG1bt5EnHJdvQ==", + "bin": { + "mimer": "bin/mimer" + }, + "engines": { + "node": ">= 6.0" + } + }, "node_modules/mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -2452,6 +3343,26 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/moment": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", + "optional": true, + "engines": { + "node": "*" + } + }, "node_modules/mongodb": { "version": "3.6.5", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", @@ -2600,11 +3511,67 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=", + "optional": true, + "dependencies": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/mv/node_modules/glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "optional": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mv/node_modules/rimraf": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", + "optional": true, + "dependencies": { + "glob": "^6.0.1" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" + }, "node_modules/nanoid": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" }, + "node_modules/ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", + "optional": true, + "bin": { + "ncp": "bin/ncp" + } + }, "node_modules/negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", @@ -2618,11 +3585,161 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node_modules/node-gyp": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "dependencies": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/node-gyp/node_modules/nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/node-gyp/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/node-gyp/node_modules/semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/node-releases": { "version": "1.1.71", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" }, + "node_modules/node-sass": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", + "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", + "hasInstallScript": true, + "dependencies": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash": "^4.17.15", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.13.2", + "node-gyp": "^3.8.0", + "npmlog": "^4.0.0", + "request": "^2.88.0", + "sass-graph": "2.2.5", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "bin": { + "node-sass": "bin/node-sass" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/cross-spawn": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", + "dependencies": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "node_modules/node-sass/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/nodemailer": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", @@ -2631,14 +3748,6 @@ "node": ">=6.0.0" } }, - "node_modules/nodemailer-express-handlebars": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/nodemailer-express-handlebars/-/nodemailer-express-handlebars-4.0.0.tgz", - "integrity": "sha512-oUYl2D1AkFNwRe7RXt8iNTtmQGmI4Bt4PXRkE9lX891FHNNUB3I5yRDGL1WQPOujYIHH79uAvD3QzsBStG4SFA==", - "dependencies": { - "express-handlebars": "^4.0.0" - } - }, "node_modules/nodemailer-fetch": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz", @@ -2719,6 +3828,17 @@ "nopt": "bin/nopt.js" } }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2737,6 +3857,36 @@ "node": ">=8" } }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/nth-check": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", + "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/oauth": { "version": "0.9.15", "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", @@ -2793,6 +3943,31 @@ "wrappy": "1" } }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, "node_modules/p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", @@ -2859,6 +4034,43 @@ "semver": "bin/semver.js" } }, + "node_modules/parse-color": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", + "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", + "dependencies": { + "color-convert": "~0.5.0" + } + }, + "node_modules/parse-color/node_modules/color-convert": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", + "integrity": "sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=" + }, + "node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dependencies": { + "parse5": "^6.0.1" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -2962,11 +4174,37 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "engines": { + "node": ">=4" + } + }, + "node_modules/path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "node_modules/path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/pause": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", @@ -2986,6 +4224,33 @@ "node": ">=8.6" } }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -2997,6 +4262,90 @@ "node": ">=8" } }, + "node_modules/postcss": { + "version": "7.0.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", + "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", + "dependencies": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + }, + "engines": { + "node": ">=6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + } + }, + "node_modules/postcss/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss/node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/postcss/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/postcss/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postcss/node_modules/supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -3031,6 +4380,11 @@ "node": ">= 0.10" } }, + "node_modules/pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, "node_modules/psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -3080,6 +4434,15 @@ "node": ">=0.6" } }, + "node_modules/query-ast": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/query-ast/-/query-ast-1.0.3.tgz", + "integrity": "sha512-k7z4jilpZCujhiJ+QeKSwYXHc9HxqiVKlVE7/em0zBfPpcqnXKUP8F7ld7XaAkO6oXeAD7yonqcNJWqOF2pSGA==", + "dependencies": { + "invariant": "2.2.2", + "lodash": "^4.17.15" + } + }, "node_modules/querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -3143,6 +4506,54 @@ "rc": "cli.js" } }, + "node_modules/read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dependencies": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dependencies": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dependencies": { + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -3169,6 +4580,18 @@ "node": ">=8.10.0" } }, + "node_modules/redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dependencies": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/regexp-clone": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz", @@ -3198,6 +4621,17 @@ "node": ">=8" } }, + "node_modules/repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dependencies": { + "is-finite": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -3270,6 +4704,31 @@ "semver": "^5.1.0" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-from": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", @@ -3306,6 +4765,12 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", + "optional": true + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -3323,6 +4788,37 @@ "node": ">=6" } }, + "node_modules/sass-extract": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sass-extract/-/sass-extract-2.1.0.tgz", + "integrity": "sha1-xl5soxA8vPL8oNzYGwfk5JpsxYM=", + "dependencies": { + "bluebird": "^3.4.7", + "gonzales-pe": "^4.2.2", + "parse-color": "^1.0.0", + "query-ast": "^1.0.1" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "node-sass": "^3.8.0 || 4" + } + }, + "node_modules/sass-graph": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz", + "integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==", + "dependencies": { + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^13.3.2" + }, + "bin": { + "sassgraph": "bin/sassgraph" + } + }, "node_modules/sax": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", @@ -3333,6 +4829,26 @@ "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" }, + "node_modules/scss-tokenizer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", + "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", + "dependencies": { + "js-base64": "^2.1.8", + "source-map": "^0.4.2" + } + }, + "node_modules/scss-tokenizer/node_modules/source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -3404,11 +4920,35 @@ "node": ">= 0.8.0" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, "node_modules/setprototypeof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" }, + "node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/shortid": { "version": "2.2.16", "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", @@ -3438,14 +4978,21 @@ "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "node_modules/sliced": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" }, + "node_modules/slick": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/slick/-/slick-1.12.2.tgz", + "integrity": "sha1-vQSN23TefRymkV+qSldXCzVQwtc=", + "engines": { + "node": "*" + } + }, "node_modules/smtp-connection": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", @@ -3472,6 +5019,34 @@ "memory-pager": "^1.0.2" } }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==" + }, "node_modules/sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", @@ -3499,6 +5074,14 @@ "node": ">= 0.6" } }, + "node_modules/stdout-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", + "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", + "dependencies": { + "readable-stream": "^2.0.1" + } + }, "node_modules/stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", @@ -3569,7 +5152,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, "dependencies": { "ansi-regex": "^4.1.0" }, @@ -3577,6 +5159,31 @@ "node": ">=6" } }, + "node_modules/strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dependencies": { + "get-stdin": "^4.0.1" + }, + "bin": { + "strip-indent": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -3597,6 +5204,16 @@ "node": ">=4" } }, + "node_modules/tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "dependencies": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, "node_modules/term-size": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", @@ -3667,6 +5284,27 @@ "node": ">=0.8" } }, + "node_modules/trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/true-case-path": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", + "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", + "dependencies": { + "glob": "^7.1.2" + } + }, + "node_modules/tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, "node_modules/tsscmp": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", @@ -3870,6 +5508,23 @@ "uuid": "bin/uuid" } }, + "node_modules/valid-data-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/valid-data-url/-/valid-data-url-2.0.0.tgz", + "integrity": "sha512-dyCZnv3aCey7yfTgIqdZanKl7xWAEEKCbgmR7SKqyK6QT/Z07ROactrgD1eA37C69ODRj7rNOjzKWVPh0EUjBA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -3891,6 +5546,142 @@ "extsprintf": "^1.2.0" } }, + "node_modules/web-resource-inliner": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/web-resource-inliner/-/web-resource-inliner-4.3.4.tgz", + "integrity": "sha512-agVAgRhOOi4GVlvKK34oM23tDgH8390HfLnZY2HZl8OFBwKNvUJkH7t89AT2iluQP8w9VHAAKX6Z8EN7/9tqKA==", + "dependencies": { + "async": "^3.1.0", + "chalk": "^2.4.2", + "datauri": "^2.0.0", + "htmlparser2": "^4.0.0", + "lodash.unescape": "^4.0.1", + "request": "^2.88.0", + "safer-buffer": "^2.1.2", + "valid-data-url": "^2.0.0", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/web-resource-inliner/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/web-resource-inliner/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/web-resource-inliner/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/web-resource-inliner/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/web-resource-inliner/node_modules/domhandler": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-3.3.0.tgz", + "integrity": "sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==", + "dependencies": { + "domelementtype": "^2.0.1" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/web-resource-inliner/node_modules/htmlparser2": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-4.1.0.tgz", + "integrity": "sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q==", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^3.0.0", + "domutils": "^2.0.0", + "entities": "^2.0.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wide-align/node_modules/ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -3908,6 +5699,56 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" }, + "node_modules/wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -3950,6 +5791,105 @@ "engines": { "node": ">=4.0" } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + }, + "node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + }, + "node_modules/yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dependencies": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "node_modules/yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/yargs/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "engines": { + "node": ">=4" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } } }, "dependencies": { @@ -4367,8 +6307,7 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "accepts": { "version": "1.3.7", @@ -4390,6 +6329,11 @@ "uri-js": "^4.2.2" } }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" + }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", @@ -4415,8 +6359,7 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, "ansi-styles": { "version": "4.3.0", @@ -4437,6 +6380,25 @@ "picomatch": "^2.0.4" } }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -4460,6 +6422,16 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, + "async": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" + }, + "async-foreach": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", + "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -4541,6 +6513,14 @@ "safe-buffer": "^5.1.1" } }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "requires": { + "inherits": "~2.0.0" + } + }, "bluebird": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", @@ -4563,6 +6543,25 @@ "type-is": "~1.6.17" } }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "bootstrap-email": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/bootstrap-email/-/bootstrap-email-1.1.1.tgz", + "integrity": "sha512-8O2OMPKR6nz0m1q3P7XXgMuKb6IMfi6RBmWWa9zG7T+e8h9+hMP22WLmqApmwusNkakRVov/cvBFXUmrLe5WHg==", + "requires": { + "bunyan": "^1.8.12", + "cheerio": "^1.0.0-rc.3", + "ejs": "^2.6.1", + "juice": "^5.2.0", + "node-sass": "^4.14.1", + "postcss": "^7.0.25", + "sass-extract": "^2.1.0" + } + }, "boxen": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", @@ -4629,6 +6628,17 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, + "bunyan": { + "version": "1.8.15", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", + "integrity": "sha512-0tECWShh6wUysgucJcBAoYegf3JJoZWibxdqhTm7OHPeT42qdjkZ29QCMcKwbgU1kiH+auSIasNRXMLWXafXig==", + "requires": { + "dtrace-provider": "~0.8", + "moment": "^2.19.3", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -4699,8 +6709,23 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" + } + } }, "caniuse-lite": { "version": "1.0.30001228", @@ -4739,6 +6764,32 @@ } } }, + "cheerio": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.9.tgz", + "integrity": "sha512-QF6XVdrLONO6DXRF5iaolY+odmhj2CLj+xzNod7INPWMi/x9X4SOylH0S/vaPpX+AUU6t04s34SQNh7DbkuCng==", + "requires": { + "cheerio-select": "^1.4.0", + "dom-serializer": "^1.3.1", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + } + }, + "cheerio-select": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.4.0.tgz", + "integrity": "sha512-sobR3Yqz27L553Qa7cK6rtJlMDbiKPdNywtR95Sj/YgfpLfy0u6CGJuaBKe5YE/vTc23SCRKxWSdlon/w6I/Ew==", + "requires": { + "css-select": "^4.1.2", + "css-what": "^5.0.0", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.6.0" + } + }, "chokidar": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", @@ -4767,6 +6818,28 @@ "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, "clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -4776,6 +6849,11 @@ "mimic-response": "^1.0.0" } }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -4804,6 +6882,11 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -4828,6 +6911,11 @@ "xdg-basedir": "^4.0.0" } }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, "content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -4899,6 +6987,18 @@ "vary": "^1" } }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, "crypto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", @@ -4910,6 +7010,31 @@ "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, + "css-select": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.2.tgz", + "integrity": "sha512-nu5ye2Hg/4ISq4XqdLY2bEatAcLIdt3OYGFc9Tm9n7VSlFBcfRv0gBNksHRgSdUDQGtN3XrZ94ztW+NfzkFSUw==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^5.0.0", + "domhandler": "^4.2.0", + "domutils": "^2.6.0", + "nth-check": "^2.0.0" + } + }, + "css-what": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.0.tgz", + "integrity": "sha512-qxyKHQvgKwzwDWC/rGbT821eJalfupxYW2qbSJSAtdSTimsr/MlaGONoNLllaUPZWf8QnbcKM/kPVYUQuEKAFA==" + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "requires": { + "array-find-index": "^1.0.1" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -4918,6 +7043,15 @@ "assert-plus": "^1.0.0" } }, + "datauri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/datauri/-/datauri-2.0.0.tgz", + "integrity": "sha512-zS2HSf9pI5XPlNZgIqJg/wCJpecgU/HA6E/uv2EfaWnW1EiTGLfy/EexTIsC9c99yoCOTXlqeeWk4FkCSuO3/g==", + "requires": { + "image-size": "^0.7.3", + "mimer": "^1.0.0" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -4926,6 +7060,11 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -4938,8 +7077,7 @@ "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, "defer-to-connect": { "version": "1.1.3", @@ -4952,6 +7090,11 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, "denque": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", @@ -4967,6 +7110,39 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "dom-serializer": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.1.tgz", + "integrity": "sha512-Pv2ZluG5ife96udGgEDovOOOA5UELkltfJpnIExPrAk1LTvecolUGn6lIaoLh86d83GiB86CjzciMd9BuRB71Q==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "entities": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" + }, + "domhandler": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", + "integrity": "sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA==", + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.6.0.tgz", + "integrity": "sha512-y0BezHuy4MDYxh6OvolXYsH+1EMGmFbwv5FKW7ovwMG6zTPWqNPq3WF9ayZssFq+UlKdffGLbOEaghNdaOm1WA==", + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -4981,6 +7157,15 @@ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.1.tgz", "integrity": "sha512-W8FNeNnnvJoYfgkFRKzp8kTgz0T2YY4TJ9xy1Ma0hSebPTK8iquRtpG12TUrSTX5zIN9D/wSLEEuI+Ad35tlyw==" }, + "dtrace-provider": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz", + "integrity": "sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg==", + "optional": true, + "requires": { + "nan": "^2.14.0" + } + }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -5009,6 +7194,11 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "ejs": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", + "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==" + }, "electron-to-chromium": { "version": "1.3.727", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.727.tgz", @@ -5017,8 +7207,7 @@ "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, "encodeurl": { "version": "1.0.2", @@ -5034,6 +7223,19 @@ "once": "^1.4.0" } }, + "entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -5102,16 +7304,6 @@ "vary": "~1.1.2" } }, - "express-handlebars": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/express-handlebars/-/express-handlebars-4.0.6.tgz", - "integrity": "sha512-SWwmp4ERN/hPySdRnQYiNcJP/LHAeTz1qq0MXQ2ztZiMC6sKw1WathtVWWY+AUPkjV6eDmQXqybJQwnUsoI9vw==", - "requires": { - "glob": "^7.1.6", - "graceful-fs": "^4.2.4", - "handlebars": "^4.7.6" - } - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -5211,16 +7403,98 @@ "dev": true, "optional": true }, + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + } + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "gaze": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "requires": { + "globule": "^1.0.0" + } + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, "get-intrinsic": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", @@ -5231,6 +7505,11 @@ "has-symbols": "^1.0.1" } }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -5284,6 +7563,24 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, + "globule": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz", + "integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==", + "requires": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + } + }, + "gonzales-pe": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-4.3.0.tgz", + "integrity": "sha512-otgSPpUmdWJ43VXyiNgEYE4luzHCL2pz4wQ0OnDluC6Eg4Ko3Vexy/SrSynglw/eR+OhkzmqFCZa/OFa/RgAOQ==", + "requires": { + "minimist": "^1.2.5" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -5386,6 +7683,21 @@ "function-bind": "^1.1.1" } }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + } + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -5396,12 +7708,33 @@ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, "has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "dev": true }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + }, + "htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -5463,6 +7796,11 @@ "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, + "image-size": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", + "integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g==" + }, "import-jsx": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-jsx/-/import-jsx-4.0.0.tgz", @@ -5498,6 +7836,19 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "in-publish": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz", + "integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==" + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "requires": { + "repeating": "^2.0.0" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -5518,11 +7869,24 @@ "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==", "dev": true }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "requires": { + "loose-envify": "^1.0.0" + } + }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -5541,17 +7905,29 @@ "ci-info": "^2.0.0" } }, + "is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "requires": { + "has": "^1.0.3" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, + "is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-glob": { "version": "4.0.1", @@ -5601,6 +7977,11 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, "is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", @@ -5612,6 +7993,11 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -5622,6 +8008,11 @@ "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" }, + "js-base64": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", + "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5701,6 +8092,128 @@ "verror": "1.10.0" } }, + "juice": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/juice/-/juice-5.2.0.tgz", + "integrity": "sha512-0l6GZmT3efexyaaay3SchKT5kG311N59TEFP5lfvEy0nz9SNqjx311plJ3b4jze7arsmDsiHQLh/xnAuk0HFTQ==", + "requires": { + "cheerio": "^0.22.0", + "commander": "^2.15.1", + "cross-spawn": "^6.0.5", + "deep-extend": "^0.6.0", + "mensch": "^0.3.3", + "slick": "^1.12.2", + "web-resource-inliner": "^4.3.1" + }, + "dependencies": { + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" + }, + "dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "requires": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "requires": { + "boolbase": "~1.0.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -5751,6 +8264,18 @@ "package-json": "^6.3.0" } }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -5764,6 +8289,36 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.assignin": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" + }, + "lodash.bind": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" + }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, "lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", @@ -5794,17 +8349,78 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, "lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.reduce": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" + }, + "lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" + }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", "dev": true }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -5820,6 +8436,11 @@ } } }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -5831,6 +8452,28 @@ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", "optional": true }, + "mensch": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/mensch/-/mensch-0.3.4.tgz", + "integrity": "sha512-IAeFvcOnV9V0Yk+bFhYR07O3yNina9ANIN5MoXBKYJ/RLYPurd2d0yw14MDhpr9/momp0WofT1bPUh3hkzdi/g==" + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -5875,6 +8518,11 @@ "mime-db": "1.46.0" } }, + "mimer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimer/-/mimer-1.1.0.tgz", + "integrity": "sha512-y9dVfy2uiycQvDNiAYW6zp49ZhFlXDMr5wfdOiMbdzGM/0N5LNR6HTUn3un+WUQcM0koaw8FMTG1bt5EnHJdvQ==" + }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -5894,6 +8542,20 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, + "moment": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", + "optional": true + }, "mongodb": { "version": "3.6.5", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", @@ -6014,11 +8676,57 @@ } } }, + "mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=", + "optional": true, + "requires": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "optional": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "rimraf": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", + "optional": true, + "requires": { + "glob": "^6.0.1" + } + } + } + }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" + }, "nanoid": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" }, + "ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", + "optional": true + }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", @@ -6029,24 +8737,133 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-gyp": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "requires": { + "abbrev": "1" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" + } + } + }, "node-releases": { "version": "1.1.71", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" }, + "node-sass": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", + "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", + "requires": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash": "^4.17.15", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.13.2", + "node-gyp": "^3.8.0", + "npmlog": "^4.0.0", + "request": "^2.88.0", + "sass-graph": "2.2.5", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cross-spawn": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + } + } + }, "nodemailer": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", "integrity": "sha512-ikSMDU1nZqpo2WUPE0wTTw/NGGImTkwpJKDIFPZT+YvvR9Sj+ze5wzu95JHkBMglQLoG2ITxU21WukCC/XsFkg==" }, - "nodemailer-express-handlebars": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/nodemailer-express-handlebars/-/nodemailer-express-handlebars-4.0.0.tgz", - "integrity": "sha512-oUYl2D1AkFNwRe7RXt8iNTtmQGmI4Bt4PXRkE9lX891FHNNUB3I5yRDGL1WQPOujYIHH79uAvD3QzsBStG4SFA==", - "requires": { - "express-handlebars": "^4.0.0" - } - }, "nodemailer-fetch": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz", @@ -6119,6 +8936,17 @@ "abbrev": "1" } }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -6131,6 +8959,30 @@ "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "dev": true }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", + "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", + "requires": { + "boolbase": "^1.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, "oauth": { "version": "0.9.15", "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", @@ -6172,6 +9024,25 @@ "wrappy": "1" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, "p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", @@ -6219,6 +9090,42 @@ } } }, + "parse-color": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", + "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", + "requires": { + "color-convert": "~0.5.0" + }, + "dependencies": { + "color-convert": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", + "integrity": "sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=" + } + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "requires": { + "parse5": "^6.0.1" + } + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -6295,11 +9202,31 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, "pause": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", @@ -6316,6 +9243,24 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -6324,6 +9269,72 @@ "find-up": "^4.0.0" } }, + "postcss": { + "version": "7.0.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", + "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -6352,6 +9363,11 @@ "ipaddr.js": "1.9.1" } }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -6392,6 +9408,15 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, + "query-ast": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/query-ast/-/query-ast-1.0.3.tgz", + "integrity": "sha512-k7z4jilpZCujhiJ+QeKSwYXHc9HxqiVKlVE7/em0zBfPpcqnXKUP8F7ld7XaAkO6oXeAD7yonqcNJWqOF2pSGA==", + "requires": { + "invariant": "2.2.2", + "lodash": "^4.17.15" + } + }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -6440,6 +9465,44 @@ "strip-json-comments": "~2.0.1" } }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + } + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -6463,6 +9526,15 @@ "picomatch": "^2.2.1" } }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, "regexp-clone": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz", @@ -6486,6 +9558,14 @@ "rc": "^1.2.8" } }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "requires": { + "is-finite": "^1.0.0" + } + }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -6548,6 +9628,25 @@ "semver": "^5.1.0" } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, "resolve-from": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", @@ -6575,6 +9674,12 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", + "optional": true + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -6589,6 +9694,28 @@ "sparse-bitfield": "^3.0.3" } }, + "sass-extract": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sass-extract/-/sass-extract-2.1.0.tgz", + "integrity": "sha1-xl5soxA8vPL8oNzYGwfk5JpsxYM=", + "requires": { + "bluebird": "^3.4.7", + "gonzales-pe": "^4.2.2", + "parse-color": "^1.0.0", + "query-ast": "^1.0.1" + } + }, + "sass-graph": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz", + "integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==", + "requires": { + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^13.3.2" + } + }, "sax": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", @@ -6599,6 +9726,25 @@ "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" }, + "scss-tokenizer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", + "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", + "requires": { + "js-base64": "^2.1.8", + "source-map": "^0.4.2" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -6659,11 +9805,29 @@ "send": "0.17.1" } }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, "setprototypeof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, "shortid": { "version": "2.2.16", "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", @@ -6690,14 +9854,18 @@ "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "sliced": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" }, + "slick": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/slick/-/slick-1.12.2.tgz", + "integrity": "sha1-vQSN23TefRymkV+qSldXCzVQwtc=" + }, "smtp-connection": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", @@ -6721,6 +9889,34 @@ "memory-pager": "^1.0.2" } }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==" + }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", @@ -6742,6 +9938,14 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "stdout-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", + "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", + "requires": { + "readable-stream": "^2.0.1" + } + }, "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", @@ -6799,11 +10003,26 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, "requires": { "ansi-regex": "^4.1.0" } }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "requires": { + "get-stdin": "^4.0.1" + } + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -6818,6 +10037,16 @@ "has-flag": "^3.0.0" } }, + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, "term-size": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", @@ -6867,6 +10096,24 @@ "punycode": "^2.1.1" } }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" + }, + "true-case-path": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", + "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", + "requires": { + "glob": "^7.1.2" + } + }, + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, "tsscmp": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", @@ -7030,6 +10277,20 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, + "valid-data-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/valid-data-url/-/valid-data-url-2.0.0.tgz", + "integrity": "sha512-dyCZnv3aCey7yfTgIqdZanKl7xWAEEKCbgmR7SKqyK6QT/Z07ROactrgD1eA37C69ODRj7rNOjzKWVPh0EUjBA==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -7045,6 +10306,119 @@ "extsprintf": "^1.2.0" } }, + "web-resource-inliner": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/web-resource-inliner/-/web-resource-inliner-4.3.4.tgz", + "integrity": "sha512-agVAgRhOOi4GVlvKK34oM23tDgH8390HfLnZY2HZl8OFBwKNvUJkH7t89AT2iluQP8w9VHAAKX6Z8EN7/9tqKA==", + "requires": { + "async": "^3.1.0", + "chalk": "^2.4.2", + "datauri": "^2.0.0", + "htmlparser2": "^4.0.0", + "lodash.unescape": "^4.0.1", + "request": "^2.88.0", + "safer-buffer": "^2.1.2", + "valid-data-url": "^2.0.0", + "xtend": "^4.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "domhandler": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-3.3.0.tgz", + "integrity": "sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==", + "requires": { + "domelementtype": "^2.0.1" + } + }, + "htmlparser2": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-4.1.0.tgz", + "integrity": "sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^3.0.0", + "domutils": "^2.0.0", + "entities": "^2.0.0" + } + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -7059,6 +10433,49 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -7095,6 +10512,89 @@ "version": "9.0.7", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } } diff --git a/package.json b/package.json index 75b58db..5c95a72 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "aws-sdk": "^2.907.0", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", + "bootstrap-email": "^1.1.1", "cookie-session": "^1.4.0", "cors": "^2.8.5", "crypto": "^1.0.1", @@ -24,7 +25,6 @@ "messagebird": "^3.6.1", "mongoose": "^5.12.2", "nodemailer": "^6.6.0", - "nodemailer-express-handlebars": "^4.0.0", "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", From a45d11c6c4ba671cc81a35fbe826ea328d50ae63 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Mon, 17 May 2021 14:36:05 +0530 Subject: [PATCH 24/39] Completed --- controllers/auth.js | 32 ++++++++++++++++---------------- routes/auth.js | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index 791ddf9..7b99380 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -32,7 +32,7 @@ module.exports.postSignup = async (req, res, next) => { //we need firstName , lastName , email , password as input let firstName = req.body.firstName || " "; let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject, _html } = req.body; + const { sending_company_email, email, password, subject } = req.body; let user = await User.findOne({ email: email }); if (user) { res.json({ @@ -49,7 +49,7 @@ module.exports.postSignup = async (req, res, next) => { email: email, password: hashedPass, isAdmin: false, - email_otp, + // email_otp, }); user = await user.save(); await Student.deleteOne({ user: user._id }); @@ -59,21 +59,21 @@ module.exports.postSignup = async (req, res, next) => { student = await student.save(); user.student = student._id; await user.save(); - const message = { - from: `${sending_company_email}`, // Sender address - to: `${email}`, // List of recipients - subject: `${subject}`, // Subject line - html: `${_html}`, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); + // const message = { + // from: `${sending_company_email}`, // Sender address + // to: `${email}`, // List of recipients + // subject: `${subject}`, // Subject line + // html: '', // design html for email message. + // }; + // transport.sendMail(message, function (err, info) { + // if (err) { + // console.log(err); + // } else { + // console.log(info); + // } + // }); res.json({ - message: "OTP has sent to the Email", + message: "You Are Registered, Please Login", type: "success", }); } diff --git a/routes/auth.js b/routes/auth.js index bd71d77..7141665 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -17,6 +17,6 @@ router.post("/forgotpassword", authController.forgotpassword); router.post("/resetpassword/:_id/:token", authController.resetpassword); -router.post("/verifyemail", authController.verfiyemail); +// router.post("/verifyemail", authController.verfiyemail); module.exports = router; From bc90edb1aae7c09e5a7a00d1fcf2532cfb8e2b30 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Mon, 17 May 2021 15:11:13 +0530 Subject: [PATCH 25/39] Completed --- controllers/auth.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index 7b99380..d6558d0 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -254,10 +254,7 @@ module.exports.forgotpassword = async (req, res, next) => { - - logo - + @@ -272,7 +269,10 @@ module.exports.forgotpassword = async (req, res, next) => { -

You have + + logo +

You have requested to reset your password

@@ -282,8 +282,20 @@ module.exports.forgotpassword = async (req, res, next) => { following link and follow the instructions.

Reset + style="background:#ffc600;text-decoration:none !important; font-weight:500; margin-top:35px; color:#111;text-transform:uppercase; font-size:14px;padding:10px 24px;display:inline-block;border-radius:50px;">Reset Password + +

+ Facing any issue? Write us at +

info@cantileverlabs.com

+logo +

+ Privacy Policy +Terms Of Use +Contact Us +

+

@@ -302,6 +314,7 @@ module.exports.forgotpassword = async (req, res, next) => { +   From 4b9fa76134370c4b545c0071e4c2c056625e6790 Mon Sep 17 00:00:00 2001 From: yashraj verma Date: Mon, 17 May 2021 15:22:56 +0530 Subject: [PATCH 26/39] Update auth.js Done --- controllers/auth.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index 7b99380..d6558d0 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -254,10 +254,7 @@ module.exports.forgotpassword = async (req, res, next) => { - - logo - + @@ -272,7 +269,10 @@ module.exports.forgotpassword = async (req, res, next) => { -

You have + + logo +

You have requested to reset your password

@@ -282,8 +282,20 @@ module.exports.forgotpassword = async (req, res, next) => { following link and follow the instructions.

Reset + style="background:#ffc600;text-decoration:none !important; font-weight:500; margin-top:35px; color:#111;text-transform:uppercase; font-size:14px;padding:10px 24px;display:inline-block;border-radius:50px;">Reset Password + +

+ Facing any issue? Write us at +

info@cantileverlabs.com

+logo +

+ Privacy Policy +Terms Of Use +Contact Us +

+

@@ -302,6 +314,7 @@ module.exports.forgotpassword = async (req, res, next) => { +   From 7151cba2c42f34ca528f12133ce617dc85756ad9 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 19 May 2021 12:22:26 +0530 Subject: [PATCH 27/39] Added Blog Backend --- app.js | 8 ++-- controllers/auth.js | 11 +++-- controllers/blog.js | 103 ++++++++++++++++++++++++++++++++++++++++ controllers/coupon.js | 106 +++++++++++++++++++----------------------- models/Blog.js | 27 +++++++++++ routes/blog.js | 14 ++++++ 6 files changed, 202 insertions(+), 67 deletions(-) create mode 100644 controllers/blog.js create mode 100644 models/Blog.js create mode 100644 routes/blog.js diff --git a/app.js b/app.js index 43635e8..b02365d 100644 --- a/app.js +++ b/app.js @@ -8,21 +8,19 @@ const courseRoute = require("./routes/course"); const couponRoute = require("./routes/Coupon"); const queryRoute = require("./routes/query"); const adminRoute = require("./routes/admin"); +const blogRouter = require("./routes/blog"); const port = process.env.PORT || 5000; - const cors = require("cors"); +const app = express(); //const passport = require('passport'); //const cookieSession = require('cookie-session') ; //require('./passport-setup') ; -const app = express(); - const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; app.use(cors()); app.use(bodyparser.json()); -require("./models/Coupon"); // app.use(cookieSession({ // name: 'test-session', @@ -104,4 +102,6 @@ app.use(adminRoute); app.use(couponRoute); +app.use(blogRouter); + app.use(queryRoute); diff --git a/controllers/auth.js b/controllers/auth.js index d6558d0..9f37047 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -13,11 +13,11 @@ const smtpTransport = require("nodemailer-smtp-transport"); var transport = nodemailer.createTransport( smtpTransport({ - host: `${process.env.HOST}`, //`${process.env.HOST}` + host: `email-smtp.us-east-1.amazonaws.com`, //`${process.env.HOST}` port: 465, auth: { - user: `${process.env.EMAIL}`, //`${process.env.EMAIL}` - pass: `${process.env.PASS}`, //`${process.env.PASS}` + user: `AKIA2G7743RRTZMVXE3X`, //`${process.env.EMAIL}` + pass: `BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c`, //`${process.env.PASS}` }, }) ); @@ -289,7 +289,8 @@ module.exports.forgotpassword = async (req, res, next) => { Facing any issue? Write us at

info@cantileverlabs.com

logo + src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAABwCAMAAAC6s4C9AAABgFBMVEX///9YWFr+/v5YWFhWVlhISEj7+/sAAABQUFKcnJ7IyMhUVFRKSkpTU1VQUFD4+Pjd3d1qamqsrKx8fHzw8PCSkpTy8vLW1ta7u73p6emXl5dISEpkZGSCgoLBwcEiICFzc3PQ0NAcGhuJiYn///r4//9eXl6kpKQnJSaqqqoVExQLAAD/+v9BQUE8PDwPDA3t/////fIAW6QAXJwAU5YzMzMnHyL/qyf/+s7/qRQAW6v/sAAaGhdqZGfk+f/V7fN0mLUvY5ERVohdiKPA4e4hUnoAT4oASnuev9AAP3MYFx27y9UAQISBlKsARpUAXJhZfJsSDBYAVKaXttQAN3IAO4L/8M7x26Ht25GvzeBQR1drcmPjsEnjrhTeszT056fzsCn97pbvvDkUABEWFQj88cAoJBo3PC3a3s9OP0n/qTF4doHuy3XgoynqumT8uQDetADt2HvnrU5AZ4bryXv//uUBABUXGAD56Mvv1a5nXG8WDyzixVDfuGjsqj0gERIXE4LXAAAbTUlEQVR4nO1dC2PbxpFeLskFRYBYgARBgk/wAVCiSMm0ZVmyHKe5tHm4vkvTtHbS2ol6iXO95qE2ta/Xu17y129mF+BDBChRsmOpwedEAonFvr6d2ZnZXYiQBAkSJEiQIEGCBAkSJEiQIEGCBAkS/HigjFL2uiuR4FKgjNHXXYcElwJ3SELhtQY1FeN11yHBxcEpd5XudsLh9QUyuNkdVl53PRJcGMBge9hOGLy2oMRU2t1NgyfmzPUEeIMNkMHNCqjT112XBBeCkME2zIMs8eyvKVgDLJmugZ59okivISjlbyjte5sG6QMo/AQeEyavFfgb2/vDewZo0X6feUAhgR+vu1IJ1gBrbO+DLUqod//N+zc8rz9JZPB6gfnb6E1Q782fvfUvb739cw9kMeHw2gDsF5ZSAgZ/8c7ezVvvvPsecAgU4nzISeImXnkIf7DbNojnvfXO3t27N2/eev9NT96i1Ers0ysPSqpK+8Gm0/e8Xz7cu7V369atm3tve0gco2SgVBKNevXRuNd+UCF9j/7r3q0PEDfvvnUDbyCD7esX9MYhh7qD0p+MBsl2HzRgxqOepHDv5t2bb91AD58Cg22leK36AuZwil4tzuN0NLo29b4c/OGDHdqnzHvv38RM+MGtvV95YOWQgEGG8+V1AVCI1jQl/cmLyeSn4toCUx+W0KO//9tf//rXd0ES3//Eg3lwQzCIXNrXZ0cUEDgRQgjoTyavuzqvFnLKALDbD7rbwKHnffQbtEhv/ebtG8DZRqBFOakMWyRelYpIXDzFUgmH/6+sTfiLkoUhQ0mQBSUrqhEmBt480azRaOR54eMrwoX07EwxBZO/lxoaPMxWdkJYElvVCXTu5/kQVAeqUFH22wpw2Pc+effhw9/+9mc3vCmDNiOG0lVasVkzqP2KujNJodgWF7sGEnYDm/5eoJDJzuHwNbipq1s16r/oe2Ty4tHjjz8+GI2CKjAav/5CxcbL+BzROQ5j/8v5hJUjjPPVuoqJvYGrtgeK59dZKGIkX2qUK/igoexvKi5hfe/Gz9/75D4w2K8hg1XM0FDam4oZXzYUaRVdPRsN3ZaCxVuuqmnacgKtVOWBqJLWbZFAdxa6FK63drJaVhsPCHEisphD/Xfj3/cpP/j4ydOnTz99PIFneWOsabo2dmJ7ojqOrFmInRaxdJnAXO5gzhpjbIau2sQdr6iapo05eHA7KxJoullcZ7HWaijD4a7iWkBOZf9BW3FHIxhJoIn6yOCDTWAQ6R124RaJHcYwsLa0rJqOg6yS0RirMWnUrB76nnkt+M5aKIGRorihFwmx9diSEKnfqb+no8lnn54cHR0eP/kD2DPcxIJ93VquO5EKoJpdmaeWnybJtk7LK53dIqQU18YgIyxLW5UirepY2nkARpv1u8/32x+CBlVtr08qbcEhqBQ0B1gtmAcZ6QCD2yVKYvwK+NIujVOpVGylGPaSoeupVEyqlJ/J5iWH+awvkhRce05xw/NIoSopVOOLwsxS6u897+AJEHh45/j430EMgUIo2C+skML6ivqnU1g71kinMHeTz89nOLnhHXzchE+llQymNVHWipLEv3rnHJMzKlwr9/n+8It0GwjSbKhJZ3MIujSYNXpKu6tUYQognXZ3Xymt8gupW/dTsUAppJSnC/FJMJUm+zdfl5/9eokzPtdTRQ2zklK4Mieg0PW8Z8eHR0dHJydHxxNQ4SYUnkmdQeEKCLnIZ8V1vUrozGxBNoOHxSgECuO6AaELKTyj/qmMdr7N2Ja2/eUX//HHyR+17f3P/3OECrOLChOD3shgMA9W2kPUorF79IHarZXtRwoZqZ3R7+l0aYHCTKpepuyiFBL67Pjo+PgYWDw8J4UxPS8BFEI7G8EoXBjO8EF+WzBRZb0UClNq8zxSyOu7wKDj9ftW/UPg0Ia6yEkPHg4YhCpVdrsomqtMSWt1lVCRgjGwsoswlWbMU4gcbpAYCjOrs9K/ovTgycnJnT/96c6dO0KRXo7CtKQwP8ZchBjOKhYKYWbcOQeF2tkUZkQTztyLzSnf2b33xY5DR9Tz7PpuezuLa0rgPLR3b5fGgkHUYx28KpHYiVBM5rJKmXoqE4W0DxZpKytUbT2XKizehRpncqKF+kB005xE13Eq5vQUhdRSF57PYM4F/BF8patfjUYvvj6GufDo+JuvhTlzHgohLz+6CaouDQw/GDuLijQtvs2Y4rOkEKpzqp2ZNE7laZ0HFGJWywWlcjnRfh86YzUotXe++PLe2ALfF9wdz9O/+HJ7B+0HY7fbbu+2gbeWkEF0F5vwgCcclqhgFSVNodhybnwHUdCj2LJcLfJ2MVfw1bSK5cxT6Gd2qqECn6dw8eGNHPZgbsGI89hocvDtnZOTkz9//ejcFEIuxdgWiGp06kKVZqvz6qGaDYUQISnMxZYUSmEmF0NSGQe0CnPBGbDGu+17dWs0eXHw7AAcYS+33R6OwRdjxm2l2wVHIy/mQWV/HxiEKxHk6EdTaArVUY8TfTSPSE+2LMLSgptOTugZF52POQphKI/zwXifp3BRp9cKSOGcHU5H/b4HLXn0/Nsn//jLQX8NCutxFIaevysoTKt8xiFPi+YXXPkxoNCIjNMw6cAICgsbkeWAkSlKMM9w763sbnsXGXz2/Ml33358MBmNQJfuZi2oqr2h394xDfTjQYsig9S7/8v33nvT8ySFS2s4pmhX3aIyWBf+Cn6jNQqSKhqaqwShmrm78M8poMmvunymSP0CPpBJaRWpwucoRLmcFgAUYpNTmoj/yS9HuANvNCKT/kjs4bokhZTKUYjoSKNU2xK9IP4T9YKJuzJPYd2JmneoHAly4sltEDLrqxCM2HLi9O0V/HHiIIOaRcH9PTq6c3Ty5DPmcX13c3dsiSCYbYuAXx6Nmx4w+MlbD9/Ze/j2m14/rMdcIAmkMCMpXFEmaQp3CQhhEQFJR+jCgkunijQ32BD+e6qQqgRMz8yZRdREQm0x/IfPbA0QG9gVwrU/x1wIhko0giEL1gqWBimtcGRxH6e4tFoKypcUanElsZDCtL5B6HK8lRELZ8m06q8M0aAWBRnsg9UGzhO4T8ffPgIOc7vtocbCkDX4g12wRZHBX/7i1i3cT/PX+56sBXod0xLWpZAuQUjhKQprpKT5PnLoO2R9ClH3F7ScnsuJoNr5KARm3Fo5CoNppL4i4jCpuvwGGKhqPn6TrQSaMzBnepH59DrkFIWnqkGJmFUwTLCKQmsH5E1z+nz0/OnhHfCc7tx5+nGf2FwdoiMhFwmAo50u2qLMu//Xd27u3cLtNB8FFBJ7Zzahr03h8k0nVVim0HaRGz9TMC1yAQqpNB8zGlbrvFIIRkYU6m5QbWCpqQsND/YKQxPHEnZmWm+GKyuBU5ErnM5EB6B5Nk8hs2y+CNsqy7mwGVdToJ3fHoIWtQnMf9+eHILVdnTn8OTrCRjvzmZ3qIbpWEvBsLfHvJ+/f/PuTaDw5q1f3CDCQbR30Ny5IIUkX2qexrIUlsH9a6ioSMHUFebgehRCOf6sWueWwmiAqRIstgRiWMCZjMmBlZZCGArUSr9Q1nJKISOtnUIhV5gDeBUisRbrVDAGPLV3VRjYfcqfAIVHx5JCjM6Yw253SsyG0lY49yh57527d2/u4V6M9+8L5W3jIMiyaco1KWyNdRWwUPEICkG/qmnpTJbWl0L41MiI+MAaFMYBKZy1RAYpco6wPVAG/bTem95eSWH2FIWMFMeLqdA3FHeduOgMpUVgJmcLLTB5Dt7vEXrAT5/34TMfD9ub0x4YQEKHgQXz3kOQQNCkSKFwAXaGm7v6hedC8PJlQHe5oxYpBCdVFTn79TI8tnVFKDR0Id5QQxDDLSxc9fXZ/rB1KKRhcDKN/4kYdwAYE7ELe8C7krGFEcEmj7/HmfDo8PjTZ2hmNpX2dmnaBYbSHoJZNOm/uXd3b2/vg727N//qoe0x3kUG2UXnwmgKMxEUwgetgP5FagzWA0ph5gpQSHpCDEUk2goCnzMhXI9C9FVqUeE23Yld/0eNXZRRcDpiL55/AxweHX/zeDJivIlnC52pg0Ibu20lBb9v/Az3d6MQftKn1EFzVuN0XQoLKUkhPbVcFhIYoUjlJzHmwWEr1n8EKSxoURibcyFiZsgQLU7XW6JOGd2Y9XdoztTrERlJK3BKobD9WVMPu6EgJDGd0rOdlUv7080flE4Onj85Pj5+8vxFnxIXo6HwKA+3Fzi3h5vKGyPqvfmrh+98cGvv4Uc3+kIGhzqna/uFMwrzi6urcohGUggoypAWuO7VH4HC3IYRjTn7n5KerFLd4VKACvNaL4jOtCKzqVjYbTMKhcOJpnewVldIqWlVzzaMM5YLg2BRv+95/RfPHj9+/OzFhHklYHC7I7yJam3LCDn8L5+DW/HRW++++6tPbnjUAYdEARnEPacXpbB6ezyHbL1ezxWiFKnMfaDJtqXQbH3FFGZiA2xzO2tgKpHM5cpb8mJhcW+lay9PbM5TKDg09VAZuX6j0WyJ/TNnSKEIWfeph0fQxI49lMGujIt22grAtymn1mb3wYc+pLsBwLCjDeasojPG2SUUqW04i2PT6cRSCMJerocj9NVLYTSFVJwbmn6CKhVm6h8qVp7v7zDAFh0jpfQ0hUiHE86fOeE3UtG951gvxH3OnkCfjr5S9rvDDjLYUrrtdntzd9NBz3Pzwf522kay2WTSd9rD9naK84XaMeKqqVXBKTGiphRGtUwEJGKkkLJmbs4kuDiFGFmOGWVizW9lmHtxd6FVn/cg6wsDY0phDJYoxK+McBF7nCf8jPj2fF5AIcVdh/0J/erz/R8EgxQc+i7MdsP2cBMHkrO5u6+owCHuzTRuf7ippPjiS/ag+RuyArmNfAwuRSHlbu5lUIg9W42uHw8pLJTjmrDoptWmm0gymcLiAloQYIspKd+KopCSzljKNAbq1gAepwduRv2Jq+zf2+4g/y3Upz3L8MGjuI3vTbB2QA5VjveMnQ/3lZTN5rWKyKYTuKe5uJ118PBFKUSF4piFl0AhrujCvFtfqt5YtQkNLNK4JuzkF7K366EWzYgVmiUK0SKN6IixtkOiKISOl4INTuYar06jnmRwNHK32/e+AAY5nlHbV2oEJK6hfDnccYBkawzEAYfA4IMHn4Nxg1hcFBCdha1JR0L1+ZlSiL6tKinMopc7nQuJDINnpNG6JoXpRSnMBMNgqX42nfqF0U3ANa8FDKRDDs/UT0XCZn5hRD5+Ro+WQnDXoQJpP62qMqx/fhoZ7isByRtKBrf397fLyGC/31A2h7cxlotG6O54o3x7COLIlrZtY/HGTtpf9tZn2o/PufZRtXMECyGFwlkuzxJimGa6SXUdCsUD2XlFGlm7dGOOwhhoncXsnZB+3O8aJYVxyE33keoLS76UDrJAIHSjblrrHF9BNRUySFGLogyykcD/KF/+re1QyWF3e7e7uZ1ic5botKvgm+pYcPiKKCQcdPWlKYzpU5SNc1G40G9kINeYcI/LYn9fkELo2F5WLj3q7jov9IWkJkibUkE/r4W77sFAnrz4778/fsSBw7998b+Cw7HSRW8CbdHlJS60glle01aM80tSiJLfGr9qKVzV8acppNQSvQ16zzrVoItSyAkr6b5sY4mcH5SjvuwigzgPtpUNMpp8/OnTpydPn78YvaF8+WDogO3CypuKMuyhzxG5nQC+tGtqVo9cbMvpKuRe0nC9bNyJnguzeFNzcUdKfgevs2UyFzsQCxVjXeSwtAhTkzmfohCeTssbgsIGXMfUTtfSNp6piL4tURh3Trcc6qPq2nhrsUHgYGtLK4Vz+eTGSKFoirZgyeKuGuZmVdHInSY5//u3Okq3uwk2hk2KAYOjvx+fnJwcHv356wl4i1/eE+/zItQw7KhjWXOwOsWNGIAUFmt4UYuOHFk1vFsrogIxyiJh69ThNJioRZra0nGDlnz4VM54ulV8X8aNF0xcx6C2AX5SpxyfAFA2TlNo1/DJ2tIOl+KKkrAw6ItOLWjicj8EFeqdb0O+6BmSV6QMtsC3BwZZ/+A73Inxp8Ojpx9PRib6Fo7YMya2zKzIdmU8aBbKiZbj2cUsmrzIyHxMdgHRD9DZA+cwDc4x5JdGb8wTZ5a2EKo7lSWNTHZGfjDJCH8QvYltXMDq/+Gbw8NjXEM8+cfBiMJMKTYhsnC/WCyW9mLN7coS8aLZVpnlZyOeWbSb5rJY6hJGInKelYadShdrcHrvDltR+aA2EeXKO6dawlaUI0qic0mWmyK/FccQz22V4kYKJrWomGX6fzk+PDo+PgRRfAIU9rVhF8M002O6F4Hc6hVEW2LrsXjz9JHc2KF71vfnrPUF2kYjnjpjgWFxul6Z9zoVgmmmCBanIrbDTyk8Ojr67hHz+rjIn7yf9IoDD1IMN5UNyVP/s2+AvqfI49cvPNYfbCOF1+eFJT9JgNLND5WtcAY9+D880QX45rOJxwzQsG0rcgJLcKVQnXlb/Wffwkx4eOf75wd9atwDj76cCOHVB52baenk2fPvvv/+288OJrSyf29TcVc7EwmuBubcKLBCXxwcPHox8bzK/g9txZ2+iyLBVcYcSWIpH48TepXNH/bFse0IF+a1IDy6NEP4whe6aOCvX18a4byvSHtxBysyw5ffveJ9CczoDvFdM2e8DOfHBCPGKYc/+AhVtOxZNaNDQPGgBu5fWSMewl6ul7UcIbg8sJLGLnj75nScXwFARbRTA8oKKKRka2smGZTaa1Fo+zZx0udtqOjvlys49OV3sjjfiy9OEC+tuiocQtdpfEEK7V0ZKsa30hTn7Ga+c9ZJ9QXwBieOf167G2pQit8JdxEwftaR3vUgA3+GIt5zgfriqvxBURz8ujxgOg2XdmwSDLKtolyUkhHNjjjPRqW0yHfvkTDGy4I0QpzEtSUpZOGUKP8tnFUOjiUTGbJvOCSMcYZDXO4aFJ/kuUMZu5WrqUS+FJCGP4LMGQ2UKE+zIKYm23ZJMRcB1sqwLWXwqkggAtqkEWpbIlIM4mjzICxsW1xQCH0BV5zjjnRIAXrWEmesCbNswsMd6Ex8FH2EyfFo+kwKLStgjMOjXOwSsmSBzLbCFyFS0+C4+i2eD/7uMZZi20QSAxMzXnC4wjODJDg1LZIAn5zCdxbHU37w0WbM8jm3sVTLkpvLLPsyf+UFa9Rp4+nQiF0WrxVQF533TNPFPVS9Sk0tEteBFg8artsCRcpJ0XTNYn5AaM8g3LR7rtnEnum4ptuzzPDdGS3XNXt4tGwLLsrA7JRCp2SKO8Tqma5rQC7MhqsSLscN4Btcq6Sc9NJuyXQIr0Fxg+kbOYyS65bycDvvwoUB46lXKatVavImlC/eXQB3zBKYZKTp9NQWcSBv06gZdkktlUoccxDF87JpliqXkEKKDEoteuWkMG3mbd5RgcNeowgiAB1JmzWLQ5cXCamVHGYN/A1CSwaxG2aF81qNkI4KQpNvpAPlVG04nLeawHMZZKTocxZQSBy1w+0WfpGucm6UNINxH690h+RLNje2iNR8IIUgO+bA5latGVinht7BZxzS8qG4Dr76xzWrIGtps2OLz7SK0tvBNySV/JYFxRY5M0zfACm0bKhCOg8Vg7psDKC+rYtTyGml3ZVv7Dpr7eRHBlQmK1+G0yCkKbYtAIUdF6cQ7heJo4kZp7kBXQSDPovbXRwwFHyx4p7Xg6lubMtWYS6AcpEICuFTTxhHG0WyJba1WGODVMVVq0eqvXCmwxMIaM5U5VFqN9iSUZKWFeOaWMjvuIS64uzSTh6Vdwfcs7SwgvImPASaggxE3g6UwtJ41RMbEmpV0quSS3U9tYe7yOAV8gcDQKN0LuZ9jZOm2NgJfQlNRktiUCStmujffE1QyHVMAOqTa8Jo53gEHQ9ah+fmB/J1AYZJAinkja1isVgt94gpt+OC9ivVqvDdlgp62W2xYJ7E+2CWyq2lVbkFxvbFRnqRP/5maRufhys8igl9maWVkmyFb+EdkGVp12Jd0zgKzSICinf0ZuUycyGoZPHu0TU24PxIgPqowpogqkWaopehF8r50Kk4RaF4a4BtUlsT83tIYacZDPCBFBtnRqFZrCIqJOhcpHAgvsrjPsimeOnTlELXENnkJYVg1cruqgjhpAQpxGyoKk0nlUsKCQN71sUZT5ZCmyGFjaosHhK33NN7j9cBzICVpnz/8MUzeSWApqHSwdf2CZKIoLBYE2Z7ExSpLsgJFCkXysk2OVHFziihSNFS0QMpbMmjudVySKGUGsQGTnpCkdaCN3uItz3ZY0eeTWpg59fkdshykKIhGcVaiF/pID86xn2cqOUtX6gQB365eJxNKk6mirrCw4FYS0ffSP8T/h1XFCXdRfO8B503lUJLxTmvmsXvepzxoh5Q6GMCUKS0lXYYM/zQd0eKiVWFBCiGhuYAhbaYCzsNC8gaWDBG8kBqEwwPBywZQrcMkkfW8G3TOLjRJqaOOGDf8oOptYUvimFVi/Rq6FaYLRpQqJXAQ+AlYLpco7ilFWY6F48cVXzMu6yhxsD3jedNLH4DTCdopLX61UHXFNAzWqfRqzUGLOgeAuRQo9GslXoD9AsHjZJZA30Kmg70J/ashVNUHvwBFyNo8sUjTbdWBuuHOG6p1vM7eGKeMxFgqzbKtcYGE95FyczjMMECXTD4W/DbrMnXtJOqX3MtsId6tZIZbH4EVZ4u19wyeHtlswb2MmRnomDSdL5R7jW2gHpwFqBk3HmKx3gZ0F+umYMepCq7ZdCyRWzcBiM1s1zz44/6XWNg2I9Ynbx4aY8h7L4Kuj3MqIK4OPgXpG3HIq0BfAPGmFBLrCKiN47DYC6kQTZGvmMjFdxoVVB0MBEXCZ18S2y55MxyOMgKA7e80jLE60k6eSPc6UYqeQc9e7gVePZo/Tn5vCOmSnEBlIm/Sw5zoRPUmVC4Y6FnaXARh+Z4A1rC4ALD9E5HFC9+XzVL5KVABqQICfYMEvkhiHPjwQupesyODFMFd2nwx8G3atO0JHgkWOWQewNJcOROhFXEI046DG5M04oKBNv55h4PKxdG8mS5MtjGdFEXyuZSMkLZfPly42EQq5PLLK9g8eKqA7upVspXOu7Sm6/yeqtSqWmr3iy4CGarg0qlqEWfHlirVkDXePUfpkgwA4zeDkyKS4cfQJwGzVL1/L2IEt1qNjfWO+cXlxff4P+UOvHlg07/QtBSh/FwWfi8WTF53P1lSI9cjPjJ6cSLYbplPGKHtZhA18mKTae0S1eLXLEwZYIECRIkSJAgQYIECRIkSJAgQYIECRIkSJAgQYIECRIkSJBgLfw/Hmu6adIWw+0AAAAASUVORK5CYII=" + title="logo" alt="logo">

Privacy Policy Terms Of Use @@ -369,6 +370,8 @@ module.exports.resetpassword = async (req, res, next) => { await user .save() .then((ok) => { + res.header("Access-Control-Allow-Origin", "*"); + res.header("Access-Control-Allow-Headers", "*"); res.json({ message: "Password Updated!" }); }) .catch((err) => { diff --git a/controllers/blog.js b/controllers/blog.js new file mode 100644 index 0000000..f6ea6c1 --- /dev/null +++ b/controllers/blog.js @@ -0,0 +1,103 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/controllers/coupon.js b/controllers/coupon.js index 2220624..238e1ed 100644 --- a/controllers/coupon.js +++ b/controllers/coupon.js @@ -1,64 +1,52 @@ const Coupon = require("../models/Coupon"); -module.exports.getAllCoupons = async (req , res , next) => { - try - { - const coupons = await Coupon.find() ; - console.log(coupons) ; - res.json({ - coupons : coupons - }) ; - } - catch(err) - { - console.log(err) ; - } -} +module.exports.getAllCoupons = async (req, res, next) => { + try { + const coupons = await Coupon.find(); + console.log(coupons); + res.json({ + coupons: coupons, + }); + } catch (err) { + console.log(err); + } +}; -module.exports.addCoupon = async (req , res , next) => { - try - { - const couponCode = req.body.couponCode ; - const percentage = req.body.percentage ; - const numAllowed = req.body.numAllowed ; - - let coupon = await Coupon.findOne({couponCode : couponCode}) ; - if(coupon) - { - res.json({ - error:"coupon already Exist" - }) - } - else - { - let coupon = new Coupon({ - couponCode : couponCode , - percentage : percentage , - numAllowed : numAllowed - }) ; - coupon = await coupon.save() ; - res.json({ - message: "Created Successfully" - }) - } - } - catch(err) - { - console.log(err); - } -} +module.exports.addCoupon = async (req, res, next) => { + try { + const couponCode = req.body.couponCode; + const percentage = req.body.percentage; + const numAllowed = req.body.numAllowed; -module.exports.deleteCoupon = async (req , res, next) => { - try - { - const couponCode = req.body.couponCode ; - await Coupon.deleteOne({couponCode : couponCode}) ; - res.json({ - message: "Deleted Successfully" - }) + let coupon = await Coupon.findOne({ couponCode: couponCode }); + if (coupon) { + res.json({ + error: "Coupon already Exist", + }); + } else { + let coupon = new Coupon({ + couponCode: couponCode, + percentage: percentage, + numAllowed: numAllowed, + }); + coupon = await coupon.save(); + res.json({ + message: "Created Successfully", + }); } - catch(err) - { - console.log(err); - } -} \ No newline at end of file + } catch (err) { + console.log(err); + } +}; + +module.exports.deleteCoupon = async (req, res, next) => { + try { + const couponCode = req.body.couponCode; + await Coupon.deleteOne({ couponCode: couponCode }); + res.json({ + message: "Deleted Successfully", + }); + } catch (err) { + console.log(err); + } +}; diff --git a/models/Blog.js b/models/Blog.js new file mode 100644 index 0000000..33e6c55 --- /dev/null +++ b/models/Blog.js @@ -0,0 +1,27 @@ +const mongoose = require("mongoose"); +const blogSchema = new mongoose.Schema({ + title: { + type: String, + require: true, + }, + author: { + type: String, + ref: "Course", + }, + date: { + type: Date, + }, + image: { + type: String, + default: "", + }, + body: { + type: String, + required: true, + }, + isBookMarked: { + type: Boolean, + default: false, + }, +}); +module.exports = mongoose.model("Blog", blogSchema); diff --git a/routes/blog.js b/routes/blog.js new file mode 100644 index 0000000..51e5d57 --- /dev/null +++ b/routes/blog.js @@ -0,0 +1,14 @@ +const express = require("express"); +const router = express.Router(); +const BlogController = require("../controllers/blog"); +const isAuth = require("../middleware/requirelogin"); + +router.post("/add-blog", BlogController.addBlog); + +router.get("/get-all-blogs", BlogController.getAllBlogs); + +router.post("/delete-blog/", isAuth, BlogController.deleteBlog); + +router.post("/edit-blog/", isAuth, BlogController.editBlog); + +module.exports = router; From 45b5a2eade9bf72378722f0b8ebeb086e83b8df6 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 19 May 2021 12:34:12 +0530 Subject: [PATCH 28/39] Blog Completed --- .history/controllers/auth_20210519123339.js | 405 ++++++++++++++++++++ controllers/auth.js | 6 +- 2 files changed, 408 insertions(+), 3 deletions(-) create mode 100644 .history/controllers/auth_20210519123339.js diff --git a/.history/controllers/auth_20210519123339.js b/.history/controllers/auth_20210519123339.js new file mode 100644 index 0000000..675a180 --- /dev/null +++ b/.history/controllers/auth_20210519123339.js @@ -0,0 +1,405 @@ +const bcrypt = require("bcryptjs"); +const User = require("../models/User"); +const Student = require("../models/Student"); +const jwt = require("jsonwebtoken"); +const JWT_secret = "Cantileverlabs"; +const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ + "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", +]); +const nodemailer = require("nodemailer"); +const smtpTransport = require("nodemailer-smtp-transport"); + +// -------------------------------------------- mail transporter ----------------------------------------- + +var transport = nodemailer.createTransport( + smtpTransport({ + host: `${process.env.HOST}`, //`${process.env.HOST}` + port: 465, + auth: { + user: `${process.env.EMAIL}`, //`${process.env.EMAIL}` + pass: `${process.env.PASS}`, //`${process.env.PASS}` + }, + }) +); + +// -------------------------------------------- mail transporter ----------------------------------------- + +module.exports.Protected = async (req, res, next) => { + res.send("Hello User"); +}; +module.exports.postSignup = async (req, res, next) => { + try { + //we need firstName , lastName , email , password as input + let firstName = req.body.firstName || " "; + let lastName = req.body.lastName || " "; + const { sending_company_email, email, password, subject } = req.body; + let user = await User.findOne({ email: email }); + if (user) { + res.json({ + message: "User already exist", + type: "error", + }); + } else { + const email_otp = Math.floor(100000 + Math.random() * 900000); + console.log("otp", email_otp); + const hashedPass = await bcrypt.hash(password, 12); + user = new User({ + firstName: firstName, + lastName: lastName, + email: email, + password: hashedPass, + isAdmin: false, + // email_otp, + }); + user = await user.save(); + await Student.deleteOne({ user: user._id }); + let student = new Student({ + user: user._id, + }); + student = await student.save(); + user.student = student._id; + await user.save(); + // const message = { + // from: `${sending_company_email}`, // Sender address + // to: `${email}`, // List of recipients + // subject: `${subject}`, // Subject line + // html: '', // design html for email message. + // }; + // transport.sendMail(message, function (err, info) { + // if (err) { + // console.log(err); + // } else { + // console.log(info); + // } + // }); + res.json({ + message: "You Are Registered, Please Login", + type: "success", + }); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.verfiyemail = async (req, res, next) => { + const { email, otp } = req.body; + try { + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await (user.email_otp == otp ? true : false); + if (isMatched) { + if (!user.isVerified) { + user.isVerified = true; + await user.save(); + res.json({ + message: "User Verified, Please Login", + }); + } else { + res.json({ + message: "User Already Verified, Please Login", + }); + } + } else { + res.json({ + message: "OTP Doesn't Matched!", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch { + (err) => { + console.log(err); + }; + } +}; + +module.exports.postSignin = async (req, res, next) => { + try { + //we need email and password as input + let email = req.body.email; + let password = req.body.password; + let user = await User.findOne({ email: email }); + if (user) { + const isMatched = await bcrypt.compare(password, user.password); + if (isMatched) { + const token = jwt.sign({ _id: user._id }, JWT_secret); + res.json({ + token: token, + }); + } else { + res.json({ + message: "email and password doesn't match", + type: "error", + }); + } + } else { + res.json({ + message: "No user with this email exists", + type: "error", + }); + } + } catch (err) { + console.log(err); + } +}; + +// Phone verification Starts. +// ----------------------------------------------------------------------------------------------- + +module.exports.sendOTP = (req, res, next) => { + //uNNYosMopvvCW9RTR1tRWJmYC test + //llVKD53ve6QRpbCKOHzWBADaS live + const { phoneNumber } = req.body; + try { + if (!phoneNumber) { + res.status(422).json({ message: "Please Add All Required Fields" }); + return; + } else { + messagebird.verify.create( + phoneNumber, + { + template: "Your verification code is %token", + }, + function (err, response) { + if (err) { + console.log(err); + res.status(422).json({ message: err.errors[0].description }); + } else { + console.log(response); + res.json({ id: response.id }); + } + } + ); + } + } catch (err) { + console.log(err); + } +}; + +module.exports.getOTP = (req, res, next) => { + try { + const { id, otp } = req.body; + messagebird.verify.verify(id, otp, function (err, response) { + if (err) { + console.log({ error: err.errors[0].description, id: id }); + res.json({ error: err.errors[0].description, id: id }); + } else { + console.log(response); + res.json({ message: "Code Verified" }); + } + }); + } catch (err) { + console.log(err); + } +}; +// Phone verification End. +// ----------------------------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------------------------- +// Forgot password Starts + +module.exports.forgotpassword = async (req, res, next) => { + const { email, link, sending_company_email, subject } = req.body; + //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token + try { + await User.findOne({ email }).then((user) => { + if (!user) { + res.status(404).json({ error: "User not found with this Email" }); + return; + } else { + const payload = { + email: user.email, + _id: user._id, + }; + const secret = JWT_secret + user.password; + const token = jwt.sign(payload, secret, { expiresIn: "10m" }); + User.findByIdAndUpdate(user._id, { + $set: { passwordResetToken: token }, + }) + .then((data) => { + const reset_link = `${link}/${user._id}/${token}`; + const message = { + from: `${sending_company_email}`, // Sender address + to: `${user.email}`, // List of recipients + subject: `${subject}`, // Subject line + html: ` + + + + + + Reset Password Email Template + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
 
+ +
 
+ + + + + + + + + + +
 
+ + logo +

You have + requested to reset your password

+ +

+ We cannot simply send you your old password. A unique link to reset your + password has been generated for you. To reset your password, click the + following link and follow the instructions. +

+ Reset + Password + +

+ Facing any issue? Write us at +

info@cantileverlabs.com

+logo + +

+ Privacy Policy +Terms Of Use +Contact Us +

+

+
 
+
 
+
+ + copyright 2018 Cantilever Labs +
+
 
+
+ + + + + `, // design html for email message. + }; + transport.sendMail(message, function (err, info) { + if (err) { + console.log(err); + } else { + console.log(info); + } + }); + res.status(200).json({ + message: "Link is Active for 10 mins", + reset_link, + }); + }) + .catch((err) => { + console.log(err); + }); + } + }); + } catch { + (error) => { + console.log("Error from forgot pass", error); + }; + } +}; +module.exports.resetpassword = async (req, res, next) => { + const { _id, token } = req.params; + const { password } = req.body; + try { + let user = await User.findById({ _id }); + if (!user) { + res.json({ error: "User not Found or WrongId" }); + return; + } else { + const secret = JWT_secret + user.password; + const user_token = user.passwordResetToken; + const payload = jwt.verify(token, secret); + const hashedPass = await bcrypt.hash(password, 12); + if (token == user_token) { + user.password = hashedPass; + await user + .save() + .then((ok) => { + res.header("Access-Control-Allow-Origin", "*"); + res.header("Access-Control-Allow-Headers", "*"); + res.json({ message: "Password Updated!" }); + }) + .catch((err) => { + console.log("Error in save", err); + }); + } else { + res.status(422).json({ error: "Either Token not found or Expired!" }); + return; + } + } + } catch { + (err) => { + console.log("error from try catch resetpass", err); + }; + } +}; + +// Forgot password Ends + +// Email verification Ends + +// ----------------------------------------------------------------------------------------------- + +module.exports.checkProtected = (req, res, next) => { + console.log(req.user); + res.json({ + message: "Protected", + user: req.user, + }); +}; diff --git a/controllers/auth.js b/controllers/auth.js index 833b8f3..675a180 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -13,11 +13,11 @@ const smtpTransport = require("nodemailer-smtp-transport"); var transport = nodemailer.createTransport( smtpTransport({ - host: `email-smtp.us-east-1.amazonaws.com`, //`${process.env.HOST}` + host: `${process.env.HOST}`, //`${process.env.HOST}` port: 465, auth: { - user: `AKIA2G7743RRTZMVXE3X`, //`${process.env.EMAIL}` - pass: `BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c`, //`${process.env.PASS}` + user: `${process.env.EMAIL}`, //`${process.env.EMAIL}` + pass: `${process.env.PASS}`, //`${process.env.PASS}` }, }) ); From d25cc5b42fa5c837c09e52a7869736306c7a378b Mon Sep 17 00:00:00 2001 From: yashraj verma Date: Wed, 19 May 2021 12:38:12 +0530 Subject: [PATCH 29/39] Delete .history directory --- .history/app_20210519122521.js | 112 ------ .history/app_20210519122841.js | 107 ----- .history/controllers/auth_20210519122521.js | 419 -------------------- .history/controllers/auth_20210519122752.js | 404 ------------------- .history/controllers/auth_20210519123339.js | 405 ------------------- 5 files changed, 1447 deletions(-) delete mode 100644 .history/app_20210519122521.js delete mode 100644 .history/app_20210519122841.js delete mode 100644 .history/controllers/auth_20210519122521.js delete mode 100644 .history/controllers/auth_20210519122752.js delete mode 100644 .history/controllers/auth_20210519123339.js diff --git a/.history/app_20210519122521.js b/.history/app_20210519122521.js deleted file mode 100644 index 2f07095..0000000 --- a/.history/app_20210519122521.js +++ /dev/null @@ -1,112 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const couponRoute = require("./routes/Coupon"); -const queryRoute = require("./routes/query"); -const adminRoute = require("./routes/admin"); -const blogRouter = require("./routes/blog"); -const port = process.env.PORT || 5000; -const cors = require("cors"); -const app = express(); - -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -<<<<<<< HEAD -======= -const app = express(); - ->>>>>>> ef4c9b6a526e0ef10b94f271654809ce636d8ab0 -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -app.use(couponRoute); - -app.use(blogRouter); - -app.use(queryRoute); diff --git a/.history/app_20210519122841.js b/.history/app_20210519122841.js deleted file mode 100644 index b02365d..0000000 --- a/.history/app_20210519122841.js +++ /dev/null @@ -1,107 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const couponRoute = require("./routes/Coupon"); -const queryRoute = require("./routes/query"); -const adminRoute = require("./routes/admin"); -const blogRouter = require("./routes/blog"); -const port = process.env.PORT || 5000; -const cors = require("cors"); -const app = express(); - -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -app.use(couponRoute); - -app.use(blogRouter); - -app.use(queryRoute); diff --git a/.history/controllers/auth_20210519122521.js b/.history/controllers/auth_20210519122521.js deleted file mode 100644 index f9fd292..0000000 --- a/.history/controllers/auth_20210519122521.js +++ /dev/null @@ -1,419 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ - "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", -]); -const nodemailer = require("nodemailer"); -const smtpTransport = require("nodemailer-smtp-transport"); - -// -------------------------------------------- mail transporter ----------------------------------------- - -var transport = nodemailer.createTransport( - smtpTransport({ - host: `email-smtp.us-east-1.amazonaws.com`, //`${process.env.HOST}` - port: 465, - auth: { - user: `AKIA2G7743RRTZMVXE3X`, //`${process.env.EMAIL}` - pass: `BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c`, //`${process.env.PASS}` - }, - }) -); - -// -------------------------------------------- mail transporter ----------------------------------------- - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject } = req.body; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const email_otp = Math.floor(100000 + Math.random() * 900000); - console.log("otp", email_otp); - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - // email_otp, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - // const message = { - // from: `${sending_company_email}`, // Sender address - // to: `${email}`, // List of recipients - // subject: `${subject}`, // Subject line - // html: '', // design html for email message. - // }; - // transport.sendMail(message, function (err, info) { - // if (err) { - // console.log(err); - // } else { - // console.log(info); - // } - // }); - res.json({ - message: "You Are Registered, Please Login", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.verfiyemail = async (req, res, next) => { - const { email, otp } = req.body; - try { - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await (user.email_otp == otp ? true : false); - if (isMatched) { - if (!user.isVerified) { - user.isVerified = true; - await user.save(); - res.json({ - message: "User Verified, Please Login", - }); - } else { - res.json({ - message: "User Already Verified, Please Login", - }); - } - } else { - res.json({ - message: "OTP Doesn't Matched!", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch { - (err) => { - console.log(err); - }; - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - const { phoneNumber } = req.body; - try { - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -<<<<<<< HEAD -// Forgot password Starts - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, sending_company_email, subject } = req.body; -======= -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", //replace it with the companies mail - pass: "a510d3d969d3b3", //replace it with the companies pass - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; ->>>>>>> ef4c9b6a526e0ef10b94f271654809ce636d8ab0 - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: ` - - - - - - Reset Password Email Template - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
 
- -
 
- - - - - - - - - - -
 
- - logo -

You have - requested to reset your password

- -

- We cannot simply send you your old password. A unique link to reset your - password has been generated for you. To reset your password, click the - following link and follow the instructions. -

- Reset - Password - -

- Facing any issue? Write us at -

info@cantileverlabs.com

-logo -

- Privacy Policy -Terms Of Use -Contact Us -

-

-
 
-
 
-
- - copyright 2018 Cantilever Labs -
-
 
-
- - - - - `, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Link is Active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -<<<<<<< HEAD -// Forgot password Ends -======= -// Email verification Ends ->>>>>>> ef4c9b6a526e0ef10b94f271654809ce636d8ab0 -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210519122752.js b/.history/controllers/auth_20210519122752.js deleted file mode 100644 index e8e42c9..0000000 --- a/.history/controllers/auth_20210519122752.js +++ /dev/null @@ -1,404 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ - "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", -]); -const nodemailer = require("nodemailer"); -const smtpTransport = require("nodemailer-smtp-transport"); - -// -------------------------------------------- mail transporter ----------------------------------------- - -var transport = nodemailer.createTransport( - smtpTransport({ - host: `email-smtp.us-east-1.amazonaws.com`, //`${process.env.HOST}` - port: 465, - auth: { - user: `AKIA2G7743RRTZMVXE3X`, //`${process.env.EMAIL}` - pass: `BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c`, //`${process.env.PASS}` - }, - }) -); - -// -------------------------------------------- mail transporter ----------------------------------------- - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject } = req.body; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const email_otp = Math.floor(100000 + Math.random() * 900000); - console.log("otp", email_otp); - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - // email_otp, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - // const message = { - // from: `${sending_company_email}`, // Sender address - // to: `${email}`, // List of recipients - // subject: `${subject}`, // Subject line - // html: '', // design html for email message. - // }; - // transport.sendMail(message, function (err, info) { - // if (err) { - // console.log(err); - // } else { - // console.log(info); - // } - // }); - res.json({ - message: "You Are Registered, Please Login", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.verfiyemail = async (req, res, next) => { - const { email, otp } = req.body; - try { - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await (user.email_otp == otp ? true : false); - if (isMatched) { - if (!user.isVerified) { - user.isVerified = true; - await user.save(); - res.json({ - message: "User Verified, Please Login", - }); - } else { - res.json({ - message: "User Already Verified, Please Login", - }); - } - } else { - res.json({ - message: "OTP Doesn't Matched!", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch { - (err) => { - console.log(err); - }; - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - const { phoneNumber } = req.body; - try { - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Forgot password Starts - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: ` - - - - - - Reset Password Email Template - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
 
- -
 
- - - - - - - - - - -
 
- - logo -

You have - requested to reset your password

- -

- We cannot simply send you your old password. A unique link to reset your - password has been generated for you. To reset your password, click the - following link and follow the instructions. -

- Reset - Password - -

- Facing any issue? Write us at -

info@cantileverlabs.com

-logo -

- Privacy Policy -Terms Of Use -Contact Us -

-

-
 
-
 
-
- - copyright 2018 Cantilever Labs -
-
 
-
- - - - - `, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Link is Active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Forgot password Ends - -// Email verification Ends - -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210519123339.js b/.history/controllers/auth_20210519123339.js deleted file mode 100644 index 675a180..0000000 --- a/.history/controllers/auth_20210519123339.js +++ /dev/null @@ -1,405 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ - "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", -]); -const nodemailer = require("nodemailer"); -const smtpTransport = require("nodemailer-smtp-transport"); - -// -------------------------------------------- mail transporter ----------------------------------------- - -var transport = nodemailer.createTransport( - smtpTransport({ - host: `${process.env.HOST}`, //`${process.env.HOST}` - port: 465, - auth: { - user: `${process.env.EMAIL}`, //`${process.env.EMAIL}` - pass: `${process.env.PASS}`, //`${process.env.PASS}` - }, - }) -); - -// -------------------------------------------- mail transporter ----------------------------------------- - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject } = req.body; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const email_otp = Math.floor(100000 + Math.random() * 900000); - console.log("otp", email_otp); - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - // email_otp, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - // const message = { - // from: `${sending_company_email}`, // Sender address - // to: `${email}`, // List of recipients - // subject: `${subject}`, // Subject line - // html: '', // design html for email message. - // }; - // transport.sendMail(message, function (err, info) { - // if (err) { - // console.log(err); - // } else { - // console.log(info); - // } - // }); - res.json({ - message: "You Are Registered, Please Login", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.verfiyemail = async (req, res, next) => { - const { email, otp } = req.body; - try { - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await (user.email_otp == otp ? true : false); - if (isMatched) { - if (!user.isVerified) { - user.isVerified = true; - await user.save(); - res.json({ - message: "User Verified, Please Login", - }); - } else { - res.json({ - message: "User Already Verified, Please Login", - }); - } - } else { - res.json({ - message: "OTP Doesn't Matched!", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch { - (err) => { - console.log(err); - }; - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - const { phoneNumber } = req.body; - try { - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Forgot password Starts - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: ` - - - - - - Reset Password Email Template - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
 
- -
 
- - - - - - - - - - -
 
- - logo -

You have - requested to reset your password

- -

- We cannot simply send you your old password. A unique link to reset your - password has been generated for you. To reset your password, click the - following link and follow the instructions. -

- Reset - Password - -

- Facing any issue? Write us at -

info@cantileverlabs.com

-logo - -

- Privacy Policy -Terms Of Use -Contact Us -

-

-
 
-
 
-
- - copyright 2018 Cantilever Labs -
-
 
-
- - - - - `, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Link is Active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Forgot password Ends - -// Email verification Ends - -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; From a53a67c9a4544c7697d9f584ac293a1a8b6a480c Mon Sep 17 00:00:00 2001 From: hardcodder Date: Wed, 19 May 2021 14:51:31 +0530 Subject: [PATCH 30/39] Production razorpay keys --- controllers/payment.js | 4 ++-- nodemon.json | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/payment.js b/controllers/payment.js index 555dbf5..57ff4fa 100644 --- a/controllers/payment.js +++ b/controllers/payment.js @@ -9,8 +9,8 @@ const { getAllCoupons } = require('./coupon'); //test credentials of razorpay const instance = new razorpay({ - key_id : 'rzp_test_tLx9c6GiWjKcsl' , - key_secret : '4Cf52d6C3amkptdRLCTdC2sT' + key_id : process.env.KEY_ID , + key_secret : process.env.KEY_SECRET }) ; module.exports.postVerify =async (req , res , next) => { diff --git a/nodemon.json b/nodemon.json index 4a040aa..3eff58c 100644 --- a/nodemon.json +++ b/nodemon.json @@ -2,6 +2,11 @@ "env" : { "MONGO_USER":"Cantilever", "MONGO_PASSWORD" :"Cantilever" , - "MONGO_DEFAULT_DATABASE" :"myFirstDatabase" + "MONGO_DEFAULT_DATABASE" :"myFirstDatabase" , + "KEY_ID" : "rzp_live_aD9j5WLBGtdQxt" , + "KEY_SECRET" : "o9BDCwYcpNcHyFL5yjiY7OWG" , + "EMAIL" : "AKIA2G7743RRTZMVXE3X" , + "HOST" : "email-smtp.us-east-1.amazonaws.com" , + "PASS" : "BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c" } } \ No newline at end of file From 08f0d3a45d11b9e5fb7b550fa9627e3f50060b38 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 19 May 2021 15:48:45 +0530 Subject: [PATCH 31/39] Fixed --- .history/app_20210519122521.js | 112 ------ .history/app_20210519122841.js | 107 ----- .history/controllers/auth_20210519122521.js | 419 -------------------- .history/controllers/auth_20210519122752.js | 404 ------------------- .history/controllers/auth_20210519123339.js | 405 ------------------- .history/controllers/blog_20210519114159.js | 103 +++++ .history/controllers/blog_20210519145955.js | 104 +++++ .history/controllers/blog_20210519150616.js | 104 +++++ .history/controllers/blog_20210519151427.js | 104 +++++ .history/controllers/blog_20210519151454.js | 104 +++++ .history/controllers/blog_20210519151725.js | 106 +++++ .history/controllers/blog_20210519151735.js | 106 +++++ .history/controllers/blog_20210519151822.js | 106 +++++ .history/controllers/blog_20210519151942.js | 104 +++++ .history/controllers/blog_20210519152021.js | 104 +++++ .history/controllers/blog_20210519152037.js | 104 +++++ .history/controllers/blog_20210519152116.js | 104 +++++ .history/controllers/blog_20210519152132.js | 104 +++++ .history/controllers/blog_20210519152207.js | 104 +++++ .history/controllers/blog_20210519152224.js | 104 +++++ .history/controllers/blog_20210519152240.js | 104 +++++ .history/controllers/blog_20210519152310.js | 104 +++++ .history/controllers/blog_20210519152325.js | 104 +++++ .history/controllers/blog_20210519152415.js | 104 +++++ .history/controllers/blog_20210519152419.js | 104 +++++ .history/controllers/blog_20210519152443.js | 104 +++++ .history/controllers/blog_20210519152758.js | 104 +++++ .history/controllers/blog_20210519152820.js | 105 +++++ .history/controllers/blog_20210519152920.js | 105 +++++ .history/controllers/blog_20210519153031.js | 105 +++++ .history/controllers/blog_20210519153142.js | 105 +++++ .history/controllers/blog_20210519153454.js | 105 +++++ .history/controllers/blog_20210519153459.js | 105 +++++ .history/controllers/blog_20210519153836.js | 105 +++++ .history/controllers/blog_20210519153855.js | 105 +++++ .history/controllers/blog_20210519153953.js | 106 +++++ .history/controllers/blog_20210519154014.js | 106 +++++ .history/controllers/blog_20210519154059.js | 106 +++++ .history/controllers/blog_20210519154126.js | 105 +++++ .history/controllers/blog_20210519154454.js | 106 +++++ .history/controllers/blog_20210519154456.js | 106 +++++ .history/controllers/blog_20210519154625.js | 106 +++++ .history/controllers/blog_20210519154733.js | 106 +++++ .history/controllers/blog_20210519154825.js | 104 +++++ .history/models/Blog_20210519103433.js | 27 ++ .history/models/Blog_20210519150611.js | 28 ++ .history/models/Blog_20210519150818.js | 25 ++ .history/models/Blog_20210519152942.js | 25 ++ .history/models/Blog_20210519153800.js | 25 ++ .history/routes/blog_20210519114750.js | 14 + .history/routes/blog_20210519151054.js | 14 + controllers/blog.js | 7 +- models/Blog.js | 6 +- routes/blog.js | 4 +- 54 files changed, 4250 insertions(+), 1456 deletions(-) delete mode 100644 .history/app_20210519122521.js delete mode 100644 .history/app_20210519122841.js delete mode 100644 .history/controllers/auth_20210519122521.js delete mode 100644 .history/controllers/auth_20210519122752.js delete mode 100644 .history/controllers/auth_20210519123339.js create mode 100644 .history/controllers/blog_20210519114159.js create mode 100644 .history/controllers/blog_20210519145955.js create mode 100644 .history/controllers/blog_20210519150616.js create mode 100644 .history/controllers/blog_20210519151427.js create mode 100644 .history/controllers/blog_20210519151454.js create mode 100644 .history/controllers/blog_20210519151725.js create mode 100644 .history/controllers/blog_20210519151735.js create mode 100644 .history/controllers/blog_20210519151822.js create mode 100644 .history/controllers/blog_20210519151942.js create mode 100644 .history/controllers/blog_20210519152021.js create mode 100644 .history/controllers/blog_20210519152037.js create mode 100644 .history/controllers/blog_20210519152116.js create mode 100644 .history/controllers/blog_20210519152132.js create mode 100644 .history/controllers/blog_20210519152207.js create mode 100644 .history/controllers/blog_20210519152224.js create mode 100644 .history/controllers/blog_20210519152240.js create mode 100644 .history/controllers/blog_20210519152310.js create mode 100644 .history/controllers/blog_20210519152325.js create mode 100644 .history/controllers/blog_20210519152415.js create mode 100644 .history/controllers/blog_20210519152419.js create mode 100644 .history/controllers/blog_20210519152443.js create mode 100644 .history/controllers/blog_20210519152758.js create mode 100644 .history/controllers/blog_20210519152820.js create mode 100644 .history/controllers/blog_20210519152920.js create mode 100644 .history/controllers/blog_20210519153031.js create mode 100644 .history/controllers/blog_20210519153142.js create mode 100644 .history/controllers/blog_20210519153454.js create mode 100644 .history/controllers/blog_20210519153459.js create mode 100644 .history/controllers/blog_20210519153836.js create mode 100644 .history/controllers/blog_20210519153855.js create mode 100644 .history/controllers/blog_20210519153953.js create mode 100644 .history/controllers/blog_20210519154014.js create mode 100644 .history/controllers/blog_20210519154059.js create mode 100644 .history/controllers/blog_20210519154126.js create mode 100644 .history/controllers/blog_20210519154454.js create mode 100644 .history/controllers/blog_20210519154456.js create mode 100644 .history/controllers/blog_20210519154625.js create mode 100644 .history/controllers/blog_20210519154733.js create mode 100644 .history/controllers/blog_20210519154825.js create mode 100644 .history/models/Blog_20210519103433.js create mode 100644 .history/models/Blog_20210519150611.js create mode 100644 .history/models/Blog_20210519150818.js create mode 100644 .history/models/Blog_20210519152942.js create mode 100644 .history/models/Blog_20210519153800.js create mode 100644 .history/routes/blog_20210519114750.js create mode 100644 .history/routes/blog_20210519151054.js diff --git a/.history/app_20210519122521.js b/.history/app_20210519122521.js deleted file mode 100644 index 2f07095..0000000 --- a/.history/app_20210519122521.js +++ /dev/null @@ -1,112 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const couponRoute = require("./routes/Coupon"); -const queryRoute = require("./routes/query"); -const adminRoute = require("./routes/admin"); -const blogRouter = require("./routes/blog"); -const port = process.env.PORT || 5000; -const cors = require("cors"); -const app = express(); - -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -<<<<<<< HEAD -======= -const app = express(); - ->>>>>>> ef4c9b6a526e0ef10b94f271654809ce636d8ab0 -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -app.use(couponRoute); - -app.use(blogRouter); - -app.use(queryRoute); diff --git a/.history/app_20210519122841.js b/.history/app_20210519122841.js deleted file mode 100644 index b02365d..0000000 --- a/.history/app_20210519122841.js +++ /dev/null @@ -1,107 +0,0 @@ -const express = require("express"); -const mongoose = require("mongoose"); -const bodyparser = require("body-parser"); -const authRoute = require("./routes/auth"); -const profileRoute = require("./routes/profile"); -const paymentRoute = require("./routes/payment"); -const courseRoute = require("./routes/course"); -const couponRoute = require("./routes/Coupon"); -const queryRoute = require("./routes/query"); -const adminRoute = require("./routes/admin"); -const blogRouter = require("./routes/blog"); -const port = process.env.PORT || 5000; -const cors = require("cors"); -const app = express(); - -//const passport = require('passport'); -//const cookieSession = require('cookie-session') ; -//require('./passport-setup') ; - -const MONGO_URI = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0.dqxva.mongodb.net/${process.env.MONGO_DEFAULT_DATABASE}?retryWrites=true&w=majority`; - -app.use(cors()); -app.use(bodyparser.json()); - -// app.use(cookieSession({ -// name: 'test-session', -// keys: ['key1', 'key2'] -// })) - -// const isLoggedIn = (req , res , next) => { -// if(req.user) -// { -// next() -// } -// else -// { -// res.json({ -// error : "No user" -// }) -// } -// } - -// app.use(passport.initialize()); -// app.use(passport.session()); - -// app.get('/failed' , (req , res) => { -// res.json({ -// error : "You have failed to login" -// }) -// }) - -// app.get('/' , (req , res) => { -// console.log('you are not logged in'); - -// }) - -// app.get('/good' ,isLoggedIn , (req , res) => { -// res.json({ -// message:"success" , -// user : req.user -// }) -// }) - -// app.get('/auth/google', -// passport.authenticate('google', { scope: ['profile' , 'email'] })); - -// app.get('/auth/google/callback', -// passport.authenticate('google', { failureRedirect: '/failed' }), -// function(req, res) { -// res.redirect('/good'); -// }); - -// app.get('/logout', (req , res) => { -// req.session = null ; -// req.logout() ; -// res.redirect('/') ; -// }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); - }); -app.use(authRoute); - -app.use(profileRoute); - -app.use(paymentRoute); - -app.use(courseRoute); - -app.use(adminRoute); - -app.use(couponRoute); - -app.use(blogRouter); - -app.use(queryRoute); diff --git a/.history/controllers/auth_20210519122521.js b/.history/controllers/auth_20210519122521.js deleted file mode 100644 index f9fd292..0000000 --- a/.history/controllers/auth_20210519122521.js +++ /dev/null @@ -1,419 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ - "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", -]); -const nodemailer = require("nodemailer"); -const smtpTransport = require("nodemailer-smtp-transport"); - -// -------------------------------------------- mail transporter ----------------------------------------- - -var transport = nodemailer.createTransport( - smtpTransport({ - host: `email-smtp.us-east-1.amazonaws.com`, //`${process.env.HOST}` - port: 465, - auth: { - user: `AKIA2G7743RRTZMVXE3X`, //`${process.env.EMAIL}` - pass: `BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c`, //`${process.env.PASS}` - }, - }) -); - -// -------------------------------------------- mail transporter ----------------------------------------- - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject } = req.body; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const email_otp = Math.floor(100000 + Math.random() * 900000); - console.log("otp", email_otp); - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - // email_otp, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - // const message = { - // from: `${sending_company_email}`, // Sender address - // to: `${email}`, // List of recipients - // subject: `${subject}`, // Subject line - // html: '', // design html for email message. - // }; - // transport.sendMail(message, function (err, info) { - // if (err) { - // console.log(err); - // } else { - // console.log(info); - // } - // }); - res.json({ - message: "You Are Registered, Please Login", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.verfiyemail = async (req, res, next) => { - const { email, otp } = req.body; - try { - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await (user.email_otp == otp ? true : false); - if (isMatched) { - if (!user.isVerified) { - user.isVerified = true; - await user.save(); - res.json({ - message: "User Verified, Please Login", - }); - } else { - res.json({ - message: "User Already Verified, Please Login", - }); - } - } else { - res.json({ - message: "OTP Doesn't Matched!", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch { - (err) => { - console.log(err); - }; - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - const { phoneNumber } = req.body; - try { - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -<<<<<<< HEAD -// Forgot password Starts - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, sending_company_email, subject } = req.body; -======= -// Email verification Starts - -var transport = nodemailer.createTransport({ - service: "gmail", - auth: { - user: "5578544cc56856", //replace it with the companies mail - pass: "a510d3d969d3b3", //replace it with the companies pass - }, -}); -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, _html, sending_company_email, subject } = req.body; ->>>>>>> ef4c9b6a526e0ef10b94f271654809ce636d8ab0 - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: ` - - - - - - Reset Password Email Template - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
 
- -
 
- - - - - - - - - - -
 
- - logo -

You have - requested to reset your password

- -

- We cannot simply send you your old password. A unique link to reset your - password has been generated for you. To reset your password, click the - following link and follow the instructions. -

- Reset - Password - -

- Facing any issue? Write us at -

info@cantileverlabs.com

-logo -

- Privacy Policy -Terms Of Use -Contact Us -

-

-
 
-
 
-
- - copyright 2018 Cantilever Labs -
-
 
-
- - - - - `, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Link is Active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -<<<<<<< HEAD -// Forgot password Ends -======= -// Email verification Ends ->>>>>>> ef4c9b6a526e0ef10b94f271654809ce636d8ab0 -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210519122752.js b/.history/controllers/auth_20210519122752.js deleted file mode 100644 index e8e42c9..0000000 --- a/.history/controllers/auth_20210519122752.js +++ /dev/null @@ -1,404 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ - "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", -]); -const nodemailer = require("nodemailer"); -const smtpTransport = require("nodemailer-smtp-transport"); - -// -------------------------------------------- mail transporter ----------------------------------------- - -var transport = nodemailer.createTransport( - smtpTransport({ - host: `email-smtp.us-east-1.amazonaws.com`, //`${process.env.HOST}` - port: 465, - auth: { - user: `AKIA2G7743RRTZMVXE3X`, //`${process.env.EMAIL}` - pass: `BJSjV3jArJfsnk1LhFc/hUmisEyEtbLNGgrRbv0noh8c`, //`${process.env.PASS}` - }, - }) -); - -// -------------------------------------------- mail transporter ----------------------------------------- - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject } = req.body; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const email_otp = Math.floor(100000 + Math.random() * 900000); - console.log("otp", email_otp); - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - // email_otp, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - // const message = { - // from: `${sending_company_email}`, // Sender address - // to: `${email}`, // List of recipients - // subject: `${subject}`, // Subject line - // html: '', // design html for email message. - // }; - // transport.sendMail(message, function (err, info) { - // if (err) { - // console.log(err); - // } else { - // console.log(info); - // } - // }); - res.json({ - message: "You Are Registered, Please Login", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.verfiyemail = async (req, res, next) => { - const { email, otp } = req.body; - try { - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await (user.email_otp == otp ? true : false); - if (isMatched) { - if (!user.isVerified) { - user.isVerified = true; - await user.save(); - res.json({ - message: "User Verified, Please Login", - }); - } else { - res.json({ - message: "User Already Verified, Please Login", - }); - } - } else { - res.json({ - message: "OTP Doesn't Matched!", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch { - (err) => { - console.log(err); - }; - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - const { phoneNumber } = req.body; - try { - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Forgot password Starts - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: ` - - - - - - Reset Password Email Template - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
 
- -
 
- - - - - - - - - - -
 
- - logo -

You have - requested to reset your password

- -

- We cannot simply send you your old password. A unique link to reset your - password has been generated for you. To reset your password, click the - following link and follow the instructions. -

- Reset - Password - -

- Facing any issue? Write us at -

info@cantileverlabs.com

-logo -

- Privacy Policy -Terms Of Use -Contact Us -

-

-
 
-
 
-
- - copyright 2018 Cantilever Labs -
-
 
-
- - - - - `, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Link is Active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Forgot password Ends - -// Email verification Ends - -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/auth_20210519123339.js b/.history/controllers/auth_20210519123339.js deleted file mode 100644 index 675a180..0000000 --- a/.history/controllers/auth_20210519123339.js +++ /dev/null @@ -1,405 +0,0 @@ -const bcrypt = require("bcryptjs"); -const User = require("../models/User"); -const Student = require("../models/Student"); -const jwt = require("jsonwebtoken"); -const JWT_secret = "Cantileverlabs"; -const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ - "ENABLE_CONVERSATIONSAPI_WHATSAPP_SANDBOX", -]); -const nodemailer = require("nodemailer"); -const smtpTransport = require("nodemailer-smtp-transport"); - -// -------------------------------------------- mail transporter ----------------------------------------- - -var transport = nodemailer.createTransport( - smtpTransport({ - host: `${process.env.HOST}`, //`${process.env.HOST}` - port: 465, - auth: { - user: `${process.env.EMAIL}`, //`${process.env.EMAIL}` - pass: `${process.env.PASS}`, //`${process.env.PASS}` - }, - }) -); - -// -------------------------------------------- mail transporter ----------------------------------------- - -module.exports.Protected = async (req, res, next) => { - res.send("Hello User"); -}; -module.exports.postSignup = async (req, res, next) => { - try { - //we need firstName , lastName , email , password as input - let firstName = req.body.firstName || " "; - let lastName = req.body.lastName || " "; - const { sending_company_email, email, password, subject } = req.body; - let user = await User.findOne({ email: email }); - if (user) { - res.json({ - message: "User already exist", - type: "error", - }); - } else { - const email_otp = Math.floor(100000 + Math.random() * 900000); - console.log("otp", email_otp); - const hashedPass = await bcrypt.hash(password, 12); - user = new User({ - firstName: firstName, - lastName: lastName, - email: email, - password: hashedPass, - isAdmin: false, - // email_otp, - }); - user = await user.save(); - await Student.deleteOne({ user: user._id }); - let student = new Student({ - user: user._id, - }); - student = await student.save(); - user.student = student._id; - await user.save(); - // const message = { - // from: `${sending_company_email}`, // Sender address - // to: `${email}`, // List of recipients - // subject: `${subject}`, // Subject line - // html: '', // design html for email message. - // }; - // transport.sendMail(message, function (err, info) { - // if (err) { - // console.log(err); - // } else { - // console.log(info); - // } - // }); - res.json({ - message: "You Are Registered, Please Login", - type: "success", - }); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.verfiyemail = async (req, res, next) => { - const { email, otp } = req.body; - try { - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await (user.email_otp == otp ? true : false); - if (isMatched) { - if (!user.isVerified) { - user.isVerified = true; - await user.save(); - res.json({ - message: "User Verified, Please Login", - }); - } else { - res.json({ - message: "User Already Verified, Please Login", - }); - } - } else { - res.json({ - message: "OTP Doesn't Matched!", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch { - (err) => { - console.log(err); - }; - } -}; - -module.exports.postSignin = async (req, res, next) => { - try { - //we need email and password as input - let email = req.body.email; - let password = req.body.password; - let user = await User.findOne({ email: email }); - if (user) { - const isMatched = await bcrypt.compare(password, user.password); - if (isMatched) { - const token = jwt.sign({ _id: user._id }, JWT_secret); - res.json({ - token: token, - }); - } else { - res.json({ - message: "email and password doesn't match", - type: "error", - }); - } - } else { - res.json({ - message: "No user with this email exists", - type: "error", - }); - } - } catch (err) { - console.log(err); - } -}; - -// Phone verification Starts. -// ----------------------------------------------------------------------------------------------- - -module.exports.sendOTP = (req, res, next) => { - //uNNYosMopvvCW9RTR1tRWJmYC test - //llVKD53ve6QRpbCKOHzWBADaS live - const { phoneNumber } = req.body; - try { - if (!phoneNumber) { - res.status(422).json({ message: "Please Add All Required Fields" }); - return; - } else { - messagebird.verify.create( - phoneNumber, - { - template: "Your verification code is %token", - }, - function (err, response) { - if (err) { - console.log(err); - res.status(422).json({ message: err.errors[0].description }); - } else { - console.log(response); - res.json({ id: response.id }); - } - } - ); - } - } catch (err) { - console.log(err); - } -}; - -module.exports.getOTP = (req, res, next) => { - try { - const { id, otp } = req.body; - messagebird.verify.verify(id, otp, function (err, response) { - if (err) { - console.log({ error: err.errors[0].description, id: id }); - res.json({ error: err.errors[0].description, id: id }); - } else { - console.log(response); - res.json({ message: "Code Verified" }); - } - }); - } catch (err) { - console.log(err); - } -}; -// Phone verification End. -// ----------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------------- -// Forgot password Starts - -module.exports.forgotpassword = async (req, res, next) => { - const { email, link, sending_company_email, subject } = req.body; - //link = https://cantileverlabs.herokuapp.com/resetpassword/:id/:token - try { - await User.findOne({ email }).then((user) => { - if (!user) { - res.status(404).json({ error: "User not found with this Email" }); - return; - } else { - const payload = { - email: user.email, - _id: user._id, - }; - const secret = JWT_secret + user.password; - const token = jwt.sign(payload, secret, { expiresIn: "10m" }); - User.findByIdAndUpdate(user._id, { - $set: { passwordResetToken: token }, - }) - .then((data) => { - const reset_link = `${link}/${user._id}/${token}`; - const message = { - from: `${sending_company_email}`, // Sender address - to: `${user.email}`, // List of recipients - subject: `${subject}`, // Subject line - html: ` - - - - - - Reset Password Email Template - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
 
- -
 
- - - - - - - - - - -
 
- - logo -

You have - requested to reset your password

- -

- We cannot simply send you your old password. A unique link to reset your - password has been generated for you. To reset your password, click the - following link and follow the instructions. -

- Reset - Password - -

- Facing any issue? Write us at -

info@cantileverlabs.com

-logo - -

- Privacy Policy -Terms Of Use -Contact Us -

-

-
 
-
 
-
- - copyright 2018 Cantilever Labs -
-
 
-
- - - - - `, // design html for email message. - }; - transport.sendMail(message, function (err, info) { - if (err) { - console.log(err); - } else { - console.log(info); - } - }); - res.status(200).json({ - message: "Link is Active for 10 mins", - reset_link, - }); - }) - .catch((err) => { - console.log(err); - }); - } - }); - } catch { - (error) => { - console.log("Error from forgot pass", error); - }; - } -}; -module.exports.resetpassword = async (req, res, next) => { - const { _id, token } = req.params; - const { password } = req.body; - try { - let user = await User.findById({ _id }); - if (!user) { - res.json({ error: "User not Found or WrongId" }); - return; - } else { - const secret = JWT_secret + user.password; - const user_token = user.passwordResetToken; - const payload = jwt.verify(token, secret); - const hashedPass = await bcrypt.hash(password, 12); - if (token == user_token) { - user.password = hashedPass; - await user - .save() - .then((ok) => { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.json({ message: "Password Updated!" }); - }) - .catch((err) => { - console.log("Error in save", err); - }); - } else { - res.status(422).json({ error: "Either Token not found or Expired!" }); - return; - } - } - } catch { - (err) => { - console.log("error from try catch resetpass", err); - }; - } -}; - -// Forgot password Ends - -// Email verification Ends - -// ----------------------------------------------------------------------------------------------- - -module.exports.checkProtected = (req, res, next) => { - console.log(req.user); - res.json({ - message: "Protected", - user: req.user, - }); -}; diff --git a/.history/controllers/blog_20210519114159.js b/.history/controllers/blog_20210519114159.js new file mode 100644 index 0000000..f6ea6c1 --- /dev/null +++ b/.history/controllers/blog_20210519114159.js @@ -0,0 +1,103 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519145955.js b/.history/controllers/blog_20210519145955.js new file mode 100644 index 0000000..16d1963 --- /dev/null +++ b/.history/controllers/blog_20210519145955.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course._id, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519150616.js b/.history/controllers/blog_20210519150616.js new file mode 100644 index 0000000..16d1963 --- /dev/null +++ b/.history/controllers/blog_20210519150616.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course._id, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519151427.js b/.history/controllers/blog_20210519151427.js new file mode 100644 index 0000000..b77e01b --- /dev/null +++ b/.history/controllers/blog_20210519151427.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519151454.js b/.history/controllers/blog_20210519151454.js new file mode 100644 index 0000000..16d1963 --- /dev/null +++ b/.history/controllers/blog_20210519151454.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course._id, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519151725.js b/.history/controllers/blog_20210519151725.js new file mode 100644 index 0000000..41e17ac --- /dev/null +++ b/.history/controllers/blog_20210519151725.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }) + .populate("_id ") + .select("-password"); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course._id, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519151735.js b/.history/controllers/blog_20210519151735.js new file mode 100644 index 0000000..bb6bf06 --- /dev/null +++ b/.history/controllers/blog_20210519151735.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }) + .populate("_id ") + .select("-password"); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519151822.js b/.history/controllers/blog_20210519151822.js new file mode 100644 index 0000000..41e17ac --- /dev/null +++ b/.history/controllers/blog_20210519151822.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }) + .populate("_id ") + .select("-password"); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course._id, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519151942.js b/.history/controllers/blog_20210519151942.js new file mode 100644 index 0000000..6e3a814 --- /dev/null +++ b/.history/controllers/blog_20210519151942.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }).populate("").select("-password"); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: course, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152021.js b/.history/controllers/blog_20210519152021.js new file mode 100644 index 0000000..f3614e1 --- /dev/null +++ b/.history/controllers/blog_20210519152021.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: , + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152037.js b/.history/controllers/blog_20210519152037.js new file mode 100644 index 0000000..ecb3602 --- /dev/null +++ b/.history/controllers/blog_20210519152037.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + console.log(course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152116.js b/.history/controllers/blog_20210519152116.js new file mode 100644 index 0000000..e57c2c9 --- /dev/null +++ b/.history/controllers/blog_20210519152116.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find(_id); + console.log(course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152132.js b/.history/controllers/blog_20210519152132.js new file mode 100644 index 0000000..ecb3602 --- /dev/null +++ b/.history/controllers/blog_20210519152132.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + console.log(course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152207.js b/.history/controllers/blog_20210519152207.js new file mode 100644 index 0000000..8d93c09 --- /dev/null +++ b/.history/controllers/blog_20210519152207.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.findById({ _id }); + console.log(course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152224.js b/.history/controllers/blog_20210519152224.js new file mode 100644 index 0000000..eb2bed9 --- /dev/null +++ b/.history/controllers/blog_20210519152224.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.findById({ _id }); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152240.js b/.history/controllers/blog_20210519152240.js new file mode 100644 index 0000000..3fcbb8d --- /dev/null +++ b/.history/controllers/blog_20210519152240.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.findById(_id); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152310.js b/.history/controllers/blog_20210519152310.js new file mode 100644 index 0000000..16ff14d --- /dev/null +++ b/.history/controllers/blog_20210519152310.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find(_id); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152325.js b/.history/controllers/blog_20210519152325.js new file mode 100644 index 0000000..1fe749e --- /dev/null +++ b/.history/controllers/blog_20210519152325.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152415.js b/.history/controllers/blog_20210519152415.js new file mode 100644 index 0000000..72b3d1c --- /dev/null +++ b/.history/controllers/blog_20210519152415.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.findOne({ _id }); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152419.js b/.history/controllers/blog_20210519152419.js new file mode 100644 index 0000000..72b3d1c --- /dev/null +++ b/.history/controllers/blog_20210519152419.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.findOne({ _id }); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152443.js b/.history/controllers/blog_20210519152443.js new file mode 100644 index 0000000..1fe749e --- /dev/null +++ b/.history/controllers/blog_20210519152443.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const Course = require("../models/Course"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let course = await Course.find({ _id }); + console.log("Course ", course); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (course) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152758.js b/.history/controllers/blog_20210519152758.js new file mode 100644 index 0000000..2f29cf6 --- /dev/null +++ b/.history/controllers/blog_20210519152758.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152820.js b/.history/controllers/blog_20210519152820.js new file mode 100644 index 0000000..b0cfe9a --- /dev/null +++ b/.history/controllers/blog_20210519152820.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519152920.js b/.history/controllers/blog_20210519152920.js new file mode 100644 index 0000000..596af29 --- /dev/null +++ b/.history/controllers/blog_20210519152920.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user.firstName + " " + user.lastName, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153031.js b/.history/controllers/blog_20210519153031.js new file mode 100644 index 0000000..a0f4d7d --- /dev/null +++ b/.history/controllers/blog_20210519153031.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user.firstName + " " + user.lastName, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153142.js b/.history/controllers/blog_20210519153142.js new file mode 100644 index 0000000..1b4efdc --- /dev/null +++ b/.history/controllers/blog_20210519153142.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user._id, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153454.js b/.history/controllers/blog_20210519153454.js new file mode 100644 index 0000000..b8c7f06 --- /dev/null +++ b/.history/controllers/blog_20210519153454.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153459.js b/.history/controllers/blog_20210519153459.js new file mode 100644 index 0000000..13ac015 --- /dev/null +++ b/.history/controllers/blog_20210519153459.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153836.js b/.history/controllers/blog_20210519153836.js new file mode 100644 index 0000000..fa3e179 --- /dev/null +++ b/.history/controllers/blog_20210519153836.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: User.find({ _id }), + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153855.js b/.history/controllers/blog_20210519153855.js new file mode 100644 index 0000000..1eb7526 --- /dev/null +++ b/.history/controllers/blog_20210519153855.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: , + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519153953.js b/.history/controllers/blog_20210519153953.js new file mode 100644 index 0000000..ae60f82 --- /dev/null +++ b/.history/controllers/blog_20210519153953.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user._id == _id) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user.firstName, + }); + console.log("Brfore save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154014.js b/.history/controllers/blog_20210519154014.js new file mode 100644 index 0000000..98a24d4 --- /dev/null +++ b/.history/controllers/blog_20210519154014.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user.firstName, + }); + console.log("Brfore save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154059.js b/.history/controllers/blog_20210519154059.js new file mode 100644 index 0000000..98274a1 --- /dev/null +++ b/.history/controllers/blog_20210519154059.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + console.log("Brfore save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154126.js b/.history/controllers/blog_20210519154126.js new file mode 100644 index 0000000..b7d1f2b --- /dev/null +++ b/.history/controllers/blog_20210519154126.js @@ -0,0 +1,105 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + }); + console.log("Brfore save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154454.js b/.history/controllers/blog_20210519154454.js new file mode 100644 index 0000000..959a2a9 --- /dev/null +++ b/.history/controllers/blog_20210519154454.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author:user. + }); + console.log("Before save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154456.js b/.history/controllers/blog_20210519154456.js new file mode 100644 index 0000000..7ff2191 --- /dev/null +++ b/.history/controllers/blog_20210519154456.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + // console.log("User ", user); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + console.log("Before save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154625.js b/.history/controllers/blog_20210519154625.js new file mode 100644 index 0000000..b18be73 --- /dev/null +++ b/.history/controllers/blog_20210519154625.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.find({ _id }); + console.log("User ", user._id); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + // console.log("Before save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154733.js b/.history/controllers/blog_20210519154733.js new file mode 100644 index 0000000..7150d52 --- /dev/null +++ b/.history/controllers/blog_20210519154733.js @@ -0,0 +1,106 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.findById({ _id }); + console.log("User ", user._id); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + // console.log("Before save", blog); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/controllers/blog_20210519154825.js b/.history/controllers/blog_20210519154825.js new file mode 100644 index 0000000..b7c474e --- /dev/null +++ b/.history/controllers/blog_20210519154825.js @@ -0,0 +1,104 @@ +const { log } = require("handlebars"); +const Blog = require("../models/Blog"); +const User = require("../models/User"); + +module.exports.getAllBlogs = async (req, res, next) => { + try { + let blog = await Blog.find(); + if (blog) { + res.json({ blogs: blog }); + } else { + console.log("Error in Blog", blog); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + try { + let user = await User.findById({ _id }); + if (!title) { + res.status(422).json({ message: "Please, Add Title of the Blog" }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add Body of the Blog" }); + return; + } + if (user) { + let blog = new Blog({ + title, + body, + image, + date: new Date(), + author: user, + }); + await blog.save(); + res.json({ message: "Blog Saved Successfully!" }); + } else { + res.status.json({ error: "User Doesn't Exists" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.deleteBlog = async (req, res, next) => { + const { _id } = req.body; + try { + let blog = await Blog.find({ _id }); + if (blog) { + await Blog.findByIdAndDelete(_id); + res.json({ message: "Blog Deleted!" }); + } else { + res.status(404).json({ message: "Blog Not Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; + +module.exports.editBlog = async (req, res, next) => { + const { _id, body, title, image } = req.body; + + try { + if (!title) { + res.status(422).json({ message: "Please, Add the Title of the Blog." }); + return; + } + if (!body) { + res.status(422).json({ message: "Please, Add the Body of the Blog." }); + return; + } + if (!image) { + res.status(422).json({ message: "Please, Add the Image of the Blog." }); + return; + } + let blog = Blog.findById(_id); + if (blog) { + blog.title = title; + blog.body = body; + blog.image = image; + await blog.save(); + res.json({ message: "Blog Updated!" }); + } else { + res.status(422).json({ error: "Blog Doesn't Found" }); + return; + } + } catch { + (err) => { + res.status(422).json({ error: err }); + }; + } +}; diff --git a/.history/models/Blog_20210519103433.js b/.history/models/Blog_20210519103433.js new file mode 100644 index 0000000..33e6c55 --- /dev/null +++ b/.history/models/Blog_20210519103433.js @@ -0,0 +1,27 @@ +const mongoose = require("mongoose"); +const blogSchema = new mongoose.Schema({ + title: { + type: String, + require: true, + }, + author: { + type: String, + ref: "Course", + }, + date: { + type: Date, + }, + image: { + type: String, + default: "", + }, + body: { + type: String, + required: true, + }, + isBookMarked: { + type: Boolean, + default: false, + }, +}); +module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519150611.js b/.history/models/Blog_20210519150611.js new file mode 100644 index 0000000..ffc56dd --- /dev/null +++ b/.history/models/Blog_20210519150611.js @@ -0,0 +1,28 @@ +const mongoose = require("mongoose"); +const { ObjectId } = mongoose.Schema.Types; +const blogSchema = new mongoose.Schema({ + title: { + type: String, + require: true, + }, + author: { + type: ObjectId, + ref: "Course", + }, + date: { + type: Date, + }, + image: { + type: String, + default: "", + }, + body: { + type: String, + required: true, + }, + isBookMarked: { + type: Boolean, + default: false, + }, +}); +module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519150818.js b/.history/models/Blog_20210519150818.js new file mode 100644 index 0000000..6ad1746 --- /dev/null +++ b/.history/models/Blog_20210519150818.js @@ -0,0 +1,25 @@ +const mongoose = require("mongoose"); +const { ObjectId } = mongoose.Schema.Types; +const blogSchema = new mongoose.Schema({ + title: { + type: String, + require: true, + }, + author: { ref: "Course", type: ObjectId }, + date: { + type: Date, + }, + image: { + type: String, + default: "", + }, + body: { + type: String, + required: true, + }, + isBookMarked: { + type: Boolean, + default: false, + }, +}); +module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519152942.js b/.history/models/Blog_20210519152942.js new file mode 100644 index 0000000..a4bd0fc --- /dev/null +++ b/.history/models/Blog_20210519152942.js @@ -0,0 +1,25 @@ +const mongoose = require("mongoose"); +const { ObjectId } = mongoose.Schema.Types; +const blogSchema = new mongoose.Schema({ + title: { + type: String, + require: true, + }, + author: { ref: "User", type: ObjectId }, + date: { + type: Date, + }, + image: { + type: String, + default: "", + }, + body: { + type: String, + required: true, + }, + isBookMarked: { + type: Boolean, + default: false, + }, +}); +module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519153800.js b/.history/models/Blog_20210519153800.js new file mode 100644 index 0000000..774666e --- /dev/null +++ b/.history/models/Blog_20210519153800.js @@ -0,0 +1,25 @@ +const mongoose = require("mongoose"); + +const blogSchema = new mongoose.Schema({ + title: { + type: String, + require: true, + }, + author: { ref: "User", type: mongoose.Schema.Types.ObjectId }, + date: { + type: Date, + }, + image: { + type: String, + default: "", + }, + body: { + type: String, + required: true, + }, + isBookMarked: { + type: Boolean, + default: false, + }, +}); +module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/routes/blog_20210519114750.js b/.history/routes/blog_20210519114750.js new file mode 100644 index 0000000..51e5d57 --- /dev/null +++ b/.history/routes/blog_20210519114750.js @@ -0,0 +1,14 @@ +const express = require("express"); +const router = express.Router(); +const BlogController = require("../controllers/blog"); +const isAuth = require("../middleware/requirelogin"); + +router.post("/add-blog", BlogController.addBlog); + +router.get("/get-all-blogs", BlogController.getAllBlogs); + +router.post("/delete-blog/", isAuth, BlogController.deleteBlog); + +router.post("/edit-blog/", isAuth, BlogController.editBlog); + +module.exports = router; diff --git a/.history/routes/blog_20210519151054.js b/.history/routes/blog_20210519151054.js new file mode 100644 index 0000000..9336f60 --- /dev/null +++ b/.history/routes/blog_20210519151054.js @@ -0,0 +1,14 @@ +const express = require("express"); +const router = express.Router(); +const BlogController = require("../controllers/blog"); +const isAuth = require("../middleware/requirelogin"); + +router.post("/add-blog", BlogController.addBlog); + +router.get("/get-all-blogs", BlogController.getAllBlogs); + +router.post("/delete-blog/", BlogController.deleteBlog); + +router.post("/edit-blog/", BlogController.editBlog); + +module.exports = router; diff --git a/controllers/blog.js b/controllers/blog.js index f6ea6c1..b7c474e 100644 --- a/controllers/blog.js +++ b/controllers/blog.js @@ -1,6 +1,6 @@ const { log } = require("handlebars"); const Blog = require("../models/Blog"); -const Course = require("../models/Course"); +const User = require("../models/User"); module.exports.getAllBlogs = async (req, res, next) => { try { @@ -21,7 +21,7 @@ module.exports.getAllBlogs = async (req, res, next) => { module.exports.addBlog = async (req, res, next) => { const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. try { - let course = await Course.find({ _id }); + let user = await User.findById({ _id }); if (!title) { res.status(422).json({ message: "Please, Add Title of the Blog" }); return; @@ -30,12 +30,13 @@ module.exports.addBlog = async (req, res, next) => { res.status(422).json({ message: "Please, Add Body of the Blog" }); return; } - if (course) { + if (user) { let blog = new Blog({ title, body, image, date: new Date(), + author: user, }); await blog.save(); res.json({ message: "Blog Saved Successfully!" }); diff --git a/models/Blog.js b/models/Blog.js index 33e6c55..774666e 100644 --- a/models/Blog.js +++ b/models/Blog.js @@ -1,13 +1,11 @@ const mongoose = require("mongoose"); + const blogSchema = new mongoose.Schema({ title: { type: String, require: true, }, - author: { - type: String, - ref: "Course", - }, + author: { ref: "User", type: mongoose.Schema.Types.ObjectId }, date: { type: Date, }, diff --git a/routes/blog.js b/routes/blog.js index 51e5d57..9336f60 100644 --- a/routes/blog.js +++ b/routes/blog.js @@ -7,8 +7,8 @@ router.post("/add-blog", BlogController.addBlog); router.get("/get-all-blogs", BlogController.getAllBlogs); -router.post("/delete-blog/", isAuth, BlogController.deleteBlog); +router.post("/delete-blog/", BlogController.deleteBlog); -router.post("/edit-blog/", isAuth, BlogController.editBlog); +router.post("/edit-blog/", BlogController.editBlog); module.exports = router; From 5567767d972e5c30ac23f16251d465dedf175d7a Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 19 May 2021 15:48:57 +0530 Subject: [PATCH 32/39] Fixed! --- .history/controllers/blog_20210519114159.js | 103 ------------------- .history/controllers/blog_20210519145955.js | 104 ------------------- .history/controllers/blog_20210519150616.js | 104 ------------------- .history/controllers/blog_20210519151427.js | 104 ------------------- .history/controllers/blog_20210519151454.js | 104 ------------------- .history/controllers/blog_20210519151725.js | 106 -------------------- .history/controllers/blog_20210519151735.js | 106 -------------------- .history/controllers/blog_20210519151822.js | 106 -------------------- .history/controllers/blog_20210519151942.js | 104 ------------------- .history/controllers/blog_20210519152021.js | 104 ------------------- .history/controllers/blog_20210519152037.js | 104 ------------------- .history/controllers/blog_20210519152116.js | 104 ------------------- .history/controllers/blog_20210519152132.js | 104 ------------------- .history/controllers/blog_20210519152207.js | 104 ------------------- .history/controllers/blog_20210519152224.js | 104 ------------------- .history/controllers/blog_20210519152240.js | 104 ------------------- .history/controllers/blog_20210519152310.js | 104 ------------------- .history/controllers/blog_20210519152325.js | 104 ------------------- .history/controllers/blog_20210519152415.js | 104 ------------------- .history/controllers/blog_20210519152419.js | 104 ------------------- .history/controllers/blog_20210519152443.js | 104 ------------------- .history/controllers/blog_20210519152758.js | 104 ------------------- .history/controllers/blog_20210519152820.js | 105 ------------------- .history/controllers/blog_20210519152920.js | 105 ------------------- .history/controllers/blog_20210519153031.js | 105 ------------------- .history/controllers/blog_20210519153142.js | 105 ------------------- .history/controllers/blog_20210519153454.js | 105 ------------------- .history/controllers/blog_20210519153459.js | 105 ------------------- .history/controllers/blog_20210519153836.js | 105 ------------------- .history/controllers/blog_20210519153855.js | 105 ------------------- .history/controllers/blog_20210519153953.js | 106 -------------------- .history/controllers/blog_20210519154014.js | 106 -------------------- .history/controllers/blog_20210519154059.js | 106 -------------------- .history/controllers/blog_20210519154126.js | 105 ------------------- .history/controllers/blog_20210519154454.js | 106 -------------------- .history/controllers/blog_20210519154456.js | 106 -------------------- .history/controllers/blog_20210519154625.js | 106 -------------------- .history/controllers/blog_20210519154733.js | 106 -------------------- .history/controllers/blog_20210519154825.js | 104 ------------------- .history/models/Blog_20210519103433.js | 27 ----- .history/models/Blog_20210519150611.js | 28 ------ .history/models/Blog_20210519150818.js | 25 ----- .history/models/Blog_20210519152942.js | 25 ----- .history/models/Blog_20210519153800.js | 25 ----- .history/routes/blog_20210519114750.js | 14 --- .history/routes/blog_20210519151054.js | 14 --- 46 files changed, 4242 deletions(-) delete mode 100644 .history/controllers/blog_20210519114159.js delete mode 100644 .history/controllers/blog_20210519145955.js delete mode 100644 .history/controllers/blog_20210519150616.js delete mode 100644 .history/controllers/blog_20210519151427.js delete mode 100644 .history/controllers/blog_20210519151454.js delete mode 100644 .history/controllers/blog_20210519151725.js delete mode 100644 .history/controllers/blog_20210519151735.js delete mode 100644 .history/controllers/blog_20210519151822.js delete mode 100644 .history/controllers/blog_20210519151942.js delete mode 100644 .history/controllers/blog_20210519152021.js delete mode 100644 .history/controllers/blog_20210519152037.js delete mode 100644 .history/controllers/blog_20210519152116.js delete mode 100644 .history/controllers/blog_20210519152132.js delete mode 100644 .history/controllers/blog_20210519152207.js delete mode 100644 .history/controllers/blog_20210519152224.js delete mode 100644 .history/controllers/blog_20210519152240.js delete mode 100644 .history/controllers/blog_20210519152310.js delete mode 100644 .history/controllers/blog_20210519152325.js delete mode 100644 .history/controllers/blog_20210519152415.js delete mode 100644 .history/controllers/blog_20210519152419.js delete mode 100644 .history/controllers/blog_20210519152443.js delete mode 100644 .history/controllers/blog_20210519152758.js delete mode 100644 .history/controllers/blog_20210519152820.js delete mode 100644 .history/controllers/blog_20210519152920.js delete mode 100644 .history/controllers/blog_20210519153031.js delete mode 100644 .history/controllers/blog_20210519153142.js delete mode 100644 .history/controllers/blog_20210519153454.js delete mode 100644 .history/controllers/blog_20210519153459.js delete mode 100644 .history/controllers/blog_20210519153836.js delete mode 100644 .history/controllers/blog_20210519153855.js delete mode 100644 .history/controllers/blog_20210519153953.js delete mode 100644 .history/controllers/blog_20210519154014.js delete mode 100644 .history/controllers/blog_20210519154059.js delete mode 100644 .history/controllers/blog_20210519154126.js delete mode 100644 .history/controllers/blog_20210519154454.js delete mode 100644 .history/controllers/blog_20210519154456.js delete mode 100644 .history/controllers/blog_20210519154625.js delete mode 100644 .history/controllers/blog_20210519154733.js delete mode 100644 .history/controllers/blog_20210519154825.js delete mode 100644 .history/models/Blog_20210519103433.js delete mode 100644 .history/models/Blog_20210519150611.js delete mode 100644 .history/models/Blog_20210519150818.js delete mode 100644 .history/models/Blog_20210519152942.js delete mode 100644 .history/models/Blog_20210519153800.js delete mode 100644 .history/routes/blog_20210519114750.js delete mode 100644 .history/routes/blog_20210519151054.js diff --git a/.history/controllers/blog_20210519114159.js b/.history/controllers/blog_20210519114159.js deleted file mode 100644 index f6ea6c1..0000000 --- a/.history/controllers/blog_20210519114159.js +++ /dev/null @@ -1,103 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519145955.js b/.history/controllers/blog_20210519145955.js deleted file mode 100644 index 16d1963..0000000 --- a/.history/controllers/blog_20210519145955.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course._id, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519150616.js b/.history/controllers/blog_20210519150616.js deleted file mode 100644 index 16d1963..0000000 --- a/.history/controllers/blog_20210519150616.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course._id, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519151427.js b/.history/controllers/blog_20210519151427.js deleted file mode 100644 index b77e01b..0000000 --- a/.history/controllers/blog_20210519151427.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519151454.js b/.history/controllers/blog_20210519151454.js deleted file mode 100644 index 16d1963..0000000 --- a/.history/controllers/blog_20210519151454.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course._id, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519151725.js b/.history/controllers/blog_20210519151725.js deleted file mode 100644 index 41e17ac..0000000 --- a/.history/controllers/blog_20210519151725.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }) - .populate("_id ") - .select("-password"); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course._id, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519151735.js b/.history/controllers/blog_20210519151735.js deleted file mode 100644 index bb6bf06..0000000 --- a/.history/controllers/blog_20210519151735.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }) - .populate("_id ") - .select("-password"); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519151822.js b/.history/controllers/blog_20210519151822.js deleted file mode 100644 index 41e17ac..0000000 --- a/.history/controllers/blog_20210519151822.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }) - .populate("_id ") - .select("-password"); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course._id, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519151942.js b/.history/controllers/blog_20210519151942.js deleted file mode 100644 index 6e3a814..0000000 --- a/.history/controllers/blog_20210519151942.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }).populate("").select("-password"); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: course, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152021.js b/.history/controllers/blog_20210519152021.js deleted file mode 100644 index f3614e1..0000000 --- a/.history/controllers/blog_20210519152021.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: , - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152037.js b/.history/controllers/blog_20210519152037.js deleted file mode 100644 index ecb3602..0000000 --- a/.history/controllers/blog_20210519152037.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - console.log(course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152116.js b/.history/controllers/blog_20210519152116.js deleted file mode 100644 index e57c2c9..0000000 --- a/.history/controllers/blog_20210519152116.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find(_id); - console.log(course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152132.js b/.history/controllers/blog_20210519152132.js deleted file mode 100644 index ecb3602..0000000 --- a/.history/controllers/blog_20210519152132.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - console.log(course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152207.js b/.history/controllers/blog_20210519152207.js deleted file mode 100644 index 8d93c09..0000000 --- a/.history/controllers/blog_20210519152207.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.findById({ _id }); - console.log(course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152224.js b/.history/controllers/blog_20210519152224.js deleted file mode 100644 index eb2bed9..0000000 --- a/.history/controllers/blog_20210519152224.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.findById({ _id }); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152240.js b/.history/controllers/blog_20210519152240.js deleted file mode 100644 index 3fcbb8d..0000000 --- a/.history/controllers/blog_20210519152240.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.findById(_id); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152310.js b/.history/controllers/blog_20210519152310.js deleted file mode 100644 index 16ff14d..0000000 --- a/.history/controllers/blog_20210519152310.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find(_id); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152325.js b/.history/controllers/blog_20210519152325.js deleted file mode 100644 index 1fe749e..0000000 --- a/.history/controllers/blog_20210519152325.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152415.js b/.history/controllers/blog_20210519152415.js deleted file mode 100644 index 72b3d1c..0000000 --- a/.history/controllers/blog_20210519152415.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.findOne({ _id }); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152419.js b/.history/controllers/blog_20210519152419.js deleted file mode 100644 index 72b3d1c..0000000 --- a/.history/controllers/blog_20210519152419.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.findOne({ _id }); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152443.js b/.history/controllers/blog_20210519152443.js deleted file mode 100644 index 1fe749e..0000000 --- a/.history/controllers/blog_20210519152443.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const Course = require("../models/Course"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let course = await Course.find({ _id }); - console.log("Course ", course); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (course) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152758.js b/.history/controllers/blog_20210519152758.js deleted file mode 100644 index 2f29cf6..0000000 --- a/.history/controllers/blog_20210519152758.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152820.js b/.history/controllers/blog_20210519152820.js deleted file mode 100644 index b0cfe9a..0000000 --- a/.history/controllers/blog_20210519152820.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519152920.js b/.history/controllers/blog_20210519152920.js deleted file mode 100644 index 596af29..0000000 --- a/.history/controllers/blog_20210519152920.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user.firstName + " " + user.lastName, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153031.js b/.history/controllers/blog_20210519153031.js deleted file mode 100644 index a0f4d7d..0000000 --- a/.history/controllers/blog_20210519153031.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user.firstName + " " + user.lastName, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153142.js b/.history/controllers/blog_20210519153142.js deleted file mode 100644 index 1b4efdc..0000000 --- a/.history/controllers/blog_20210519153142.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user._id, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153454.js b/.history/controllers/blog_20210519153454.js deleted file mode 100644 index b8c7f06..0000000 --- a/.history/controllers/blog_20210519153454.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153459.js b/.history/controllers/blog_20210519153459.js deleted file mode 100644 index 13ac015..0000000 --- a/.history/controllers/blog_20210519153459.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153836.js b/.history/controllers/blog_20210519153836.js deleted file mode 100644 index fa3e179..0000000 --- a/.history/controllers/blog_20210519153836.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: User.find({ _id }), - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153855.js b/.history/controllers/blog_20210519153855.js deleted file mode 100644 index 1eb7526..0000000 --- a/.history/controllers/blog_20210519153855.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: , - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519153953.js b/.history/controllers/blog_20210519153953.js deleted file mode 100644 index ae60f82..0000000 --- a/.history/controllers/blog_20210519153953.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user._id == _id) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user.firstName, - }); - console.log("Brfore save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154014.js b/.history/controllers/blog_20210519154014.js deleted file mode 100644 index 98a24d4..0000000 --- a/.history/controllers/blog_20210519154014.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user.firstName, - }); - console.log("Brfore save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154059.js b/.history/controllers/blog_20210519154059.js deleted file mode 100644 index 98274a1..0000000 --- a/.history/controllers/blog_20210519154059.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - console.log("Brfore save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154126.js b/.history/controllers/blog_20210519154126.js deleted file mode 100644 index b7d1f2b..0000000 --- a/.history/controllers/blog_20210519154126.js +++ /dev/null @@ -1,105 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - }); - console.log("Brfore save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154454.js b/.history/controllers/blog_20210519154454.js deleted file mode 100644 index 959a2a9..0000000 --- a/.history/controllers/blog_20210519154454.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author:user. - }); - console.log("Before save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154456.js b/.history/controllers/blog_20210519154456.js deleted file mode 100644 index 7ff2191..0000000 --- a/.history/controllers/blog_20210519154456.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - // console.log("User ", user); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - console.log("Before save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154625.js b/.history/controllers/blog_20210519154625.js deleted file mode 100644 index b18be73..0000000 --- a/.history/controllers/blog_20210519154625.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.find({ _id }); - console.log("User ", user._id); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - // console.log("Before save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154733.js b/.history/controllers/blog_20210519154733.js deleted file mode 100644 index 7150d52..0000000 --- a/.history/controllers/blog_20210519154733.js +++ /dev/null @@ -1,106 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.findById({ _id }); - console.log("User ", user._id); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - // console.log("Before save", blog); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/controllers/blog_20210519154825.js b/.history/controllers/blog_20210519154825.js deleted file mode 100644 index b7c474e..0000000 --- a/.history/controllers/blog_20210519154825.js +++ /dev/null @@ -1,104 +0,0 @@ -const { log } = require("handlebars"); -const Blog = require("../models/Blog"); -const User = require("../models/User"); - -module.exports.getAllBlogs = async (req, res, next) => { - try { - let blog = await Blog.find(); - if (blog) { - res.json({ blogs: blog }); - } else { - console.log("Error in Blog", blog); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. - try { - let user = await User.findById({ _id }); - if (!title) { - res.status(422).json({ message: "Please, Add Title of the Blog" }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add Body of the Blog" }); - return; - } - if (user) { - let blog = new Blog({ - title, - body, - image, - date: new Date(), - author: user, - }); - await blog.save(); - res.json({ message: "Blog Saved Successfully!" }); - } else { - res.status.json({ error: "User Doesn't Exists" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.deleteBlog = async (req, res, next) => { - const { _id } = req.body; - try { - let blog = await Blog.find({ _id }); - if (blog) { - await Blog.findByIdAndDelete(_id); - res.json({ message: "Blog Deleted!" }); - } else { - res.status(404).json({ message: "Blog Not Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; - -module.exports.editBlog = async (req, res, next) => { - const { _id, body, title, image } = req.body; - - try { - if (!title) { - res.status(422).json({ message: "Please, Add the Title of the Blog." }); - return; - } - if (!body) { - res.status(422).json({ message: "Please, Add the Body of the Blog." }); - return; - } - if (!image) { - res.status(422).json({ message: "Please, Add the Image of the Blog." }); - return; - } - let blog = Blog.findById(_id); - if (blog) { - blog.title = title; - blog.body = body; - blog.image = image; - await blog.save(); - res.json({ message: "Blog Updated!" }); - } else { - res.status(422).json({ error: "Blog Doesn't Found" }); - return; - } - } catch { - (err) => { - res.status(422).json({ error: err }); - }; - } -}; diff --git a/.history/models/Blog_20210519103433.js b/.history/models/Blog_20210519103433.js deleted file mode 100644 index 33e6c55..0000000 --- a/.history/models/Blog_20210519103433.js +++ /dev/null @@ -1,27 +0,0 @@ -const mongoose = require("mongoose"); -const blogSchema = new mongoose.Schema({ - title: { - type: String, - require: true, - }, - author: { - type: String, - ref: "Course", - }, - date: { - type: Date, - }, - image: { - type: String, - default: "", - }, - body: { - type: String, - required: true, - }, - isBookMarked: { - type: Boolean, - default: false, - }, -}); -module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519150611.js b/.history/models/Blog_20210519150611.js deleted file mode 100644 index ffc56dd..0000000 --- a/.history/models/Blog_20210519150611.js +++ /dev/null @@ -1,28 +0,0 @@ -const mongoose = require("mongoose"); -const { ObjectId } = mongoose.Schema.Types; -const blogSchema = new mongoose.Schema({ - title: { - type: String, - require: true, - }, - author: { - type: ObjectId, - ref: "Course", - }, - date: { - type: Date, - }, - image: { - type: String, - default: "", - }, - body: { - type: String, - required: true, - }, - isBookMarked: { - type: Boolean, - default: false, - }, -}); -module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519150818.js b/.history/models/Blog_20210519150818.js deleted file mode 100644 index 6ad1746..0000000 --- a/.history/models/Blog_20210519150818.js +++ /dev/null @@ -1,25 +0,0 @@ -const mongoose = require("mongoose"); -const { ObjectId } = mongoose.Schema.Types; -const blogSchema = new mongoose.Schema({ - title: { - type: String, - require: true, - }, - author: { ref: "Course", type: ObjectId }, - date: { - type: Date, - }, - image: { - type: String, - default: "", - }, - body: { - type: String, - required: true, - }, - isBookMarked: { - type: Boolean, - default: false, - }, -}); -module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519152942.js b/.history/models/Blog_20210519152942.js deleted file mode 100644 index a4bd0fc..0000000 --- a/.history/models/Blog_20210519152942.js +++ /dev/null @@ -1,25 +0,0 @@ -const mongoose = require("mongoose"); -const { ObjectId } = mongoose.Schema.Types; -const blogSchema = new mongoose.Schema({ - title: { - type: String, - require: true, - }, - author: { ref: "User", type: ObjectId }, - date: { - type: Date, - }, - image: { - type: String, - default: "", - }, - body: { - type: String, - required: true, - }, - isBookMarked: { - type: Boolean, - default: false, - }, -}); -module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/models/Blog_20210519153800.js b/.history/models/Blog_20210519153800.js deleted file mode 100644 index 774666e..0000000 --- a/.history/models/Blog_20210519153800.js +++ /dev/null @@ -1,25 +0,0 @@ -const mongoose = require("mongoose"); - -const blogSchema = new mongoose.Schema({ - title: { - type: String, - require: true, - }, - author: { ref: "User", type: mongoose.Schema.Types.ObjectId }, - date: { - type: Date, - }, - image: { - type: String, - default: "", - }, - body: { - type: String, - required: true, - }, - isBookMarked: { - type: Boolean, - default: false, - }, -}); -module.exports = mongoose.model("Blog", blogSchema); diff --git a/.history/routes/blog_20210519114750.js b/.history/routes/blog_20210519114750.js deleted file mode 100644 index 51e5d57..0000000 --- a/.history/routes/blog_20210519114750.js +++ /dev/null @@ -1,14 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const BlogController = require("../controllers/blog"); -const isAuth = require("../middleware/requirelogin"); - -router.post("/add-blog", BlogController.addBlog); - -router.get("/get-all-blogs", BlogController.getAllBlogs); - -router.post("/delete-blog/", isAuth, BlogController.deleteBlog); - -router.post("/edit-blog/", isAuth, BlogController.editBlog); - -module.exports = router; diff --git a/.history/routes/blog_20210519151054.js b/.history/routes/blog_20210519151054.js deleted file mode 100644 index 9336f60..0000000 --- a/.history/routes/blog_20210519151054.js +++ /dev/null @@ -1,14 +0,0 @@ -const express = require("express"); -const router = express.Router(); -const BlogController = require("../controllers/blog"); -const isAuth = require("../middleware/requirelogin"); - -router.post("/add-blog", BlogController.addBlog); - -router.get("/get-all-blogs", BlogController.getAllBlogs); - -router.post("/delete-blog/", BlogController.deleteBlog); - -router.post("/edit-blog/", BlogController.editBlog); - -module.exports = router; From c003038778be54d04604d9920f51f780029b4394 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 19 May 2021 15:53:34 +0530 Subject: [PATCH 33/39] Done! --- controllers/blog.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/blog.js b/controllers/blog.js index b7c474e..e1e6318 100644 --- a/controllers/blog.js +++ b/controllers/blog.js @@ -4,7 +4,10 @@ const User = require("../models/User"); module.exports.getAllBlogs = async (req, res, next) => { try { - let blog = await Blog.find(); + let blog = await Blog.find().populate( + "author", + "-passwordResetToken -password" + ); if (blog) { res.json({ blogs: blog }); } else { From bcf391a7d0eab4ac351ee5db5c723cc1cec2248a Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Thu, 20 May 2021 12:14:03 +0530 Subject: [PATCH 34/39] Updated! --- controllers/blog.js | 13 +++++-------- models/Blog.js | 2 +- routes/Coupon.js | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/controllers/blog.js b/controllers/blog.js index e1e6318..2106169 100644 --- a/controllers/blog.js +++ b/controllers/blog.js @@ -4,10 +4,7 @@ const User = require("../models/User"); module.exports.getAllBlogs = async (req, res, next) => { try { - let blog = await Blog.find().populate( - "author", - "-passwordResetToken -password" - ); + let blog = await Blog.find(); if (blog) { res.json({ blogs: blog }); } else { @@ -22,7 +19,7 @@ module.exports.getAllBlogs = async (req, res, next) => { }; module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image } = req.body; //_id is of user from frontend who is adding the blog. + const { _id, title, body, image, author } = req.body; //_id is of user from frontend who is adding the blog. try { let user = await User.findById({ _id }); if (!title) { @@ -39,7 +36,7 @@ module.exports.addBlog = async (req, res, next) => { body, image, date: new Date(), - author: user, + author, }); await blog.save(); res.json({ message: "Blog Saved Successfully!" }); @@ -88,12 +85,12 @@ module.exports.editBlog = async (req, res, next) => { res.status(422).json({ message: "Please, Add the Image of the Blog." }); return; } - let blog = Blog.findById(_id); + let blog = await Blog.findById({ _id }); if (blog) { blog.title = title; blog.body = body; blog.image = image; - await blog.save(); + blog = await blog.save(); res.json({ message: "Blog Updated!" }); } else { res.status(422).json({ error: "Blog Doesn't Found" }); diff --git a/models/Blog.js b/models/Blog.js index 774666e..b37cd16 100644 --- a/models/Blog.js +++ b/models/Blog.js @@ -5,7 +5,7 @@ const blogSchema = new mongoose.Schema({ type: String, require: true, }, - author: { ref: "User", type: mongoose.Schema.Types.ObjectId }, + author: { required: true, type: String }, date: { type: Date, }, diff --git a/routes/Coupon.js b/routes/Coupon.js index dc53f24..5c8b41f 100644 --- a/routes/Coupon.js +++ b/routes/Coupon.js @@ -21,7 +21,7 @@ router.post("/set-coupon", (req, res) => { }); } }); -router.get("/getAllCoupons", isAuth, isAdmin, couponController.getAllCoupons); +router.get("/getAllCoupons", couponController.getAllCoupons); router.post("/addCoupon", isAuth, isAdmin, couponController.addCoupon); From 91b4bf07271bc0523313d40e10cf3d2e48eb18f2 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Fri, 21 May 2021 12:29:21 +0530 Subject: [PATCH 35/39] Edit Profile --- controllers/profile.js | 203 ++++++++++++++++++++++------------------- routes/blog.js | 8 +- routes/profile.js | 18 ++-- 3 files changed, 123 insertions(+), 106 deletions(-) diff --git a/controllers/profile.js b/controllers/profile.js index 6017015..662b62c 100644 --- a/controllers/profile.js +++ b/controllers/profile.js @@ -1,103 +1,118 @@ -const Student = require('../models/Student') ; -const User = require('../models/User') ; +const Student = require("../models/Student"); +const User = require("../models/User"); //function for trimming strings -function trim_arr(arr) -{ - let newArr = arr.map(a => { - return a.trim() ; - }) - return newArr ; +function trim_arr(arr) { + let newArr = arr.map((a) => { + return a.trim(); + }); + return newArr; } -module.exports.getProfile =async (req , res , next) => { - try - { - //we can get the profile of the user including the courses which user has bought - const userId = req.user._id ; - let user = await User.findById(userId) ; - let student = await Student.findOne({user : userId}).populate("courses.basicInfo") ; - res.json({ - user:user , - student:student - }) ; - } - catch(err) - { - res.json({ - error:err - }) ; - } -} +module.exports.getProfile = async (req, res, next) => { + try { + //we can get the profile of the user including the courses which user has bought + const userId = req.user._id; + let user = await User.findById(userId); + let student = await Student.findOne({ user: userId }).populate( + "courses.basicInfo" + ); + res.json({ + user: user, + student: student, + }); + } catch (err) { + res.json({ + error: err, + }); + } +}; -module.exports.postProfile = async (req , res , next) => { - try - { - //Here we are updating the profile of the user - const userId = req.user._id ; - let interests = req.body.interests ; - let projects = req.body.projects ; - let yearofgrad = req.body.yearofgrad ; - let phoneNumber = req.body.phoneNumber ; - let institute = req.body.institute ; - let skills = req.body.skills ; +module.exports.postProfile = async (req, res, next) => { + try { + //Here we are updating the profile of the user + const userId = req.user._id; + let interests = req.body.interests; + let projects = req.body.projects; + let yearofgrad = req.body.yearofgrad; + let phoneNumber = req.body.phoneNumber; + let institute = req.body.institute; + let skills = req.body.skills; - let student = await Student.findOne({user : userId}) ; - if(interests) - { - student.interests = trim_arr(interests.split(",")) ; - } - if(projects) - { - student.projects = trim_arr(projects.split(",")) ; - } - if(skills) - { - student.skills = trim_arr(skills.split(",")) ; - } - if(yearofgrad) - { - student.yearofgrad = yearofgrad.trim() ; - } - if(phoneNumber) - { - student.phoneNumber = phoneNumber.trim() ; - } - if(institute) - { - student.institute = institute.trim() ; - } - await student.save() ; + let student = await Student.findOne({ user: userId }); + if (interests) { + student.interests = trim_arr(interests.split(",")); + } + if (projects) { + student.projects = trim_arr(projects.split(",")); + } + if (skills) { + student.skills = trim_arr(skills.split(",")); + } + if (yearofgrad) { + student.yearofgrad = yearofgrad.trim(); + } + if (phoneNumber) { + student.phoneNumber = phoneNumber.trim(); + } + if (institute) { + student.institute = institute.trim(); + } + await student.save(); - res.json({ - message:"Updated profile" - }) - } - catch(err) - { - console.log(err); - res.json({ - error:err - }) ; - } -} + res.json({ + message: "Updated profile", + }); + } catch (err) { + console.log(err); + res.json({ + error: err, + }); + } +}; -module.exports.deleteUser = async (req , res , next) => { - //here we are deleting the user - const userId = req.user._id ; - try - { - await Student.deleteOne({user:userId}) ; - await User.deleteOne({_id : userId}) ; - res.json({ - message:"Successfully deleted" - }) ; +module.exports.deleteUser = async (req, res, next) => { + //here we are deleting the user + const userId = req.user._id; + try { + await Student.deleteOne({ user: userId }); + await User.deleteOne({ _id: userId }); + res.json({ + message: "Successfully deleted", + }); + } catch (err) { + console.log(err); + res.json({ + error: err, + }); + } +}; + +module.exports.editProfile = async (req, res, next) => { + const { _id, newFirstName, newLastName, email } = req.body; + try { + if (_id) { + let user = await User.findById({ _id }); + console.log("User", user); + if (user) { + user.firstName = newFirstName; + user.lastName = newLastName; + user.email = email; + user = await user.save(); + res.json({ message: "Profile Updated!" }); + } else { + res.status(422).json({ error: "User Not Found with that Id" }); + return; + } + } else { + res.status(422).json({ error: "User Id is Must" }); + return; } - catch(err) - { - console.log(err); - res.json({ - error:err - }) ; - } -} \ No newline at end of file + } catch { + (err) => { + console.log("error", err); + res.status(422).json({ error: err }); + return; + }; + } +}; diff --git a/routes/blog.js b/routes/blog.js index 9336f60..03e0a99 100644 --- a/routes/blog.js +++ b/routes/blog.js @@ -3,12 +3,12 @@ const router = express.Router(); const BlogController = require("../controllers/blog"); const isAuth = require("../middleware/requirelogin"); -router.post("/add-blog", BlogController.addBlog); +router.post("/addBlog", BlogController.addBlog); -router.get("/get-all-blogs", BlogController.getAllBlogs); +router.get("/getAllBlogs", BlogController.getAllBlogs); -router.post("/delete-blog/", BlogController.deleteBlog); +router.post("/deleteBlog/", BlogController.deleteBlog); -router.post("/edit-blog/", BlogController.editBlog); +router.post("/editBlog/", BlogController.editBlog); module.exports = router; diff --git a/routes/profile.js b/routes/profile.js index d28c137..adc3a2c 100644 --- a/routes/profile.js +++ b/routes/profile.js @@ -1,13 +1,15 @@ -const express = require('express') ; -const profileRoute = require('../controllers/profile') ; -const authMiddleware = require('../middleware/requirelogin') ; +const express = require("express"); +const profileRoute = require("../controllers/profile"); +const authMiddleware = require("../middleware/requirelogin"); -const router = express.Router() ; +const router = express.Router(); -router.get('/getProfile' , authMiddleware , profileRoute.getProfile) ; +router.get("/getProfile", authMiddleware, profileRoute.getProfile); -router.post('/postProfile' , authMiddleware , profileRoute.postProfile) ; +router.post("/postProfile", authMiddleware, profileRoute.postProfile); -router.post('/deleteUser' , authMiddleware , profileRoute.deleteUser) ; +router.post("/deleteUser", authMiddleware, profileRoute.deleteUser); -module.exports = router ; \ No newline at end of file +router.post("/editUser", authMiddleware, profileRoute.editProfile); + +module.exports = router; From dad033cc4bcfed550bd4c1bd65339cbeeb74c17e Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Sat, 22 May 2021 17:10:26 +0530 Subject: [PATCH 36/39] Readme.md --- readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f4e21bf --- /dev/null +++ b/readme.md @@ -0,0 +1 @@ +Cantileverlabs Nodejs Backend API Documentation. From 2b0d546ccab1fe95ff71e8211b698692b9fba9d0 Mon Sep 17 00:00:00 2001 From: yashraj verma Date: Sat, 22 May 2021 21:49:46 +0530 Subject: [PATCH 37/39] Update readme.md Done Documentation --- readme.md | 310 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 309 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f4e21bf..f9ad739 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,309 @@ -Cantileverlabs Nodejs Backend API Documentation. +# Cantileverlabs Nodejs Backend API Documentation. +## Project Structure : + ``` + /root + |- controllers + | |-- admin.js + | |-- auth.js + | |-- blog.js + | |-- coupon.js + | |-- course.js + | |-- payment.js + | |-- profile.js + | |-- query.js + | + |- middlewares + | |-- isAdmin.js + | |-- requireLogin.js + | + |- models + | |-- Blog.js + | |-- Coupon.js + | |-- Course.js + | |-- CourseType.js + | |-- Order.js + | |-- query.js + | |-- Student.js + | |-- User.js + | + |- routes + | |-- admin.js + | |-- auth.js + | |-- blog.js + | |-- Coupon.js + | |-- course.js + | |-- payment.js + | |-- profile.js + | |-- query.js + | + |- app.js + ``` + ### App will listen on the port `http://localhost:5000` + + # Routes Functions and Body Parameters. + + ## File :- Admin.js + + ``` + Route : /addSchedule + Method: POST + Requirements : |-- isAuth + |-- isAdmin + + Route : /editSchedule + Method: POST + Requirements : |-- isAuth + |-- isAdmin + + Route : /deleteSchedule + Method: POST + Requirements : |-- isAuth + |-- isAdmin + +``` + + ## File :- Auth.js + ### Note: `All the Body Params are as it is` + + ``` + Route : /protected + Method: GET + Requirements : |-- isAuth + + + Route : /signup + Method: POST + Body Params :- firstName + - lastName + - email *must* + - password *must* + ---------- for sending the Verification Emial to user. + - sending_company_email + - subject + Response : { + message:"You are Registered, Please Login" + } + Response if email verification: { + message:"Email sent with 6 Digit OTP , Check your Email" + } + + Route : /verifyemail + Method: POST + Body Params: - otp + + Route : /signin + Method: POST + Body Params : - email + - password + + Route : /sendotp + Method: POST + Body Params : phoneNumber + Respone : {id:id} id of the transaction. + + Route : /getotp + Method: POST + Body Params : id , otp + Response : {message:"Code Verified"} + + Route : /forgotpassword + Method: POST + Body Params : email,link,sending_company_email,subject. + + { - email of the user. } + { - link is where to send the user for resetting a password. } + { - sending_company_email is email address of the comapny to send the email to the user. } + { - subject is email subject } + + Route : /resetpassword/:_id/:token + Method: POST + Headers Params : _id, token + Body Params : password + Response : {message:"Password Updated!"} + +``` + + ## File :- BLog.js + + ``` + Route : /addBlog + Method: POST + Body Params : _id , title , body , author , image + + String : { _id : Database _id of a person who is adding up a blog} + String : { title : title of the blog} + String: { body : body of the blog} + String: image of the blog to be added} + String : Author of the blog} + + + Route : /getAllBlogs + Method: GET + Body Params : none + + Route : /deleteBlog + Method: POST + Body Params : _id * must * + + { _id : _id is a id of the blog to delete.} + + Route : /editBlog + Method: POST + Body Params : _id * must * , body , title , image. + + String : { _id : Database _id of a person who is adding up a blog} + String : { title : title of the blog} + String: { body : body of the blog} + String: image of the blog to be added} + +``` + + ## File :- Coupon.js + + ``` + Route : /set-coupon + Method: POST + Body Params : percentage , coupon_code , remainingTimes + + String : { couponCode : Coupon code of the coupon} + String: { percentage: Discount percentage of the coupon} + String: { numAllowed : No of times the coupon is allwoed} + + Route : /getAllCoupons + Method: GET + Body Params : none + + Route : /deleteCoupon + Method: POST + Requirements : isAdmin, isAuth + Body Params : couponCode * must * + + { couponCode : coupon code of the coupon } + + Route : /addCoupon + Method: POST + Requirements : isAdmin, isAuth + Body Params : couponCode * must * , percentage , numAllowed + + String : { couponCode : Coupon code of the coupon} + String: { percentage: Discount percentage of the coupon} + String: { numAllowed : No of times the coupon is allwoed} + +``` + +## File Course.js + +``` + Route : /addCourse + Method : POST + Requirements : isAdmin , isAuth + Body Params : name , mentor , totalLectures , route + + Route : /getAllCourse + Method : GET + Requirements : None + Body Params : None + + + Route : /getSingleParCourse + Method : POST + Body Params : parCourseId + + + Route : /getMeetSchedule + Method : POST + Requiremnents : isAuth + Body Params : courseId + + + Route : /getFromRoute + Method : GET + Requirements : None + Query Params : route + + + Route : /addClick + Method : POST + Requiremnts : isAuth + Body Params : route , userId + + ``` + + ## File Payments.js + + ``` + + Route : /verification + Method : POST + Requirements : None + Body Params : + + + Route : /razorpay + Method : POST + Requirements : requireLogin + Body Params : courseId , couponCode + + ``` + + + ## File Profle.js + + ``` + Route : getProfile + Method : GET + Requirements : requireLogin + Body Params : _id of the User. + + + Route : postProfile + Method : POST + Requirements : requireLogin + Body Params : _id , interests , projects , yearofgrad , phoneNumber , institute , skills + + Route : deleteUser + Method : POST + Requirements : requireLogin + Body Params : _id + {_id : _id of the User to delete the Profile} + + + Route : editUser + Method : POST + Requirements : requireLogin + Body Params : _id , newFirstName , newLastName ,email + + {_id : _id of the user to edit the profile} + {newFirstName : New Name } + {newLastName : New last name} + {email : if email has to be changed} + +``` + + + +## File Query.js + +``` + Route : addQuery + Method : POST + Requirements : None + Body Params : fullName , phoneNumber , email , query , other , graduationYear + + + Route : getAllQueries + Method : GET + Requirements : None + Body Params : None + + + Route : getOtherQueries + Method : GET + Requirements : None + Body Params : None + + + Route : getTypeQueries + Method : POST + Requirements : None + Body Params : type From df0d19b1069740cadf4e4630cee29d1d63513b25 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Wed, 26 May 2021 15:35:16 +0530 Subject: [PATCH 38/39] blog image grid-fs --- app.js | 27 +- controllers/auth.js | 22 ++ controllers/blog.js | 52 ++- models/Blog.js | 2 +- package-lock.json | 820 +++++++++++++++++++++++++++++++++++++++++++- package.json | 4 + readme.md | 312 ++++++++++++++++- routes/auth.js | 2 + routes/blog.js | 22 +- 9 files changed, 1236 insertions(+), 27 deletions(-) diff --git a/app.js b/app.js index b02365d..180c92c 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,5 @@ const express = require("express"); +const app = express(); const mongoose = require("mongoose"); const bodyparser = require("body-parser"); const authRoute = require("./routes/auth"); @@ -11,7 +12,6 @@ const adminRoute = require("./routes/admin"); const blogRouter = require("./routes/blog"); const port = process.env.PORT || 5000; const cors = require("cors"); -const app = express(); //const passport = require('passport'); //const cookieSession = require('cookie-session') ; @@ -75,21 +75,18 @@ app.use(bodyparser.json()); // req.logout() ; // res.redirect('/') ; // }) -mongoose - .connect(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, - useFindAndModify: false, - }) - .then((result) => { - console.log("connected"); - app.listen(port, () => { - console.log("server is running on port", port); - }); - }) - .catch((err) => { - console.log(err); + +mongoose.connect(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, +}); +let conn = mongoose.connection.on("connected", (res) => { + console.log("Connected to MongoDB"); + app.listen(port, () => { + console.log("Server Listening on Port", port); }); +}); app.use(authRoute); app.use(profileRoute); diff --git a/controllers/auth.js b/controllers/auth.js index 675a180..07a4a01 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -8,6 +8,10 @@ const messagebird = require("messagebird")("llVKD53ve6QRpbCKOHzWBADaS", null, [ ]); const nodemailer = require("nodemailer"); const smtpTransport = require("nodemailer-smtp-transport"); +// const { OAuth2Client } = require("google-auth-library"); +// const client = new OAuth2Client( +// "7810129519-dr5l4l1i7a7bh07sbvl49gd80coenphj.apps.googleusercontent.com" +// ); // -------------------------------------------- mail transporter ----------------------------------------- @@ -148,6 +152,24 @@ module.exports.postSignin = async (req, res, next) => { console.log(err); } }; +// Gmail Login Starts. +// ----------------------------------------------------------------------------------------------- + +//1026548376782-5p5tjck8ffhan9l1ajhv6orr87dfkrrf.apps.googleusercontent.com + +// module.exports.googleSignIn = async (req, res, next) => { +// const { tokenId } = req.params; +// console.log("TokenId from frontend", tokenId); +// client +// .verifyIdToken({ +// idToken: tokenId, +// audience: +// "7810129519-dr5l4l1i7a7bh07sbvl49gd80coenphj.apps.googleusercontent.com", +// }) +// .then((response) => { +// console.log(response.payload); +// }); +// }; // Phone verification Starts. // ----------------------------------------------------------------------------------------------- diff --git a/controllers/blog.js b/controllers/blog.js index 2106169..ad4398a 100644 --- a/controllers/blog.js +++ b/controllers/blog.js @@ -1,12 +1,37 @@ const { log } = require("handlebars"); const Blog = require("../models/Blog"); const User = require("../models/User"); +const mongoose = require("mongoose"); +const GridFsStorage = require("multer-gridfs-storage"); +const Grid = require("gridfs-stream"); +const multer = require("multer"); +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; + +const connect = mongoose.createConnection(MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, +}); +let gfs; +connect.once("open", () => { + // initialize stream + gfs = Grid(connect.db, mongoose.mongo); + gfs.collection("blogImages"); +}); module.exports.getAllBlogs = async (req, res, next) => { try { let blog = await Blog.find(); if (blog) { - res.json({ blogs: blog }); + gfs.files.find().toArray((err, files) => { + //check if files exist + if (!files || files.length == 0) { + return res.status(404).json({ + err: "No files exist", + }); + } + // files exist + res.json({ files, blogs: blog }); + }); } else { console.log("Error in Blog", blog); return; @@ -18,9 +43,26 @@ module.exports.getAllBlogs = async (req, res, next) => { } }; -module.exports.addBlog = async (req, res, next) => { - const { _id, title, body, image, author } = req.body; //_id is of user from frontend who is adding the blog. +module.exports.getSingleBlog = async (req, res, next) => { try { + const { id } = req.params; + let blog = await Blog.findById({ _id: id }); + if (blog) { + res.json({ blog }); + } else { + res.json({ error: "Blog Not Found" }); + } + } catch { + (err) => { + console.log("Error", err); + }; + } +}; + +module.exports.addBlog = async (req, res, next) => { + const { _id, title, body, author } = req.body; //_id is of user from frontend who is adding the blog. + try { + console.log("Image File", req.file); let user = await User.findById({ _id }); if (!title) { res.status(422).json({ message: "Please, Add Title of the Blog" }); @@ -34,8 +76,8 @@ module.exports.addBlog = async (req, res, next) => { let blog = new Blog({ title, body, - image, - date: new Date(), + image: req.file, + date: new Date().toISOString(), author, }); await blog.save(); diff --git a/models/Blog.js b/models/Blog.js index b37cd16..7ebbcc7 100644 --- a/models/Blog.js +++ b/models/Blog.js @@ -10,7 +10,7 @@ const blogSchema = new mongoose.Schema({ type: Date, }, image: { - type: String, + type: Object, default: "", }, body: { diff --git a/package-lock.json b/package-lock.json index a93f048..112e364 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,11 +18,15 @@ "crypto": "^1.0.1", "dotenv": "^9.0.1", "express": "^4.17.1", + "google-auth-library": "^7.0.4", "grandjs": "^2.2.30", + "gridfs-stream": "^1.1.1", "handlebars": "^4.7.7", "jsonwebtoken": "^8.5.1", "messagebird": "^3.6.1", "mongoose": "^5.12.2", + "multer": "^1.4.2", + "multer-gridfs-storage": "^4.2.0", "nodemailer": "^6.6.0", "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", @@ -510,6 +514,17 @@ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -522,6 +537,38 @@ "node": ">= 0.6" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -597,6 +644,11 @@ "node": ">= 8" } }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=" + }, "node_modules/aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -624,6 +676,14 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "engines": { + "node": ">=8" + } + }, "node_modules/asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", @@ -749,6 +809,14 @@ "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" }, + "node_modules/bignumber.js": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", + "engines": { + "node": "*" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -907,6 +975,11 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, + "node_modules/buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, "node_modules/bunyan": { "version": "1.8.15", "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", @@ -924,6 +997,39 @@ "safe-json-stringify": "~1" } }, + "node_modules/busboy": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", + "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", + "dependencies": { + "dicer": "0.2.5", + "readable-stream": "1.1.x" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/busboy/node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "node_modules/busboy/node_modules/readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/busboy/node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, "node_modules/bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -1249,6 +1355,20 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "engines": [ + "node >= 0.8" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, "node_modules/configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", @@ -1523,6 +1643,39 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "node_modules/dicer": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", + "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=", + "dependencies": { + "readable-stream": "1.1.x", + "streamsearch": "0.1.2" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/dicer/node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "node_modules/dicer/node_modules/readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/dicer/node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, "node_modules/dom-serializer": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.1.tgz", @@ -1666,7 +1819,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "dependencies": { "once": "^1.4.0" } @@ -1725,6 +1877,14 @@ "node": ">= 0.6" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", @@ -1796,6 +1956,11 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, + "node_modules/fast-text-encoding": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", + "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1853,6 +2018,11 @@ "node": ">=8" } }, + "node_modules/flushwritable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flushwritable/-/flushwritable-1.0.0.tgz", + "integrity": "sha1-PjKNj95BKtR+c44751C00pAENJg=" + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1996,6 +2166,21 @@ "node": ">=0.10.0" } }, + "node_modules/gaxios": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.2.1.tgz", + "integrity": "sha512-s+rTywpw6CmfB8r9TXYkpix7YFeuRjnR/AqhaJrQqsNhsAqej+IAiCc3hadzQH3gHyWth30tvYjxH8EVjQt/8Q==", + "dependencies": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^5.0.0", + "is-stream": "^2.0.0", + "node-fetch": "^2.3.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/gaze": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", @@ -2007,6 +2192,18 @@ "node": ">= 4.0.0" } }, + "node_modules/gcp-metadata": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.1.tgz", + "integrity": "sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==", + "dependencies": { + "gaxios": "^4.0.0", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -2142,6 +2339,74 @@ "node": ">=0.6.0" } }, + "node_modules/google-auth-library": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.0.4.tgz", + "integrity": "sha512-o8irYyeijEiecTXeoEe8UKNEzV1X+uhR4b2oNdapDMZixypp0J+eHimGOyx5Joa3UAeokGngdtDLXtq9vDqG2Q==", + "dependencies": { + "arrify": "^2.0.0", + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "fast-text-encoding": "^1.0.0", + "gaxios": "^4.0.0", + "gcp-metadata": "^4.2.0", + "gtoken": "^5.0.4", + "jws": "^4.0.0", + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/google-auth-library/node_modules/jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/google-auth-library/node_modules/jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "dependencies": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/google-auth-library/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/google-auth-library/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/google-p12-pem": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.3.tgz", + "integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", + "dependencies": { + "node-forge": "^0.10.0" + }, + "bin": { + "gp12-pem": "build/src/bin/gp12-pem.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -2210,6 +2475,49 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/gridfs-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/gridfs-stream/-/gridfs-stream-1.1.1.tgz", + "integrity": "sha1-PdOhAOwgIaGBKC9utGcJY2B034k=", + "dependencies": { + "flushwritable": "^1.0.0" + }, + "engines": { + "node": ">= 0.4.2" + } + }, + "node_modules/gtoken": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.2.1.tgz", + "integrity": "sha512-OY0BfPKe3QnMsY9MzTHTSKn+Vl2l1CcLe6BwDEQj00mbbkl5nyQ/7EUREstg4fQNZ8iYE7br4JJ7TdKeDOPWmw==", + "dependencies": { + "gaxios": "^4.0.0", + "google-p12-pem": "^3.0.3", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/gtoken/node_modules/jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/gtoken/node_modules/jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "dependencies": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, "node_modules/handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -2296,6 +2604,14 @@ "node": ">=4" } }, + "node_modules/has-own-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz", + "integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", @@ -2399,6 +2715,39 @@ "node": ">= 0.8.0" } }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -2603,6 +2952,11 @@ "node": ">=4" } }, + "node_modules/is-generator": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz", + "integrity": "sha1-wUwhBX7TbjKNuANHlmxpP4hjifM=" + }, "node_modules/is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", @@ -2664,6 +3018,19 @@ "node": ">=8" } }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" + }, + "node_modules/is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "engines": { + "node": ">=8" + } + }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -2729,6 +3096,14 @@ "node": ">=4" } }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, "node_modules/json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -3381,6 +3756,14 @@ "saslprep": "^1.0.0" } }, + "node_modules/mongodb-uri": { + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/mongodb-uri/-/mongodb-uri-0.9.7.tgz", + "integrity": "sha1-D3ca0W9IOuZfQoeWlCjp+8SqYYE=", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/mongoose": { "version": "5.12.2", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.2.tgz", @@ -3454,6 +3837,44 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "node_modules/multer": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.2.tgz", + "integrity": "sha512-xY8pX7V+ybyUpbYMxtjM9KAiD9ixtg5/JkeKUTD6xilfDv0vzzOFcCp4Ljb1UU3tSOM3VTZtKo63OmzOrGi3Cg==", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^0.2.11", + "concat-stream": "^1.5.2", + "mkdirp": "^0.5.1", + "object-assign": "^4.1.1", + "on-finished": "^2.3.0", + "type-is": "^1.6.4", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/multer-gridfs-storage": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/multer-gridfs-storage/-/multer-gridfs-storage-4.2.0.tgz", + "integrity": "sha512-N2/QlZVsHUGSNmHx367+j2u8MpuZHxb0AEu9wsqNH0ROusSlcl7ERBt6en+IuHv4kAnrLNE4CTNo1yYHoUb7YA==", + "dependencies": { + "has-own-prop": "^2.0.0", + "is-generator": "^1.0.3", + "is-promise": "^4.0.0", + "lodash.isplainobject": ">=0.8.0", + "mongodb": ">=2", + "mongodb-uri": "^0.9.7", + "pump": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "multer": ">=1 <2" + } + }, "node_modules/multiparty": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", @@ -3590,6 +4011,22 @@ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-forge": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/node-gyp": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", @@ -4400,7 +4837,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -5090,6 +5526,14 @@ "node": ">=0.10.0" } }, + "node_modules/streamsearch": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", + "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -5350,6 +5794,11 @@ "node": ">= 0.6" } }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -6309,6 +6758,14 @@ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -6318,6 +6775,29 @@ "negotiator": "0.6.2" } }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -6380,6 +6860,11 @@ "picomatch": "^2.0.4" } }, + "append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=" + }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -6404,6 +6889,11 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" + }, "asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", @@ -6498,6 +6988,11 @@ "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" }, + "bignumber.js": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" + }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -6628,6 +7123,11 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, "bunyan": { "version": "1.8.15", "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", @@ -6639,6 +7139,38 @@ "safe-json-stringify": "~1" } }, + "busboy": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", + "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", + "requires": { + "dicer": "0.2.5", + "readable-stream": "1.1.x" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -6897,6 +7429,17 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, "configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", @@ -7110,6 +7653,38 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "dicer": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", + "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=", + "requires": { + "readable-stream": "1.1.x", + "streamsearch": "0.1.2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "dom-serializer": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.1.tgz", @@ -7218,7 +7793,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "requires": { "once": "^1.4.0" } @@ -7262,6 +7836,11 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, "events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", @@ -7324,6 +7903,11 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, + "fast-text-encoding": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", + "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -7366,6 +7950,11 @@ "path-exists": "^4.0.0" } }, + "flushwritable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flushwritable/-/flushwritable-1.0.0.tgz", + "integrity": "sha1-PjKNj95BKtR+c44751C00pAENJg=" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -7477,6 +8066,18 @@ } } }, + "gaxios": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.2.1.tgz", + "integrity": "sha512-s+rTywpw6CmfB8r9TXYkpix7YFeuRjnR/AqhaJrQqsNhsAqej+IAiCc3hadzQH3gHyWth30tvYjxH8EVjQt/8Q==", + "requires": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^5.0.0", + "is-stream": "^2.0.0", + "node-fetch": "^2.3.0" + } + }, "gaze": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", @@ -7485,6 +8086,15 @@ "globule": "^1.0.0" } }, + "gcp-metadata": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.1.tgz", + "integrity": "sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==", + "requires": { + "gaxios": "^4.0.0", + "json-bigint": "^1.0.0" + } + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -7581,6 +8191,64 @@ "minimist": "^1.2.5" } }, + "google-auth-library": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.0.4.tgz", + "integrity": "sha512-o8irYyeijEiecTXeoEe8UKNEzV1X+uhR4b2oNdapDMZixypp0J+eHimGOyx5Joa3UAeokGngdtDLXtq9vDqG2Q==", + "requires": { + "arrify": "^2.0.0", + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "fast-text-encoding": "^1.0.0", + "gaxios": "^4.0.0", + "gcp-metadata": "^4.2.0", + "gtoken": "^5.0.4", + "jws": "^4.0.0", + "lru-cache": "^6.0.0" + }, + "dependencies": { + "jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "requires": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "google-p12-pem": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.3.tgz", + "integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", + "requires": { + "node-forge": "^0.10.0" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -7642,6 +8310,45 @@ } } }, + "gridfs-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/gridfs-stream/-/gridfs-stream-1.1.1.tgz", + "integrity": "sha1-PdOhAOwgIaGBKC9utGcJY2B034k=", + "requires": { + "flushwritable": "^1.0.0" + } + }, + "gtoken": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.2.1.tgz", + "integrity": "sha512-OY0BfPKe3QnMsY9MzTHTSKn+Vl2l1CcLe6BwDEQj00mbbkl5nyQ/7EUREstg4fQNZ8iYE7br4JJ7TdKeDOPWmw==", + "requires": { + "gaxios": "^4.0.0", + "google-p12-pem": "^3.0.3", + "jws": "^4.0.0" + }, + "dependencies": { + "jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "requires": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + } + } + }, "handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -7703,6 +8410,11 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "has-own-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz", + "integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==" + }, "has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", @@ -7777,6 +8489,30 @@ "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz", "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8=" }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -7929,6 +8665,11 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, + "is-generator": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz", + "integrity": "sha1-wUwhBX7TbjKNuANHlmxpP4hjifM=" + }, "is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", @@ -7972,6 +8713,16 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, + "is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -8028,6 +8779,14 @@ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, + "json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "requires": { + "bignumber.js": "^9.0.0" + } + }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -8569,6 +9328,11 @@ "saslprep": "^1.0.0" } }, + "mongodb-uri": { + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/mongodb-uri/-/mongodb-uri-0.9.7.tgz", + "integrity": "sha1-D3ca0W9IOuZfQoeWlCjp+8SqYYE=" + }, "mongoose": { "version": "5.12.2", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.2.tgz", @@ -8637,6 +9401,35 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "multer": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.2.tgz", + "integrity": "sha512-xY8pX7V+ybyUpbYMxtjM9KAiD9ixtg5/JkeKUTD6xilfDv0vzzOFcCp4Ljb1UU3tSOM3VTZtKo63OmzOrGi3Cg==", + "requires": { + "append-field": "^1.0.0", + "busboy": "^0.2.11", + "concat-stream": "^1.5.2", + "mkdirp": "^0.5.1", + "object-assign": "^4.1.1", + "on-finished": "^2.3.0", + "type-is": "^1.6.4", + "xtend": "^4.0.0" + } + }, + "multer-gridfs-storage": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/multer-gridfs-storage/-/multer-gridfs-storage-4.2.0.tgz", + "integrity": "sha512-N2/QlZVsHUGSNmHx367+j2u8MpuZHxb0AEu9wsqNH0ROusSlcl7ERBt6en+IuHv4kAnrLNE4CTNo1yYHoUb7YA==", + "requires": { + "has-own-prop": "^2.0.0", + "is-generator": "^1.0.3", + "is-promise": "^4.0.0", + "lodash.isplainobject": ">=0.8.0", + "mongodb": ">=2", + "mongodb-uri": "^0.9.7", + "pump": "^3.0.0" + } + }, "multiparty": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", @@ -8742,6 +9535,16 @@ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "node-forge": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" + }, "node-gyp": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", @@ -9383,7 +10186,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -9951,6 +10753,11 @@ "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, + "streamsearch": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", + "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -10147,6 +10954,11 @@ "mime-types": "~2.1.24" } }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", diff --git a/package.json b/package.json index 5c95a72..de4b8d4 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,15 @@ "crypto": "^1.0.1", "dotenv": "^9.0.1", "express": "^4.17.1", + "google-auth-library": "^7.0.4", "grandjs": "^2.2.30", + "gridfs-stream": "^1.1.1", "handlebars": "^4.7.7", "jsonwebtoken": "^8.5.1", "messagebird": "^3.6.1", "mongoose": "^5.12.2", + "multer": "^1.4.2", + "multer-gridfs-storage": "^4.2.0", "nodemailer": "^6.6.0", "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", diff --git a/readme.md b/readme.md index f4e21bf..961293d 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,311 @@ -Cantileverlabs Nodejs Backend API Documentation. +# Cantileverlabs Nodejs Backend API Documentation. + +## Project Structure : + +``` +/root + |- controllers + | |-- admin.js + | |-- auth.js + | |-- blog.js + | |-- coupon.js + | |-- course.js + | |-- payment.js + | |-- profile.js + | |-- query.js + | + |- middlewares + | |-- isAdmin.js + | |-- requireLogin.js + | + |- models + | |-- Blog.js + | |-- Coupon.js + | |-- Course.js + | |-- CourseType.js + | |-- Order.js + | |-- query.js + | |-- Student.js + | |-- User.js + | + |- routes + | |-- admin.js + | |-- auth.js + | |-- blog.js + | |-- Coupon.js + | |-- course.js + | |-- payment.js + | |-- profile.js + | |-- query.js + | + |- app.js +``` + +### App will listen on the port `http://localhost:5000` + +# Routes Functions and Body Parameters. + +## File :- Admin.js + +``` + Route : /addSchedule + Method: POST + Requirements : |-- isAuth + |-- isAdmin + + Route : /editSchedule + Method: POST + Requirements : |-- isAuth + |-- isAdmin + + Route : /deleteSchedule + Method: POST + Requirements : |-- isAuth + |-- isAdmin + +``` + +## File :- Auth.js + +### Note: `All the Body Params are as it is` + +``` + Route : /protected + Method: GET + Requirements : |-- isAuth + + + Route : /signup + Method: POST + Body Params :- firstName + - lastName + - email *must* + - password *must* + ---------- for sending the Verification Emial to user. + - sending_company_email + - subject + Response : { + message:"You are Registered, Please Login" + } + Response if email verification: { + message:"Email sent with 6 Digit OTP , Check your Email" + } + + Route : /verifyemail + Method: POST + Body Params: - otp + + Route : /signin + Method: POST + Body Params : - email + - password + + Route : /sendotp + Method: POST + Body Params : phoneNumber + Respone : {id:id} id of the transaction. + + Route : /getotp + Method: POST + Body Params : id , otp + Response : {message:"Code Verified"} + + Route : /forgotpassword + Method: POST + Body Params : email,link,sending_company_email,subject. + + { - email of the user. } + { - link is where to send the user for resetting a password. } + { - sending_company_email is email address of the comapny to send the email to the user. } + { - subject is email subject } + + Route : /resetpassword/:_id/:token + Method: POST + Headers Params : _id, token + Body Params : password + Response : {message:"Password Updated!"} + +``` + +## File :- BLog.js + +``` + Route : /addBlog + Method: POST + Body Params : _id , title , body , author , image + + String : { _id : Database _id of a person who is adding up a blog} + String : { title : title of the blog} + String: { body : body of the blog} + String: image of the blog to be added} + String : Author of the blog} + + + Route : /getAllBlogs + Method: GET + Body Params : none + + Route : /deleteBlog + Method: POST + Body Params : _id * must * + + { _id : _id is a id of the blog to delete.} + + Route : /editBlog + Method: POST + Body Params : _id * must * , body , title , image. + + String : { _id : Database _id of a person who is adding up a blog} + String : { title : title of the blog} + String: { body : body of the blog} + String: image of the blog to be added} + +``` + +## File :- Coupon.js + +``` + Route : /set-coupon + Method: POST + Body Params : percentage , coupon_code , remainingTimes + + String : { couponCode : Coupon code of the coupon} + String: { percentage: Discount percentage of the coupon} + String: { numAllowed : No of times the coupon is allwoed} + + Route : /getAllCoupons + Method: GET + Body Params : none + + Route : /deleteCoupon + Method: POST + Requirements : isAdmin, isAuth + Body Params : couponCode * must * + + { couponCode : coupon code of the coupon } + + Route : /addCoupon + Method: POST + Requirements : isAdmin, isAuth + Body Params : couponCode * must * , percentage , numAllowed + + String : { couponCode : Coupon code of the coupon} + String: { percentage: Discount percentage of the coupon} + String: { numAllowed : No of times the coupon is allwoed} + +``` + +## File Course.js + +``` + Route : /addCourse + Method : POST + Requirements : isAdmin , isAuth + Body Params : name , mentor , totalLectures , route + + Route : /getAllCourse + Method : GET + Requirements : None + Body Params : None + + + Route : /getSingleParCourse + Method : POST + Body Params : parCourseId + + + Route : /getMeetSchedule + Method : POST + Requiremnents : isAuth + Body Params : courseId + + + Route : /getFromRoute + Method : GET + Requirements : None + Query Params : route + + + Route : /addClick + Method : POST + Requiremnts : isAuth + Body Params : route , userId + +``` + +## File Payments.js + +``` + + Route : /verification + Method : POST + Requirements : None + Body Params : + + + Route : /razorpay + Method : POST + Requirements : requireLogin + Body Params : courseId , couponCode + +``` + +## File Profle.js + +``` + Route : getProfile + Method : GET + Requirements : requireLogin + Body Params : _id of the User. + + + Route : postProfile + Method : POST + Requirements : requireLogin + Body Params : _id , interests , projects , yearofgrad , phoneNumber , institute , skills + + Route : deleteUser + Method : POST + Requirements : requireLogin + Body Params : _id + {_id : _id of the User to delete the Profile} + + + Route : editUser + Method : POST + Requirements : requireLogin + Body Params : _id , newFirstName , newLastName ,email + + {_id : _id of the user to edit the profile} + {newFirstName : New Name } + {newLastName : New last name} + {email : if email has to be changed} + +``` + +## File Query.js + +``` + Route : addQuery + Method : POST + Requirements : None + Body Params : fullName , phoneNumber , email , query , other , graduationYear + + + Route : getAllQueries + Method : GET + Requirements : None + Body Params : None + + + Route : getOtherQueries + Method : GET + Requirements : None + Body Params : None + + + Route : getTypeQueries + Method : POST + Requirements : None + Body Params : type +``` diff --git a/routes/auth.js b/routes/auth.js index 7141665..ecaaff0 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -17,6 +17,8 @@ router.post("/forgotpassword", authController.forgotpassword); router.post("/resetpassword/:_id/:token", authController.resetpassword); +// router.post("/googleSignIn/:tokenId", authController.googleSignIn); + // router.post("/verifyemail", authController.verfiyemail); module.exports = router; diff --git a/routes/blog.js b/routes/blog.js index 03e0a99..8359479 100644 --- a/routes/blog.js +++ b/routes/blog.js @@ -2,11 +2,31 @@ const express = require("express"); const router = express.Router(); const BlogController = require("../controllers/blog"); const isAuth = require("../middleware/requirelogin"); +const GridFsStorage = require("multer-gridfs-storage"); +const Grid = require("gridfs-stream"); +const multer = require("multer"); +const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; -router.post("/addBlog", BlogController.addBlog); +let storage = new GridFsStorage({ + url: MONGO_URI, + file: (req, file) => { + return new Promise((resolve, reject) => { + const fileInfo = { + filename: file.originalname, + bucketName: "blogImages", + }; + resolve(fileInfo); + }); + }, +}); + +const upload = multer({ storage }); +router.post("/addBlog", upload.single("file"), BlogController.addBlog); router.get("/getAllBlogs", BlogController.getAllBlogs); +router.get("/blog/:id", BlogController.getSingleBlog); + router.post("/deleteBlog/", BlogController.deleteBlog); router.post("/editBlog/", BlogController.editBlog); From f8335cbfe9fb57e774c762a1c145f892d96187d8 Mon Sep 17 00:00:00 2001 From: yashrajverma Date: Thu, 27 May 2021 20:16:20 +0530 Subject: [PATCH 39/39] BlogImage --- controllers/blog.js | 29 +- package-lock.json | 6415 +------------------------------------------ package.json | 1 + routes/blog.js | 40 +- 4 files changed, 86 insertions(+), 6399 deletions(-) diff --git a/controllers/blog.js b/controllers/blog.js index ad4398a..f731fde 100644 --- a/controllers/blog.js +++ b/controllers/blog.js @@ -1,37 +1,12 @@ const { log } = require("handlebars"); const Blog = require("../models/Blog"); const User = require("../models/User"); -const mongoose = require("mongoose"); -const GridFsStorage = require("multer-gridfs-storage"); -const Grid = require("gridfs-stream"); -const multer = require("multer"); -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; - -const connect = mongoose.createConnection(MONGO_URI, { - useNewUrlParser: true, - useUnifiedTopology: true, -}); -let gfs; -connect.once("open", () => { - // initialize stream - gfs = Grid(connect.db, mongoose.mongo); - gfs.collection("blogImages"); -}); module.exports.getAllBlogs = async (req, res, next) => { try { let blog = await Blog.find(); if (blog) { - gfs.files.find().toArray((err, files) => { - //check if files exist - if (!files || files.length == 0) { - return res.status(404).json({ - err: "No files exist", - }); - } - // files exist - res.json({ files, blogs: blog }); - }); + res.json({ blogs: blog }); } else { console.log("Error in Blog", blog); return; @@ -76,7 +51,7 @@ module.exports.addBlog = async (req, res, next) => { let blog = new Blog({ title, body, - image: req.file, + image: req.file.location, date: new Date().toISOString(), author, }); diff --git a/package-lock.json b/package-lock.json index 112e364..91418b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6346 +1,8 @@ { "name": "cantilever-labs", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "cantilever-labs", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "aws-sdk": "^2.907.0", - "bcryptjs": "^2.4.3", - "body-parser": "^1.19.0", - "bootstrap-email": "^1.1.1", - "cookie-session": "^1.4.0", - "cors": "^2.8.5", - "crypto": "^1.0.1", - "dotenv": "^9.0.1", - "express": "^4.17.1", - "google-auth-library": "^7.0.4", - "grandjs": "^2.2.30", - "gridfs-stream": "^1.1.1", - "handlebars": "^4.7.7", - "jsonwebtoken": "^8.5.1", - "messagebird": "^3.6.1", - "mongoose": "^5.12.2", - "multer": "^1.4.2", - "multer-gridfs-storage": "^4.2.0", - "nodemailer": "^6.6.0", - "nodemailer-smtp-transport": "^2.7.4", - "passport": "^0.4.1", - "passport-google-oauth": "^2.0.0", - "razorpay": "^2.0.6", - "shortid": "^2.2.16" - }, - "devDependencies": { - "nodemon": "^2.0.7" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", - "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", - "dependencies": { - "@babel/highlight": "^7.12.13" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.14.0.tgz", - "integrity": "sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q==" - }, - "node_modules/@babel/core": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.14.2.tgz", - "integrity": "sha512-OgC1mON+l4U4B4wiohJlQNUU3H73mpTyYY3j/c8U9dr9UagGGSm+WFpzjy/YLdoyjiG++c1kIDgxCo/mLwQJeQ==", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.14.2", - "@babel/helper-compilation-targets": "^7.13.16", - "@babel/helper-module-transforms": "^7.14.2", - "@babel/helpers": "^7.14.0", - "@babel/parser": "^7.14.2", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.14.2", - "@babel/types": "^7.14.2", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/core/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/generator": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.2.tgz", - "integrity": "sha512-OnADYbKrffDVai5qcpkMxQ7caomHOoEwjkouqnN2QhydAjowFAZcsdecFIRUBdb+ZcruwYE4ythYmF1UBZU5xQ==", - "dependencies": { - "@babel/types": "^7.14.2", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz", - "integrity": "sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.13.16", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.16.tgz", - "integrity": "sha512-3gmkYIrpqsLlieFwjkGgLaSHmhnvlAYzZLlYVjlW+QwI+1zE17kGxuJGmIqDQdYp56XdmGeD+Bswx0UTyG18xA==", - "dependencies": { - "@babel/compat-data": "^7.13.15", - "@babel/helper-validator-option": "^7.12.17", - "browserslist": "^4.14.5", - "semver": "^6.3.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz", - "integrity": "sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==", - "dependencies": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.14.2" - } - }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", - "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz", - "integrity": "sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==", - "dependencies": { - "@babel/types": "^7.13.12" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz", - "integrity": "sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==", - "dependencies": { - "@babel/types": "^7.13.12" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.14.2.tgz", - "integrity": "sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA==", - "dependencies": { - "@babel/helper-module-imports": "^7.13.12", - "@babel/helper-replace-supers": "^7.13.12", - "@babel/helper-simple-access": "^7.13.12", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/helper-validator-identifier": "^7.14.0", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.14.2", - "@babel/types": "^7.14.2" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz", - "integrity": "sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz", - "integrity": "sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==" - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.13.12.tgz", - "integrity": "sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw==", - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.13.12", - "@babel/helper-optimise-call-expression": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.12" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz", - "integrity": "sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==", - "dependencies": { - "@babel/types": "^7.13.12" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", - "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", - "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==" - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz", - "integrity": "sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==" - }, - "node_modules/@babel/helpers": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.14.0.tgz", - "integrity": "sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg==", - "dependencies": { - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.14.0", - "@babel/types": "^7.14.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", - "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.0", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "node_modules/@babel/parser": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.2.tgz", - "integrity": "sha512-IoVDIHpsgE/fu7eXBeRWt8zLbDrSvD7H1gpomOkPpBoEN8KCruCqSDdqo8dddwQQrui30KSvQBaMUOJiuFu6QQ==", - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.14.2.tgz", - "integrity": "sha512-hBIQFxwZi8GIp934+nj5uV31mqclC1aYDhctDu5khTi9PCCUOczyy0b34W0oE9U/eJXiqQaKyVsmjeagOaSlbw==", - "dependencies": { - "@babel/compat-data": "^7.14.0", - "@babel/helper-compilation-targets": "^7.13.16", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.13.tgz", - "integrity": "sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.13.17", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.13.17.tgz", - "integrity": "sha512-UAUqiLv+uRLO+xuBKKMEpC+t7YRNVRqBsWWq1yKXbBZBje/t3IXCiSinZhjn/DC3qzBfICeYd2EFGEbHsh5RLA==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.13.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.14.2.tgz", - "integrity": "sha512-NxoVmA3APNCC1JdMXkdYXuQS+EMdqy0vIwyDHeKHiJKRxmp1qGSdb0JLEIoPRhkx6H/8Qi3RJ3uqOCYw8giy9A==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.13.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.13.12.tgz", - "integrity": "sha512-jcEI2UqIcpCqB5U5DRxIl0tQEProI2gcu+g8VTIqxLO5Iidojb4d77q+fwGseCvd8af/lJ9masp4QWzBXFE2xA==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.12.13", - "@babel/helper-module-imports": "^7.13.12", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/plugin-syntax-jsx": "^7.12.13", - "@babel/types": "^7.13.12" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", - "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/traverse": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.2.tgz", - "integrity": "sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.14.2", - "@babel/helper-function-name": "^7.14.2", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.14.2", - "@babel/types": "^7.14.2", - "debug": "^4.1.0", - "globals": "^11.1.0" - } - }, - "node_modules/@babel/traverse/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/traverse/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/@babel/types": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.2.tgz", - "integrity": "sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.0", - "to-fast-properties": "^2.0.0" - } - }, - "node_modules/@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "dependencies": { - "defer-to-connect": "^1.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/bson": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.3.tgz", - "integrity": "sha512-mVRvYnTOZJz3ccpxhr3wgxVmSeiYinW+zlzQz3SXWaJmD1DuL05Jeq7nKw3SnbKmbleW5qrLG5vdyWe/A9sXhw==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/cors": { - "version": "2.8.10", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", - "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" - }, - "node_modules/@types/mongodb": { - "version": "3.6.10", - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.10.tgz", - "integrity": "sha512-BkwAHFiZSSWdTIqbUVGmgvIsiXXjqAketeK7Izy7oSs6G3N8Bn993tK9eq6QEovQDx6OQ2FGP2KWDDxBzdlJ6Q==", - "dependencies": { - "@types/bson": "*", - "@types/node": "*" - } - }, - "node_modules/@types/multiparty": { - "version": "0.0.32", - "resolved": "https://registry.npmjs.org/@types/multiparty/-/multiparty-0.0.32.tgz", - "integrity": "sha512-zuQEcL9pHiW3u1fgkOWE6T/RwskrFZ3W63aKQPDs7EokIjtbsGL7aVlI4tI86qjL4B3hcFxDRtIGxwRwMTS2Dw==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/node": { - "version": "14.14.35", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.35.tgz", - "integrity": "sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==" - }, - "node_modules/@types/type-is": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@types/type-is/-/type-is-1.6.3.tgz", - "integrity": "sha512-PNs5wHaNcBgCQG5nAeeZ7OvosrEsI9O4W2jAOO9BCCg4ux9ZZvH2+0iSCOIDBiKuQsiNS8CBlmfX9f5YBQ22cA==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", - "dependencies": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/agent-base/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/agent-base/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "node_modules/amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "engines": { - "node": ">=0.4.2" - } - }, - "node_modules/ansi-align": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", - "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", - "dev": true, - "dependencies": { - "string-width": "^3.0.0" - } - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/append-field": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", - "integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=" - }, - "node_modules/aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, - "node_modules/are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "node_modules/array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "node_modules/arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "engines": { - "node": ">=8" - } - }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" - }, - "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" - }, - "node_modules/async-foreach": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", - "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", - "engines": { - "node": "*" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "node_modules/aws-sdk": { - "version": "2.907.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.907.0.tgz", - "integrity": "sha512-P1gth8sVqXCIjKN78kyD3OosEzqUSYxDG04Cpp2wVGx/djsd5OSv4NkayOhKZ5OMXwk6IdA82oXV/HQR8EjbwQ==", - "hasInstallScript": true, - "dependencies": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.15.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "uuid": "3.3.2", - "xml2js": "0.4.19" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/aws-sdk/node_modules/uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/bcryptjs": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", - "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" - }, - "node_modules/bignumber.js": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", - "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", - "engines": { - "node": "*" - } - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/bl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "dependencies": { - "inherits": "~2.0.0" - }, - "engines": { - "node": "0.4 || >=0.5.8" - } - }, - "node_modules/bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" - }, - "node_modules/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "dependencies": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" - }, - "node_modules/bootstrap-email": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/bootstrap-email/-/bootstrap-email-1.1.1.tgz", - "integrity": "sha512-8O2OMPKR6nz0m1q3P7XXgMuKb6IMfi6RBmWWa9zG7T+e8h9+hMP22WLmqApmwusNkakRVov/cvBFXUmrLe5WHg==", - "dependencies": { - "bunyan": "^1.8.12", - "cheerio": "^1.0.0-rc.3", - "ejs": "^2.6.1", - "juice": "^5.2.0", - "node-sass": "^4.14.1", - "postcss": "^7.0.25", - "sass-extract": "^2.1.0" - } - }, - "node_modules/boxen": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", - "integrity": "sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==", - "dev": true, - "dependencies": { - "ansi-align": "^3.0.0", - "camelcase": "^5.3.1", - "chalk": "^3.0.0", - "cli-boxes": "^2.2.0", - "string-width": "^4.1.0", - "term-size": "^2.1.0", - "type-fest": "^0.8.1", - "widest-line": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.16.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", - "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", - "dependencies": { - "caniuse-lite": "^1.0.30001219", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.723", - "escalade": "^3.1.1", - "node-releases": "^1.1.71" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/bson": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz", - "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==", - "engines": { - "node": ">=0.6.19" - } - }, - "node_modules/buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" - }, - "node_modules/buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "node_modules/bunyan": { - "version": "1.8.15", - "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.15.tgz", - "integrity": "sha512-0tECWShh6wUysgucJcBAoYegf3JJoZWibxdqhTm7OHPeT42qdjkZ29QCMcKwbgU1kiH+auSIasNRXMLWXafXig==", - "engines": [ - "node >=0.10.0" - ], - "bin": { - "bunyan": "bin/bunyan" - }, - "optionalDependencies": { - "dtrace-provider": "~0.8", - "moment": "^2.19.3", - "mv": "~2", - "safe-json-stringify": "~1" - } - }, - "node_modules/busboy": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", - "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", - "dependencies": { - "dicer": "0.2.5", - "readable-stream": "1.1.x" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/busboy/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "node_modules/busboy/node_modules/readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/busboy/node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "node_modules/bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-request/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-request/node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/caller-callsite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", - "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", - "dependencies": { - "callsites": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/caller-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", - "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", - "dependencies": { - "caller-callsite": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "engines": { - "node": ">=4" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dependencies": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/camelcase-keys/node_modules/camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001228", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz", - "integrity": "sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cheerio": { - "version": "1.0.0-rc.9", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.9.tgz", - "integrity": "sha512-QF6XVdrLONO6DXRF5iaolY+odmhj2CLj+xzNod7INPWMi/x9X4SOylH0S/vaPpX+AUU6t04s34SQNh7DbkuCng==", - "dependencies": { - "cheerio-select": "^1.4.0", - "dom-serializer": "^1.3.1", - "domhandler": "^4.2.0", - "htmlparser2": "^6.1.0", - "parse5": "^6.0.1", - "parse5-htmlparser2-tree-adapter": "^6.0.1", - "tslib": "^2.2.0" - }, - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/cheeriojs/cheerio?sponsor=1" - } - }, - "node_modules/cheerio-select": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.4.0.tgz", - "integrity": "sha512-sobR3Yqz27L553Qa7cK6rtJlMDbiKPdNywtR95Sj/YgfpLfy0u6CGJuaBKe5YE/vTc23SCRKxWSdlon/w6I/Ew==", - "dependencies": { - "css-select": "^4.1.2", - "css-what": "^5.0.0", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0", - "domutils": "^2.6.0" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.1" - } - }, - "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "node_modules/cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - } - }, - "node_modules/code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "node_modules/concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "engines": [ - "node >= 0.8" - ], - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "dependencies": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, - "node_modules/content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "dependencies": { - "safe-buffer": "5.1.2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-session": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/cookie-session/-/cookie-session-1.4.0.tgz", - "integrity": "sha512-0hhwD+BUIwMXQraiZP/J7VP2YFzqo6g4WqZlWHtEHQ22t0MeZZrNBSCxC1zcaLAs8ApT3BzAKizx9gW/AP9vNA==", - "dependencies": { - "cookies": "0.8.0", - "debug": "2.6.9", - "on-headers": "~1.0.2" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "node_modules/cookies": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", - "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", - "dependencies": { - "depd": "~2.0.0", - "keygrip": "~1.1.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/cookies/node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/crypto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", - "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" - }, - "node_modules/crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/css-select": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.2.tgz", - "integrity": "sha512-nu5ye2Hg/4ISq4XqdLY2bEatAcLIdt3OYGFc9Tm9n7VSlFBcfRv0gBNksHRgSdUDQGtN3XrZ94ztW+NfzkFSUw==", - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^5.0.0", - "domhandler": "^4.2.0", - "domutils": "^2.6.0", - "nth-check": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-what": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.0.tgz", - "integrity": "sha512-qxyKHQvgKwzwDWC/rGbT821eJalfupxYW2qbSJSAtdSTimsr/MlaGONoNLllaUPZWf8QnbcKM/kPVYUQuEKAFA==", - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dependencies": { - "array-find-index": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/datauri": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/datauri/-/datauri-2.0.0.tgz", - "integrity": "sha512-zS2HSf9pI5XPlNZgIqJg/wCJpecgU/HA6E/uv2EfaWnW1EiTGLfy/EexTIsC9c99yoCOTXlqeeWk4FkCSuO3/g==", - "dependencies": { - "image-size": "^0.7.3", - "mimer": "^1.0.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, - "node_modules/denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "node_modules/dicer": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", - "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=", - "dependencies": { - "readable-stream": "1.1.x", - "streamsearch": "0.1.2" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/dicer/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "node_modules/dicer/node_modules/readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/dicer/node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "node_modules/dom-serializer": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.1.tgz", - "integrity": "sha512-Pv2ZluG5ife96udGgEDovOOOA5UELkltfJpnIExPrAk1LTvecolUGn6lIaoLh86d83GiB86CjzciMd9BuRB71Q==", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "entities": "^2.0.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/domelementtype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ] - }, - "node_modules/domhandler": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", - "integrity": "sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA==", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/domutils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.6.0.tgz", - "integrity": "sha512-y0BezHuy4MDYxh6OvolXYsH+1EMGmFbwv5FKW7ovwMG6zTPWqNPq3WF9ayZssFq+UlKdffGLbOEaghNdaOm1WA==", - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/dotenv": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-9.0.1.tgz", - "integrity": "sha512-W8FNeNnnvJoYfgkFRKzp8kTgz0T2YY4TJ9xy1Ma0hSebPTK8iquRtpG12TUrSTX5zIN9D/wSLEEuI+Ad35tlyw==", - "engines": { - "node": ">=10" - } - }, - "node_modules/dtrace-provider": { - "version": "0.8.8", - "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz", - "integrity": "sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "nan": "^2.14.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "node_modules/ejs": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", - "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==", - "hasInstallScript": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.3.727", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.727.tgz", - "integrity": "sha512-Mfz4FIB4FSvEwBpDfdipRIrwd6uo8gUDoRDF4QEYb4h4tSuI3ov594OrjU6on042UlFHouIJpClDODGkPcBSbg==" - }, - "node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "dependencies": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "node_modules/fast-text-encoding": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", - "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/flushwritable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/flushwritable/-/flushwritable-1.0.0.tgz", - "integrity": "sha1-PjKNj95BKtR+c44751C00pAENJg=" - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dependencies": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/gauge/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gaxios": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.2.1.tgz", - "integrity": "sha512-s+rTywpw6CmfB8r9TXYkpix7YFeuRjnR/AqhaJrQqsNhsAqej+IAiCc3hadzQH3gHyWth30tvYjxH8EVjQt/8Q==", - "dependencies": { - "abort-controller": "^3.0.0", - "extend": "^3.0.2", - "https-proxy-agent": "^5.0.0", - "is-stream": "^2.0.0", - "node-fetch": "^2.3.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/gaze": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", - "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", - "dependencies": { - "globule": "^1.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/gcp-metadata": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.1.tgz", - "integrity": "sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==", - "dependencies": { - "gaxios": "^4.0.0", - "json-bigint": "^1.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/global-dirs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.1.0.tgz", - "integrity": "sha512-MG6kdOUh/xBnyo9cJFeIKkLEc1AyFq42QTU4XiX51i2NEdxLxLWXIjEjmqKeSuKR7pAZjTqUVoT2b2huxVLgYQ==", - "dev": true, - "dependencies": { - "ini": "1.3.7" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/globule": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz", - "integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==", - "dependencies": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/gonzales-pe": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-4.3.0.tgz", - "integrity": "sha512-otgSPpUmdWJ43VXyiNgEYE4luzHCL2pz4wQ0OnDluC6Eg4Ko3Vexy/SrSynglw/eR+OhkzmqFCZa/OFa/RgAOQ==", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "gonzales": "bin/gonzales.js" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/google-auth-library": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.0.4.tgz", - "integrity": "sha512-o8irYyeijEiecTXeoEe8UKNEzV1X+uhR4b2oNdapDMZixypp0J+eHimGOyx5Joa3UAeokGngdtDLXtq9vDqG2Q==", - "dependencies": { - "arrify": "^2.0.0", - "base64-js": "^1.3.0", - "ecdsa-sig-formatter": "^1.0.11", - "fast-text-encoding": "^1.0.0", - "gaxios": "^4.0.0", - "gcp-metadata": "^4.2.0", - "gtoken": "^5.0.4", - "jws": "^4.0.0", - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/google-auth-library/node_modules/jwa": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", - "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/google-auth-library/node_modules/jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/google-auth-library/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/google-auth-library/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/google-p12-pem": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.3.tgz", - "integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", - "dependencies": { - "node-forge": "^0.10.0" - }, - "bin": { - "gp12-pem": "build/src/bin/gp12-pem.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" - }, - "node_modules/grandjs": { - "version": "2.2.30", - "resolved": "https://registry.npmjs.org/grandjs/-/grandjs-2.2.30.tgz", - "integrity": "sha512-exiKrEI/67XiYn1hsp5DquCpy0KabnbLjTXUWxO1yHimmW0KgMlPrDN4cenLCPOEMs800jjnhvQK+TuLw7nb2A==", - "dependencies": { - "@types/cors": "*", - "@types/multiparty": "*", - "@types/type-is": "^1.6.3", - "accepts": "^1.3.7", - "content-type": "^1.0.4", - "cors": "^2.8.5", - "import-jsx": "^4.0.0", - "multiparty": "^4.2.1", - "proxy-addr": "^2.0.6", - "qs": "^6.9.3", - "range-parser": "^1.2.1", - "send": "^0.17.1", - "setprototypeof": "^1.2.0", - "type-is": "^1.6.18", - "url-pattern": "^1.0.3" - } - }, - "node_modules/grandjs/node_modules/qs": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", - "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/grandjs/node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/gridfs-stream": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/gridfs-stream/-/gridfs-stream-1.1.1.tgz", - "integrity": "sha1-PdOhAOwgIaGBKC9utGcJY2B034k=", - "dependencies": { - "flushwritable": "^1.0.0" - }, - "engines": { - "node": ">= 0.4.2" - } - }, - "node_modules/gtoken": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.2.1.tgz", - "integrity": "sha512-OY0BfPKe3QnMsY9MzTHTSKn+Vl2l1CcLe6BwDEQj00mbbkl5nyQ/7EUREstg4fQNZ8iYE7br4JJ7TdKeDOPWmw==", - "dependencies": { - "gaxios": "^4.0.0", - "google-p12-pem": "^3.0.3", - "jws": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/gtoken/node_modules/jwa": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", - "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/gtoken/node_modules/jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/handlebars/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-ansi/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-own-prop": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz", - "integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, - "node_modules/has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" - }, - "node_modules/htmlparser2": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", - "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "domutils": "^2.5.2", - "entities": "^2.0.0" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "node_modules/http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, - "node_modules/httpntlm": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.6.1.tgz", - "integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=", - "dependencies": { - "httpreq": ">=0.4.22", - "underscore": "~1.7.0" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/httpreq": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz", - "integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8=", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/https-proxy-agent/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", - "dev": true - }, - "node_modules/image-size": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", - "integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g==", - "bin": { - "image-size": "bin/image-size.js" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/import-jsx": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-jsx/-/import-jsx-4.0.0.tgz", - "integrity": "sha512-CnjJ2BZFJzbFDmYG5S47xPQjMlSbZLyLJuG4znzL4TdPtJBxHtFP1xVmR+EYX4synFSldiY3B6m00XkPM3zVnA==", - "dependencies": { - "@babel/core": "^7.5.5", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", - "caller-path": "^2.0.0", - "find-cache-dir": "^3.2.0", - "make-dir": "^3.0.2", - "resolve-from": "^3.0.0", - "rimraf": "^3.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/import-jsx/node_modules/resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", - "engines": { - "node": ">=4" - } - }, - "node_modules/import-lazy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", - "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/in-publish": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz", - "integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==", - "bin": { - "in-install": "in-install.js", - "in-publish": "in-publish.js", - "not-in-install": "not-in-install.js", - "not-in-publish": "not-in-publish.js" - } - }, - "node_modules/indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dependencies": { - "repeating": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "node_modules/ini": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", - "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==", - "dev": true - }, - "node_modules/invariant": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", - "dependencies": { - "loose-envify": "^1.0.0" - } - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-finite": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", - "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "engines": { - "node": ">=4" - } - }, - "node_modules/is-generator": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz", - "integrity": "sha1-wUwhBX7TbjKNuANHlmxpP4hjifM=" - }, - "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-installed-globally": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.3.2.tgz", - "integrity": "sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==", - "dev": true, - "dependencies": { - "global-dirs": "^2.0.1", - "is-path-inside": "^3.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-npm": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz", - "integrity": "sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-promise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", - "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" - }, - "node_modules/is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "node_modules/is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" - }, - "node_modules/is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "node_modules/jmespath": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", - "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/js-base64": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", - "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "dependencies": { - "bignumber.js": "^9.0.0" - } - }, - "node_modules/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "node_modules/json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "node_modules/jsonwebtoken/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "node_modules/juice": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/juice/-/juice-5.2.0.tgz", - "integrity": "sha512-0l6GZmT3efexyaaay3SchKT5kG311N59TEFP5lfvEy0nz9SNqjx311plJ3b4jze7arsmDsiHQLh/xnAuk0HFTQ==", - "dependencies": { - "cheerio": "^0.22.0", - "commander": "^2.15.1", - "cross-spawn": "^6.0.5", - "deep-extend": "^0.6.0", - "mensch": "^0.3.3", - "slick": "^1.12.2", - "web-resource-inliner": "^4.3.1" - }, - "bin": { - "juice": "bin/juice" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/juice/node_modules/cheerio": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", - "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", - "dependencies": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash.assignin": "^4.0.9", - "lodash.bind": "^4.1.4", - "lodash.defaults": "^4.0.1", - "lodash.filter": "^4.4.0", - "lodash.flatten": "^4.2.0", - "lodash.foreach": "^4.3.0", - "lodash.map": "^4.4.0", - "lodash.merge": "^4.4.0", - "lodash.pick": "^4.2.1", - "lodash.reduce": "^4.4.0", - "lodash.reject": "^4.4.0", - "lodash.some": "^4.4.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/juice/node_modules/css-select": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", - "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", - "dependencies": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "node_modules/juice/node_modules/css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", - "engines": { - "node": "*" - } - }, - "node_modules/juice/node_modules/dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "dependencies": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "node_modules/juice/node_modules/domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" - }, - "node_modules/juice/node_modules/domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dependencies": { - "domelementtype": "1" - } - }, - "node_modules/juice/node_modules/domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dependencies": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "node_modules/juice/node_modules/entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" - }, - "node_modules/juice/node_modules/htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dependencies": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "node_modules/juice/node_modules/nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "dependencies": { - "boolbase": "~1.0.0" - } - }, - "node_modules/juice/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/kareem": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.2.tgz", - "integrity": "sha512-STHz9P7X2L4Kwn72fA4rGyqyXdmrMSdxqHx9IXon/FXluXieaFA6KJ2upcHAHxQPQ0LeM/OjLrhFxifHewOALQ==" - }, - "node_modules/keygrip": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", - "integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==", - "dependencies": { - "tsscmp": "1.0.6" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.0" - } - }, - "node_modules/latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "dependencies": { - "package-json": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.assignin": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", - "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" - }, - "node_modules/lodash.bind": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", - "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" - }, - "node_modules/lodash.defaults": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" - }, - "node_modules/lodash.filter": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", - "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" - }, - "node_modules/lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" - }, - "node_modules/lodash.foreach": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", - "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" - }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, - "node_modules/lodash.map": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", - "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" - }, - "node_modules/lodash.pick": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", - "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" - }, - "node_modules/lodash.reduce": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", - "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" - }, - "node_modules/lodash.reject": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", - "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" - }, - "node_modules/lodash.some": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", - "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" - }, - "node_modules/lodash.unescape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", - "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dependencies": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", - "optional": true - }, - "node_modules/mensch": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/mensch/-/mensch-0.3.4.tgz", - "integrity": "sha512-IAeFvcOnV9V0Yk+bFhYR07O3yNina9ANIN5MoXBKYJ/RLYPurd2d0yw14MDhpr9/momp0WofT1bPUh3hkzdi/g==" - }, - "node_modules/meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dependencies": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "node_modules/messagebird": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/messagebird/-/messagebird-3.6.1.tgz", - "integrity": "sha512-HcbHxNp53MblcDReOo+sLvlr/aX1pGH/Liyegphpz+CXVKmEl2WUOKyPQCy69pTW8uRM8QlGbmYJP+BzZh/sRQ==", - "dependencies": { - "safe-buffer": "^5.2.1", - "scmp": "^2.1.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/messagebird/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", - "dependencies": { - "mime-db": "1.46.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimer/-/mimer-1.1.0.tgz", - "integrity": "sha512-y9dVfy2uiycQvDNiAYW6zp49ZhFlXDMr5wfdOiMbdzGM/0N5LNR6HTUn3un+WUQcM0koaw8FMTG1bt5EnHJdvQ==", - "bin": { - "mimer": "bin/mimer" - }, - "engines": { - "node": ">= 6.0" - } - }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", - "optional": true, - "engines": { - "node": "*" - } - }, - "node_modules/mongodb": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", - "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", - "dependencies": { - "bl": "^2.2.1", - "bson": "^1.1.4", - "denque": "^1.4.1", - "require_optional": "^1.0.1", - "safe-buffer": "^5.1.2" - }, - "engines": { - "node": ">=4" - }, - "optionalDependencies": { - "saslprep": "^1.0.0" - } - }, - "node_modules/mongodb-uri": { - "version": "0.9.7", - "resolved": "https://registry.npmjs.org/mongodb-uri/-/mongodb-uri-0.9.7.tgz", - "integrity": "sha1-D3ca0W9IOuZfQoeWlCjp+8SqYYE=", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/mongoose": { - "version": "5.12.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.2.tgz", - "integrity": "sha512-kT9t6Nvu9WPsfssn7Gzke446Il8UdMilY7Sa5vALtwoOoNOGtZEVjekZBFwsBFzTWtBA/x5gBmJoYFP+1LeDlg==", - "dependencies": { - "@types/mongodb": "^3.5.27", - "bson": "^1.1.4", - "kareem": "2.3.2", - "mongodb": "3.6.5", - "mongoose-legacy-pluralize": "1.0.2", - "mpath": "0.8.3", - "mquery": "3.2.4", - "ms": "2.1.2", - "regexp-clone": "1.0.0", - "safe-buffer": "5.2.1", - "sift": "7.0.1", - "sliced": "1.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mongoose-legacy-pluralize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", - "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" - }, - "node_modules/mongoose/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/mongoose/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "node_modules/mpath": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz", - "integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.4.tgz", - "integrity": "sha512-uOLpp7iRX0BV1Uu6YpsqJ5b42LwYnmu0WeF/f8qgD/On3g0XDaQM6pfn0m6UxO6SM8DioZ9Bk6xxbWIGHm2zHg==", - "dependencies": { - "bluebird": "3.5.1", - "debug": "3.1.0", - "regexp-clone": "^1.0.0", - "safe-buffer": "5.1.2", - "sliced": "1.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery/node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/multer": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.2.tgz", - "integrity": "sha512-xY8pX7V+ybyUpbYMxtjM9KAiD9ixtg5/JkeKUTD6xilfDv0vzzOFcCp4Ljb1UU3tSOM3VTZtKo63OmzOrGi3Cg==", - "dependencies": { - "append-field": "^1.0.0", - "busboy": "^0.2.11", - "concat-stream": "^1.5.2", - "mkdirp": "^0.5.1", - "object-assign": "^4.1.1", - "on-finished": "^2.3.0", - "type-is": "^1.6.4", - "xtend": "^4.0.0" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/multer-gridfs-storage": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/multer-gridfs-storage/-/multer-gridfs-storage-4.2.0.tgz", - "integrity": "sha512-N2/QlZVsHUGSNmHx367+j2u8MpuZHxb0AEu9wsqNH0ROusSlcl7ERBt6en+IuHv4kAnrLNE4CTNo1yYHoUb7YA==", - "dependencies": { - "has-own-prop": "^2.0.0", - "is-generator": "^1.0.3", - "is-promise": "^4.0.0", - "lodash.isplainobject": ">=0.8.0", - "mongodb": ">=2", - "mongodb-uri": "^0.9.7", - "pump": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "multer": ">=1 <2" - } - }, - "node_modules/multiparty": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", - "integrity": "sha512-NtZLjlvsjcoGrzojtwQwn/Tm90aWJ6XXtPppYF4WmOk/6ncdwMMKggFY2NlRRN9yiCEIVxpOfPWahVEG2HAG8Q==", - "dependencies": { - "http-errors": "~1.8.0", - "safe-buffer": "5.2.1", - "uid-safe": "2.1.5" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/multiparty/node_modules/http-errors": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", - "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/multiparty/node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/multiparty/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/multiparty/node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/mv": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", - "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=", - "optional": true, - "dependencies": { - "mkdirp": "~0.5.1", - "ncp": "~2.0.0", - "rimraf": "~2.4.0" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/mv/node_modules/glob": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", - "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", - "optional": true, - "dependencies": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mv/node_modules/rimraf": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", - "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", - "optional": true, - "dependencies": { - "glob": "^6.0.1" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/nan": { - "version": "2.14.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", - "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" - }, - "node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, - "node_modules/ncp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", - "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", - "optional": true, - "bin": { - "ncp": "bin/ncp" - } - }, - "node_modules/negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" - }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-forge": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/node-gyp": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", - "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", - "dependencies": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/node-gyp/node_modules/nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/node-gyp/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/node-gyp/node_modules/semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/node-releases": { - "version": "1.1.71", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", - "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" - }, - "node_modules/node-sass": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", - "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", - "hasInstallScript": true, - "dependencies": { - "async-foreach": "^0.1.3", - "chalk": "^1.1.1", - "cross-spawn": "^3.0.0", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "in-publish": "^2.0.0", - "lodash": "^4.17.15", - "meow": "^3.7.0", - "mkdirp": "^0.5.1", - "nan": "^2.13.2", - "node-gyp": "^3.8.0", - "npmlog": "^4.0.0", - "request": "^2.88.0", - "sass-graph": "2.2.5", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" - }, - "bin": { - "node-sass": "bin/node-sass" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/cross-spawn": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", - "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", - "dependencies": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, - "node_modules/node-sass/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/nodemailer": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.0.tgz", - "integrity": "sha512-ikSMDU1nZqpo2WUPE0wTTw/NGGImTkwpJKDIFPZT+YvvR9Sj+ze5wzu95JHkBMglQLoG2ITxU21WukCC/XsFkg==", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/nodemailer-fetch": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz", - "integrity": "sha1-ecSQihwPXzdbc/6IjamCj23JY6Q=" - }, - "node_modules/nodemailer-shared": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/nodemailer-shared/-/nodemailer-shared-1.1.0.tgz", - "integrity": "sha1-z1mU4v0mjQD1zw+nZ6CBae2wfsA=", - "dependencies": { - "nodemailer-fetch": "1.6.0" - } - }, - "node_modules/nodemailer-smtp-transport": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-2.7.4.tgz", - "integrity": "sha1-DYmvAZoUSkgP2OzJmZfZ+DjxNoU=", - "dependencies": { - "nodemailer-shared": "1.1.0", - "nodemailer-wellknown": "0.1.10", - "smtp-connection": "2.12.0" - } - }, - "node_modules/nodemailer-wellknown": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/nodemailer-wellknown/-/nodemailer-wellknown-0.1.10.tgz", - "integrity": "sha1-WG24EB2zDLRDjrVGc3pBqtDPE9U=" - }, - "node_modules/nodemon": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", - "integrity": "sha512-XHzK69Awgnec9UzHr1kc8EomQh4sjTQ8oRf8TsGrSmHDx9/UmiGG9E/mM3BuTfNeFwdNBvrqQq/RHL0xIeyFOA==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "chokidar": "^3.2.2", - "debug": "^3.2.6", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.7", - "semver": "^5.7.1", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.3", - "update-notifier": "^4.1.0" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/nodemon/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "node_modules/nth-check": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", - "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", - "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/oauth": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", - "integrity": "sha1-vR/vr2hslrdUda7VGWQS/2DPucE=" - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "engines": { - "node": "*" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", - "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dependencies": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "node_modules/p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "dependencies": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/parse-color": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz", - "integrity": "sha1-e3SLlag/A/FqlPU15S1/PZRlhhk=", - "dependencies": { - "color-convert": "~0.5.0" - } - }, - "node_modules/parse-color/node_modules/color-convert": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", - "integrity": "sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=" - }, - "node_modules/parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dependencies": { - "error-ex": "^1.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse5": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" - }, - "node_modules/parse5-htmlparser2-tree-adapter": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", - "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", - "dependencies": { - "parse5": "^6.0.1" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/passport": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/passport/-/passport-0.4.1.tgz", - "integrity": "sha512-IxXgZZs8d7uFSt3eqNjM9NQ3g3uQCW5avD8mRNoXV99Yig50vjuaez6dQK2qC0kVWPRTujxY0dWgGfT09adjYg==", - "dependencies": { - "passport-strategy": "1.x.x", - "pause": "0.0.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/passport-google-oauth": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/passport-google-oauth/-/passport-google-oauth-2.0.0.tgz", - "integrity": "sha512-JKxZpBx6wBQXX1/a1s7VmdBgwOugohH+IxCy84aPTZNq/iIPX6u7Mqov1zY7MKRz3niFPol0KJz8zPLBoHKtYA==", - "dependencies": { - "passport-google-oauth1": "1.x.x", - "passport-google-oauth20": "2.x.x" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/passport-google-oauth1": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/passport-google-oauth1/-/passport-google-oauth1-1.0.0.tgz", - "integrity": "sha1-r3SoA99R7GRvZqRNgigr5vEI4Mw=", - "dependencies": { - "passport-oauth1": "1.x.x" - } - }, - "node_modules/passport-google-oauth20": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/passport-google-oauth20/-/passport-google-oauth20-2.0.0.tgz", - "integrity": "sha512-KSk6IJ15RoxuGq7D1UKK/8qKhNfzbLeLrG3gkLZ7p4A6DBCcv7xpyQwuXtWdpyR0+E0mwkpjY1VfPOhxQrKzdQ==", - "dependencies": { - "passport-oauth2": "1.x.x" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/passport-oauth1": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/passport-oauth1/-/passport-oauth1-1.1.0.tgz", - "integrity": "sha1-p96YiiEfnPRoc3cTDqdN8ycwyRg=", - "dependencies": { - "oauth": "0.9.x", - "passport-strategy": "1.x.x", - "utils-merge": "1.x.x" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/passport-oauth2": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.5.0.tgz", - "integrity": "sha512-kqBt6vR/5VlCK8iCx1/KpY42kQ+NEHZwsSyt4Y6STiNjU+wWICG1i8ucc1FapXDGO15C5O5VZz7+7vRzrDPXXQ==", - "dependencies": { - "base64url": "3.x.x", - "oauth": "0.9.x", - "passport-strategy": "1.x.x", - "uid2": "0.0.x", - "utils-merge": "1.x.x" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/passport-strategy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", - "integrity": "sha1-tVOaqPwiWj0a0XlHbd8ja0QPUuQ=", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "engines": { - "node": ">=4" - } - }, - "node_modules/path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "node_modules/path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dependencies": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pause": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", - "integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10=" - }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "node_modules/picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "dev": true, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/postcss": { - "version": "7.0.35", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", - "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", - "dependencies": { - "chalk": "^2.4.2", - "source-map": "^0.6.1", - "supports-color": "^6.1.0" - }, - "engines": { - "node": ">=6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - } - }, - "node_modules/postcss/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss/node_modules/chalk/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/postcss/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "node_modules/postcss/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postcss/node_modules/supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "node_modules/promise": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz", - "integrity": "sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==", - "dependencies": { - "asap": "~2.0.6" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", - "dependencies": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, - "node_modules/psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "dependencies": { - "escape-goat": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/query-ast": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/query-ast/-/query-ast-1.0.3.tgz", - "integrity": "sha512-k7z4jilpZCujhiJ+QeKSwYXHc9HxqiVKlVE7/em0zBfPpcqnXKUP8F7ld7XaAkO6oXeAD7yonqcNJWqOF2pSGA==", - "dependencies": { - "invariant": "2.2.2", - "lodash": "^4.17.15" - } - }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/random-bytes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", - "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "dependencies": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/razorpay": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/razorpay/-/razorpay-2.0.6.tgz", - "integrity": "sha512-tWdV+WfRuuQSGQcGtUXmsPx5WO3QPrEKegy+AbGWT1STD5kxIYW0KHjdspu7YnTTP3q7ekwHDUYYjG8zSR5IiQ==", - "dependencies": { - "promise": "^8.0.1", - "request": "^2.88.0", - "request-promise": "^4.2.2" - } - }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dependencies": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dependencies": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dependencies": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dependencies": { - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dependencies": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/regexp-clone": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz", - "integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw==" - }, - "node_modules/registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dependencies": { - "is-finite": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request-promise": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz", - "integrity": "sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ==", - "dependencies": { - "bluebird": "^3.5.0", - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dependencies": { - "lodash": "^4.17.19" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/require_optional": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", - "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", - "dependencies": { - "resolve-from": "^2.0.0", - "semver": "^5.1.0" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" - }, - "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", - "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "dependencies": { - "lowercase-keys": "^1.0.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/safe-json-stringify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", - "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", - "optional": true - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/saslprep": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", - "optional": true, - "dependencies": { - "sparse-bitfield": "^3.0.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-extract": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sass-extract/-/sass-extract-2.1.0.tgz", - "integrity": "sha1-xl5soxA8vPL8oNzYGwfk5JpsxYM=", - "dependencies": { - "bluebird": "^3.4.7", - "gonzales-pe": "^4.2.2", - "parse-color": "^1.0.0", - "query-ast": "^1.0.1" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "node-sass": "^3.8.0 || 4" - } - }, - "node_modules/sass-graph": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz", - "integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==", - "dependencies": { - "glob": "^7.0.0", - "lodash": "^4.0.0", - "scss-tokenizer": "^0.2.3", - "yargs": "^13.3.2" - }, - "bin": { - "sassgraph": "bin/sassgraph" - } - }, - "node_modules/sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" - }, - "node_modules/scmp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", - "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" - }, - "node_modules/scss-tokenizer": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", - "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", - "dependencies": { - "js-base64": "^2.1.8", - "source-map": "^0.4.2" - } - }, - "node_modules/scss-tokenizer/node_modules/source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "dependencies": { - "amdefine": ">=0.0.4" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "dependencies": { - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver-diff/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "dependencies": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - }, - "node_modules/serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - }, - "node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sift": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/sift/-/sift-7.0.1.tgz", - "integrity": "sha512-oqD7PMJ+uO6jV9EQCl0LrRw1OwsiPsiFQR5AR30heR+4Dl7jBBbDLnNvWiak20tzZlSE1H7RB30SX/1j/YYT7g==" - }, - "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" - }, - "node_modules/sliced": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", - "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" - }, - "node_modules/slick": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/slick/-/slick-1.12.2.tgz", - "integrity": "sha1-vQSN23TefRymkV+qSldXCzVQwtc=", - "engines": { - "node": "*" - } - }, - "node_modules/smtp-connection": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz", - "integrity": "sha1-1275EnyyPCJZ7bHoNJwujV4tdME=", - "dependencies": { - "httpntlm": "1.6.1", - "nodemailer-shared": "1.1.0" - } - }, - "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", - "optional": true, - "dependencies": { - "memory-pager": "^1.0.2" - } - }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", - "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==" - }, - "node_modules/sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/stdout-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", - "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", - "dependencies": { - "readable-stream": "^2.0.1" - } - }, - "node_modules/stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/streamsearch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/string-width/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dependencies": { - "is-utf8": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dependencies": { - "get-stdin": "^4.0.1" - }, - "bin": { - "strip-indent": "cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tar": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", - "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", - "dependencies": { - "block-stream": "*", - "fstream": "^1.0.12", - "inherits": "2" - } - }, - "node_modules/term-size": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", - "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/true-case-path": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", - "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", - "dependencies": { - "glob": "^7.1.2" - } - }, - "node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" - }, - "node_modules/tsscmp": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", - "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", - "engines": { - "node": ">=0.6.x" - } - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, - "node_modules/uglify-js": { - "version": "3.13.6", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.6.tgz", - "integrity": "sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA==", - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/uid-safe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", - "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", - "dependencies": { - "random-bytes": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/uid2": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", - "integrity": "sha1-SDEm4Rd03y9xuLY53NeZw3YWK4I=" - }, - "node_modules/undefsafe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.3.tgz", - "integrity": "sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==", - "dev": true, - "dependencies": { - "debug": "^2.2.0" - } - }, - "node_modules/underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" - }, - "node_modules/unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "dependencies": { - "crypto-random-string": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/update-notifier": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", - "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", - "dev": true, - "dependencies": { - "boxen": "^4.2.0", - "chalk": "^3.0.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.3.1", - "is-npm": "^4.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.0.0", - "pupa": "^2.0.1", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "dependencies": { - "prepend-http": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/url-pattern": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/url-pattern/-/url-pattern-1.0.3.tgz", - "integrity": "sha1-BAkpJHGyTyPFDWWkeTF5PStaz8E=", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/valid-data-url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/valid-data-url/-/valid-data-url-2.0.0.tgz", - "integrity": "sha512-dyCZnv3aCey7yfTgIqdZanKl7xWAEEKCbgmR7SKqyK6QT/Z07ROactrgD1eA37C69ODRj7rNOjzKWVPh0EUjBA==", - "engines": { - "node": ">=6" - } - }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/web-resource-inliner": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/web-resource-inliner/-/web-resource-inliner-4.3.4.tgz", - "integrity": "sha512-agVAgRhOOi4GVlvKK34oM23tDgH8390HfLnZY2HZl8OFBwKNvUJkH7t89AT2iluQP8w9VHAAKX6Z8EN7/9tqKA==", - "dependencies": { - "async": "^3.1.0", - "chalk": "^2.4.2", - "datauri": "^2.0.0", - "htmlparser2": "^4.0.0", - "lodash.unescape": "^4.0.1", - "request": "^2.88.0", - "safer-buffer": "^2.1.2", - "valid-data-url": "^2.0.0", - "xtend": "^4.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/web-resource-inliner/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/web-resource-inliner/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/web-resource-inliner/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/web-resource-inliner/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "node_modules/web-resource-inliner/node_modules/domhandler": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-3.3.0.tgz", - "integrity": "sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==", - "dependencies": { - "domelementtype": "^2.0.1" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/web-resource-inliner/node_modules/htmlparser2": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-4.1.0.tgz", - "integrity": "sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q==", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^3.0.0", - "domutils": "^2.0.0", - "entities": "^2.0.0" - } - }, - "node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, - "node_modules/wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/wide-align/node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "dependencies": { - "string-width": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" - }, - "node_modules/wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "node_modules/xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" - }, - "node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" - }, - "node_modules/yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/yargs/node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "engines": { - "node": ">=4" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - } - }, "dependencies": { "@babel/code-frame": { "version": "7.12.13", @@ -7908,6 +1570,11 @@ "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" }, + "file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -8436,6 +2103,11 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, + "html-comment-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.2.tgz", + "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==" + }, "htmlparser2": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", @@ -8723,6 +2395,14 @@ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" }, + "is-svg": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-2.1.0.tgz", + "integrity": "sha1-z2EJDaDZ77yrhyLeum8DIgjbsOk=", + "requires": { + "html-comment-regex": "^1.1.0" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -9430,6 +3110,16 @@ "pump": "^3.0.0" } }, + "multer-s3": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/multer-s3/-/multer-s3-2.9.0.tgz", + "integrity": "sha512-qLF8pCD5HhXLLd954q49B63x3bk6Fe0jqD3eM0FVcGtqhiSVuTrchEDAo0mnO5pc34cMuX/CVCCbPkGTjX2xUA==", + "requires": { + "file-type": "^3.3.0", + "is-svg": "^2.1.0", + "run-parallel": "^1.1.6" + } + }, "multiparty": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", @@ -10224,6 +3914,11 @@ "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, "random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", @@ -10421,15 +4116,6 @@ "lodash": "^4.17.19" } }, - "require_optional": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", - "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", - "requires": { - "resolve-from": "^2.0.0", - "semver": "^5.1.0" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -10440,6 +4126,15 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, + "require_optional": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", + "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", + "requires": { + "resolve-from": "^2.0.0", + "semver": "^5.1.0" + } + }, "resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -10471,6 +4166,14 @@ "glob": "^7.1.3" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -10758,14 +4461,6 @@ "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, "string-width": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", @@ -10806,6 +4501,14 @@ } } }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", diff --git a/package.json b/package.json index de4b8d4..21c65ea 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "mongoose": "^5.12.2", "multer": "^1.4.2", "multer-gridfs-storage": "^4.2.0", + "multer-s3": "^2.9.0", "nodemailer": "^6.6.0", "nodemailer-smtp-transport": "^2.7.4", "passport": "^0.4.1", diff --git a/routes/blog.js b/routes/blog.js index 8359479..847327c 100644 --- a/routes/blog.js +++ b/routes/blog.js @@ -2,26 +2,34 @@ const express = require("express"); const router = express.Router(); const BlogController = require("../controllers/blog"); const isAuth = require("../middleware/requirelogin"); -const GridFsStorage = require("multer-gridfs-storage"); -const Grid = require("gridfs-stream"); const multer = require("multer"); -const MONGO_URI = `mongodb+srv://Cantilever:Cantilever@cluster0.dqxva.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`; +const multerS3 = require("multer-s3"); +const aws = require("aws-sdk"); -let storage = new GridFsStorage({ - url: MONGO_URI, - file: (req, file) => { - return new Promise((resolve, reject) => { - const fileInfo = { - filename: file.originalname, - bucketName: "blogImages", - }; - resolve(fileInfo); - }); - }, +aws.config.update({ + secretAccessKey: `${process.env.AWS_SEC}`, + accessKeyId: `${process.env.AWS_KEY}`, + region: "ap-south-1", }); -const upload = multer({ storage }); -router.post("/addBlog", upload.single("file"), BlogController.addBlog); +const s3 = new aws.S3(); + +const upload = multer({ + storage: multerS3({ + s3: s3, + acl: "public-read", + bucket: "cantilever-blog-images", + metadata: function (req, file, cb) { + cb(null, { fieldName: file.originalname }); + }, + + key: function (req, file, cb) { + cb(null, file.originalname); + }, + }), +}); + +router.post("/addBlog", upload.single("blog_image"), BlogController.addBlog); router.get("/getAllBlogs", BlogController.getAllBlogs);