From a411036383edb829a93382d2cbbe084f2498e2d6 Mon Sep 17 00:00:00 2001 From: vikram-kher Date: Thu, 23 Apr 2020 01:01:15 -0400 Subject: [PATCH 1/3] NodeMailer Fix --- server/data_access_layer/user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/data_access_layer/user.js b/server/data_access_layer/user.js index 8f4b5820..cdc385f9 100644 --- a/server/data_access_layer/user.js +++ b/server/data_access_layer/user.js @@ -93,16 +93,16 @@ async function sendPasswordResetEmail(email, fullName) { // Sets up sender details const transporter = nodemailer.createTransport({ - service: 'INSERT SENDER EMAIL SERVICE HERE (EX: Outlook365, Gmail)', + service: 'Gmail', auth: { - user: 'INSERT SENDER EMAIL HERE', - pass: 'INSERT SENDER EMAIL PASSWORD HERE' + user: 'gladeo.app@gmail.com', + pass: 'Abq12Yx34z!8' } }) // Message contents const info = { - from: '"Gladeo" ', + from: '"Gladeo" ', to: email, subject: 'Gladeo Password Reset', html: '

Hello ' + fullName + ',

There was a request to change your password.
Please enter this' From c1c196d9a28c13c50a3db8580c7e7b7005e8258b Mon Sep 17 00:00:00 2001 From: vikram-kher Date: Thu, 14 May 2020 17:44:00 -0700 Subject: [PATCH 2/3] Youtube Integration --- package.json | 4 + server/api/routes/user.js | 17 ++- server/data_access_layer/user.js | 132 +++++++++++++++++- yarn.lock | 226 +++++++++++++++++++++++++++++-- 4 files changed, 366 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index f4e5dd70..20c7f7b7 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ ] }, "dependencies": { + "@google-cloud/local-auth": "^0.1.0", "@react-native-community/async-storage": "^1.9.0", "@react-native-community/cameraroll": "^1.6.0", "@react-native-community/masked-view": "0.1.5", @@ -50,8 +51,11 @@ "core-util-is": "^1.0.2", "dotenv": "^8.2.0", "express-session": "^1.17.0", + "google-auth-library": "^6.0.0", + "googleapis": "^50.0.0", "mem": "^6.0.1", "nodemailer": "^6.4.2", + "opn": "^6.0.0", "react": "~16.9.0", "react-dom": "16.9.0", "react-native": "~0.61.4", diff --git a/server/api/routes/user.js b/server/api/routes/user.js index a16228b2..1201e97e 100644 --- a/server/api/routes/user.js +++ b/server/api/routes/user.js @@ -1,6 +1,6 @@ const express = require('express') const router = express.Router() -const { updateAnsweredQuestions } = require('../../data_access_layer/user') +const { updateAnsweredQuestions, videoAuthorize } = require('../../data_access_layer/user') const { getQuestion, getAllQuestions } = require('../../data_access_layer/question') router.get('/', async (req, res) => { @@ -189,5 +189,20 @@ router.delete('/questions', async (req, res) => { } }) +router.post('/upload', async (req, res) => { + const name = req.body['Name'] + const email = req.body['Email'] + const URI = req.body['URI'] + try { + return res.status(200).send(videoAuthorize(name, email, URI)) + + }catch(err) { + console.log(err) + return res.status(err.statusCode).send(err) + } + + +}) + module.exports = router diff --git a/server/data_access_layer/user.js b/server/data_access_layer/user.js index cdc385f9..9d99aa10 100644 --- a/server/data_access_layer/user.js +++ b/server/data_access_layer/user.js @@ -3,6 +3,16 @@ const { base } = require('./index') const { getCompany } = require('./company') const nodemailer = require('nodemailer') const { extractContentFromRecords, getAllFromTable } = require('./helpers') +const fs = require('fs') +const readline = require('readline') +const {google} = require('googleapis') +const youtube = google.youtube('v3') +const OAuth2 = google.auth.OAuth2 +const SCOPES = [ 'https://www.googleapis.com/auth/youtube.upload', + 'https://www.googleapis.com/auth/youtube'] +const TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH || +process.env.USERPROFILE) + '/.credentials/' +const TOKEN_PATH = TOKEN_DIR + 'youtube-nodejs-quickstart.json' async function getUser(userId) { const userRecords = base('Users').select({ @@ -153,6 +163,121 @@ async function updateUserPassword(email, password) { return true } + +function storeToken(token) { + try { + fs.mkdirSync(TOKEN_DIR) + } catch (err) { + if (err.code != 'EEXIST') { + throw err + } + } + fs.writeFile(TOKEN_PATH, JSON.stringify(token), (err) => { + if (err) throw err + console.log('Token stored to ' + TOKEN_PATH) + }) +} + +function getNewToken(oauth2Client, callback) { + const authUrl = oauth2Client.generateAuthUrl({ + access_type: 'offline', + scope: SCOPES + }) + console.log('Authorize this app by visiting this url: ', authUrl) + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }) + rl.question('Enter the code from that page here: ', function(code) { + rl.close() + oauth2Client.getToken(code, function(err, token) { + if (err) { + console.log('Error while trying to retrieve access token', err) + return + } + oauth2Client.credentials = token + storeToken(token) + callback(oauth2Client) + }) + }) +} + +function authorize(credentials, callback, name, email, URI) { + const clientSecret = process.env.CLIENT_SECRET + const clientId = credentials.web.client_id + const redirectUrl = credentials.web.redirect_uris[0] + const oauth2Client = new OAuth2(clientId, clientSecret, redirectUrl) + // Check if we have previously stored a token. + fs.readFile(TOKEN_PATH, function(err, token) { + if (err) { + getNewToken(oauth2Client, callback) + } else { + oauth2Client.credentials = JSON.parse(token) + return(callback(oauth2Client, name, email, URI)) + } + }) +} + +async function uploadVideo(auth, name, email, URI) { + google.options({auth}) + const fileSize = fs.statSync(URI).size + try { + const res = await youtube.videos.insert( + { + part: 'id,snippet,status', + notifySubscribers: false, + requestBody: { + snippet: { + title: '[Draft - ready for review] video by ' + name, + description: 'Draft video created by ' + name + '\nEmail: ' + email, + }, + status: { + privacyStatus: 'private', + }, + }, + media: { + body: fs.createReadStream(URI), + }, + }, + + { + // Use the `onUploadProgress` event from Axios to track the + // number of bytes uploaded to this point. + onUploadProgress: evt => { + const progress = (evt.bytesRead / fileSize) * 100 + readline.clearLine(process.stdout, 0) + readline.cursorTo(process.stdout, 0, null) + process.stdout.write(`${Math.round(progress)}% complete`) + }, + } + ) + + console.log(res.data) + return res.data + + }catch(err) { + console.log(err) + } + +} + + +async function videoAuthorize(name, email, URI) { + name = name + URI = URI + email = email + fs.readFile('client_secret.json', function processClientSecrets(err, content) { + if (err) { + console.log('Error loading client secret file: ' + err) + return + } + // Authorize a client with the loaded credentials, then call the YouTube API. + authorize(JSON.parse(content), uploadVideo, name, email, URI) + }) + +} + + module.exports = { getUser, getUserByEmail, @@ -162,5 +287,10 @@ module.exports = { sendPasswordResetEmail, verifyPasswordCode, updateUserPassword, - updateEmailandPassword + updateEmailandPassword, + uploadVideo, + authorize, + getNewToken, + storeToken, + videoAuthorize } diff --git a/yarn.lock b/yarn.lock index 7c419433..af4e6ed1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1163,6 +1163,16 @@ dependencies: "@types/hammerjs" "^2.0.36" +"@google-cloud/local-auth@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@google-cloud/local-auth/-/local-auth-0.1.0.tgz#8f74491e56cbd45a36c2fc23cd257fc63964905c" + integrity sha512-AVhTXbUBH/KBgqzgNWJKMUk2gnCxnXb0dwkCiFv00pgYWm35uc7XYkTrt0pSkp+6uqDWOdt2ChYh1i4TuJTX5A== + dependencies: + arrify "^2.0.1" + google-auth-library "^6.0.0" + open "^7.0.3" + server-destroy "^1.0.1" + "@hapi/address@2.x.x": version "2.1.4" resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5" @@ -1876,6 +1886,13 @@ acorn@^7.1.0, acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== +agent-base@6: + version "6.0.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.0.tgz#5d0101f19bbfaed39980b22ae866de153b93f09a" + integrity sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw== + dependencies: + debug "4" + airtable@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/airtable/-/airtable-0.8.1.tgz#8d10f04f41673b86ed75fa054f54470357e36ae0" @@ -2131,6 +2148,11 @@ array.prototype.flat@^1.2.1: define-properties "^1.1.3" es-abstract "^1.17.0-next.1" +arrify@^2.0.0, arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + art@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/art/-/art-0.10.3.tgz#b01d84a968ccce6208df55a733838c96caeeaea2" @@ -2604,7 +2626,7 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base64-js@^1.1.2, base64-js@^1.2.3: +base64-js@^1.1.2, base64-js@^1.2.3, base64-js@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== @@ -2649,6 +2671,11 @@ big-integer@^1.6.44: resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e" integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w== +bignumber.js@^7.0.0: + version "7.2.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" + integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ== + binary-extensions@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" @@ -2765,6 +2792,11 @@ buffer-crc32@^0.2.13: resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= + buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -3405,6 +3437,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: dependencies: ms "2.0.0" +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + debug@^3.1.0, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" @@ -3412,13 +3451,6 @@ debug@^3.1.0, debug@^3.2.6: dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" - decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -3628,6 +3660,13 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -4183,7 +4222,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.0, extend@~3.0.2: +extend@^3.0.0, extend@^3.0.2, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -4260,6 +4299,11 @@ fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-text-encoding@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.2.tgz#ff1ad5677bde049e0f8656aa6083a7ef2c5836e2" + integrity sha512-5rQdinSsycpzvAoHga2EDn+LRX1d5xLFsuNG0Kg61JrAT/tASXcLL0nf/33v+sAxlQcfYmWbTURa1mmAf55jGw== + fb-watchman@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" @@ -4541,6 +4585,25 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" +gaxios@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-3.0.3.tgz#497730758f5b0d43a32ebdbebe5f1bd9f7db7aed" + integrity sha512-PkzQludeIFhd535/yucALT/Wxyj/y2zLyrMwPcJmnLHDugmV49NvAi/vb+VUq/eWztATZCNcb8ue+ywPG+oLuw== + 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" + +gcp-metadata@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.1.0.tgz#8b9b5903882076948554af471c838e7ea2f564b4" + integrity sha512-r57SV28+olVsflPlKyVig3Muo/VDlcsObMtvDGOEtEJXj+DDE8bEl0coIkXh//hbkSDTvo+f5lbihZOndYXQQQ== + dependencies: + gaxios "^3.0.0" + json-bigint "^0.3.0" + gensync@^1.0.0-beta.1: version "1.0.0-beta.1" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" @@ -4663,6 +4726,48 @@ globrex@^0.1.1: resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== +google-auth-library@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.0.0.tgz#f92576e9e920803634c258b25f091604c1379722" + integrity sha512-uLydy1t6SHN/EvYUJrtN3GCHFrnJ0c8HJjOxXiGjoTuYHIoCUT3jVxnzmjHwVnSdkfE9Akasm2rM6qG1COTXfQ== + dependencies: + arrify "^2.0.0" + base64-js "^1.3.0" + ecdsa-sig-formatter "^1.0.11" + fast-text-encoding "^1.0.0" + gaxios "^3.0.0" + gcp-metadata "^4.0.0" + gtoken "^5.0.0" + jws "^4.0.0" + lru-cache "^5.0.0" + +google-p12-pem@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-3.0.1.tgz#a220c05a8d7ee9751dd133ee72ecfc855820d5ab" + integrity sha512-VlQgtozgNVVVcYTXS36eQz4PXPt9gIPqLOhHN0QiV6W6h4qSCNVKPtKC5INtJsaHHF2r7+nOIa26MJeJMTaZEQ== + dependencies: + node-forge "^0.9.0" + +googleapis-common@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/googleapis-common/-/googleapis-common-4.1.1.tgz#433069ce463e50c631c5e1b5871f9d44881c90af" + integrity sha512-Br3EPgm1f7Zb/Vi8R+1Jc5jjhaFZMgQpvGaGAKcBq81BAi7m8NCHBaaR0XF3p4RbMjA4Wiz1RkPD0A8/5aP+xw== + dependencies: + extend "^3.0.2" + gaxios "^3.0.0" + google-auth-library "^6.0.0" + qs "^6.7.0" + url-template "^2.0.8" + uuid "^8.0.0" + +googleapis@^50.0.0: + version "50.0.0" + resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-50.0.0.tgz#861aacb96190f9a19dec19c08f0858369ecc1f4e" + integrity sha512-AJdOpPbDiNauraQZr51RR85cA53ygYtzLUj6Nq0cTr3g+GQ+GxjyLT6IMGgSE+/0dGLTpRVCemkZjZQA0XMb5Q== + dependencies: + google-auth-library "^6.0.0" + googleapis-common "^4.1.0" + got@^9.6.0: version "9.6.0" resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" @@ -4690,6 +4795,16 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= +gtoken@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.0.1.tgz#b93f309d89adfe230bb0f24269b978284ba89e0f" + integrity sha512-33w4FNDkUcyIOq/TqyC+drnKdI4PdXmWp9lZzssyEQKuvu9ZFN3KttaSnDKo52U3E51oujVGop93mKxmqO8HHg== + dependencies: + gaxios "^3.0.0" + google-p12-pem "^3.0.0" + jws "^4.0.0" + mime "^2.2.0" + "hammerjs@https://github.com/naver/hammer.js.git": version "2.0.17-snapshot" resolved "https://github.com/naver/hammer.js.git#54bc698b25edd6e1b76ca975ebaced5ce0467d51" @@ -4873,6 +4988,14 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +https-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" + integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + dependencies: + agent-base "6" + debug "4" + human-signals@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" @@ -5163,6 +5286,11 @@ is-directory@^0.3.1: resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= +is-docker@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b" + integrity sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ== + is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -5943,6 +6071,13 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= +json-bigint@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-0.3.0.tgz#0ccd912c4b8270d05f056fbd13814b53d3825b1e" + integrity sha1-DM2RLEuCcNBfBW+9E4FLU9OCWx4= + dependencies: + bignumber.js "^7.0.0" + json-buffer@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" @@ -6036,6 +6171,23 @@ jsx-ast-utils@^2.2.1, jsx-ast-utils@^2.2.3: array-includes "^3.0.3" object.assign "^4.1.0" +jwa@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc" + integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" + integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== + dependencies: + jwa "^2.0.0" + safe-buffer "^5.0.1" + keymirror@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/keymirror/-/keymirror-0.1.1.tgz#918889ea13f8d0a42e7c557250eee713adc95c35" @@ -6320,6 +6472,13 @@ lru-cache@^4.0.1: pseudomap "^1.0.2" yallist "^2.1.2" +lru-cache@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -6699,6 +6858,11 @@ mime@1.6.0, mime@^1.4.1: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== +mime@^2.2.0: + version "2.4.5" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.5.tgz#d8de2ecb92982dedbb6541c9b6841d7f218ea009" + integrity sha512-3hQhEUF027BuxZjQA3s7rIv/7VCQPa27hN9u9g87sEkWaKwQPuXOkVKtOeiyUrnWqTDiOs8Ed2rwg733mB0R5w== + mime@^2.4.1: version "2.4.4" resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" @@ -6868,11 +7032,16 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^2.2.0, node-fetch@^2.5.0: +node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== +node-forge@^0.9.0: + version "0.9.1" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.1.tgz#775368e6846558ab6676858a4d8c6e8d16c677b5" + integrity sha512-G6RlQt5Sb4GMBzXvhfkeFmbqR6MzhtnT7VTHuLadjkii3rdYHNdw0m8zA4BTxVIh68FicCQ2NSUANpsqkr9jvQ== + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -7192,11 +7361,26 @@ open@^6.2.0: dependencies: is-wsl "^1.1.0" +open@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/open/-/open-7.0.3.tgz#db551a1af9c7ab4c7af664139930826138531c48" + integrity sha512-sP2ru2v0P290WFfv49Ap8MF6PkzGNnGlAwHweB4WR4mr5d2d0woiCluUeJ218w7/+PmoBy9JmYgD5A4mLcWOFA== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + opencollective-postinstall@^2.0.0, opencollective-postinstall@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw== +opn@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/opn/-/opn-6.0.0.tgz#3c5b0db676d5f97da1233d1ed42d182bc5a27d2d" + integrity sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ== + dependencies: + is-wsl "^1.1.0" + optionator@^0.8.1, optionator@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -7724,6 +7908,11 @@ qs@^6.5.1: resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.3.tgz#bfadcd296c2d549f1dffa560619132c977f5008e" integrity sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw== +qs@^6.7.0: + version "6.9.4" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.4.tgz#9090b290d1f91728d3c22e54843ca44aea5ab687" + integrity sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ== + qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" @@ -8667,6 +8856,11 @@ serve-static@1.14.1, serve-static@^1.13.1: parseurl "~1.3.3" send "0.17.1" +server-destroy@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/server-destroy/-/server-destroy-1.0.1.tgz#f13bf928e42b9c3e79383e61cc3998b5d14e6cdd" + integrity sha1-8Tv5KOQrnD55OD5hzDmYtdFObN0= + set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -9744,6 +9938,11 @@ url-parse@^1.4.4: querystringify "^2.1.1" requires-port "^1.0.0" +url-template@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" + integrity sha1-/FZaPMy/93MMd19WQflVV5FDnyE= + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" @@ -9769,6 +9968,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.0.0.tgz#bc6ccf91b5ff0ac07bbcdbf1c7c4e150db4dbb6c" + integrity sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw== + v8-compile-cache@^2.0.3: version "2.1.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" @@ -10119,7 +10323,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.3: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From 73c89d24af31cb403e0916401112a4d1352779e6 Mon Sep 17 00:00:00 2001 From: vikram-kher Date: Sat, 16 May 2020 11:52:42 -0700 Subject: [PATCH 3/3] .env updates --- .env-template | 2 ++ server/data_access_layer/user.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.env-template b/.env-template index 4a136944..9e402286 100644 --- a/.env-template +++ b/.env-template @@ -3,6 +3,8 @@ NODE_ENV=development PORT=3001 AIRTABLE_API_KEY= /* YOUR API KEY HERE */ AIRTABLE_APP_ID= /* GLADEO AIRTABLE APP ID HERE */ +EMAIL= /* GLADEO EMAIL HERE */ +PASSWORD= /* GLADEO EMAIL PASSWORD HERE */ /* WHEN running on a real device (non simulator) setup ngrok real quick - https://ngrok.com/download */ /* Run in new terminal `./ngrok http 3001` and replace BASE_PATH w/ forwarding path */ diff --git a/server/data_access_layer/user.js b/server/data_access_layer/user.js index 9d99aa10..1b2a1b73 100644 --- a/server/data_access_layer/user.js +++ b/server/data_access_layer/user.js @@ -105,14 +105,14 @@ async function sendPasswordResetEmail(email, fullName) { const transporter = nodemailer.createTransport({ service: 'Gmail', auth: { - user: 'gladeo.app@gmail.com', - pass: 'Abq12Yx34z!8' + user: process.env.EMAIL, + pass: process.env.PASSWORD } }) // Message contents const info = { - from: '"Gladeo" ', + from: '"Gladeo" <' + process.env.EMAIL + '>', to: email, subject: 'Gladeo Password Reset', html: '

Hello ' + fullName + ',

There was a request to change your password.
Please enter this'