From ccb6e62472574b1397551aaf83da12eadee6928d Mon Sep 17 00:00:00 2001 From: Eva Barrett Date: Thu, 9 Aug 2018 15:49:14 -0700 Subject: [PATCH 01/57] transfering code to new project4 --- client/src/App.css | 79 ++++++++++++++++++++++++++++++++++++++ client/src/App.js | 39 +++++++++++++++++++ client/src/Calendar.js | 50 ++++++++++++++++++++++++ client/src/Goals.js | 44 +++++++++++++++++++++ client/src/GoalsTracker.js | 43 +++++++++++++++++++++ client/src/Home.js | 48 +++++++++++++++++++++++ client/src/Navbar.js | 31 +++++++++++++++ client/src/User.js | 11 ++++++ client/src/index.css | 5 +++ client/src/index.js | 8 ++++ 10 files changed, 358 insertions(+) create mode 100644 client/src/App.css create mode 100644 client/src/App.js create mode 100644 client/src/Calendar.js create mode 100644 client/src/Goals.js create mode 100644 client/src/GoalsTracker.js create mode 100644 client/src/Home.js create mode 100644 client/src/Navbar.js create mode 100644 client/src/User.js create mode 100644 client/src/index.css create mode 100644 client/src/index.js diff --git a/client/src/App.css b/client/src/App.css new file mode 100644 index 00000000..e8d541ab --- /dev/null +++ b/client/src/App.css @@ -0,0 +1,79 @@ +body { + background: #5298d1; +} +/* ADDED */ +.my-card { + height: 350px; + width: 350px; +} + +.my-card__media { + background-image: url("./Calendar.png"); + height: 825px; + width: 825px; +} + +#button-login { + width: 100%; +} + +#tracker-box { + background: #5298d1; + height: 850px; + width: 850px; + position: relative; + align-items: center; +} + +/* ADDED */ + +.App { + text-align: center; +} + +.App-logo { + animation: App-logo-spin infinite 20s linear; + height: 80px; +} + +.App-header { + background-color: #102c82; + background-image: url("https://images.unsplash.com/photo-1506485338023-6ce5f36692df?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=361443dfa9b671620076cd18e12d060d&auto=format&fit=crop&w=800&q=60"); + background-repeat: no-repeat; + background-size: cover; + height: 150px; + padding: 20px; + color: white; +} + +.App-title { + font-size: 1.5em; + font-family: 'Monoton'; + color: white; + font-size: 5em; + margin-top: 0em; + margin-bottom: 0em; + font-weight: lighter; +} + +.App-intro { + font-size: large; +} + +#box1 { + height: 5em; + background-color: #e9e2cb; + color: white; +} + +.grid { + background: #e9e2cb; + height: 40em; + padding-left: 14em; + padding-right: 14em; +} + +@keyframes App-logo-spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} diff --git a/client/src/App.js b/client/src/App.js new file mode 100644 index 00000000..873e7f95 --- /dev/null +++ b/client/src/App.js @@ -0,0 +1,39 @@ +import React, { Component } from 'react'; +import { BrowserRouter as Router, Route } from 'react-router-dom'; +import logo from './logo.svg'; +import Paper from '@material-ui/core/Paper'; +import Grid from '@material-ui/core/Grid'; +import AppBar from '@material-ui/core/AppBar' +import './App.css'; +import Calendar from './Calendar'; +import Goals from './Goals'; +import Home from './Home'; +import Navbar from './Navbar'; +import User from './User'; +// import Login from './Login'; +import GoalTracker from './GoalTracker'; + + +class App extends Component { + render() { + return ( +
+ +
+ +
+ {/* */} +

SeeGoal App

+
+ } /> + } /> + {/* } /> */} + } /> +
+
+
+ ); + } +} + +export default App; diff --git a/client/src/Calendar.js b/client/src/Calendar.js new file mode 100644 index 00000000..79a634dc --- /dev/null +++ b/client/src/Calendar.js @@ -0,0 +1,50 @@ +import React, {Component} from 'react'; +import Paper from '@material-ui/core/Paper'; +import Grid from '@material-ui/core/Grid'; +import {MDCRipple} from '@material/ripple'; + + +class Calendar extends Component { + render() { + return ( +
+
+ +

ONE Calendar

+ +
+
+
CALENDAR TRACKER
+
+
+
Title
+
+
+
+ + +
+
+ + +
+
+
+ +
+
+
+ + +

GRID in Calendar

+
+
+ + +
+
+ ); + } +} + +export default Calendar; diff --git a/client/src/Goals.js b/client/src/Goals.js new file mode 100644 index 00000000..1a5db491 --- /dev/null +++ b/client/src/Goals.js @@ -0,0 +1,44 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import Paper from '@material-ui/core/Paper'; +import Grid from '@material-ui/core/Grid'; + +const styles = theme => ({ + root: { + flexGrow: 1, + }, + paper: { + padding: theme.spacing.unit * 2, + textAlign: 'center', + color: theme.palette.text.secondary, + }, +}); + +function Goals(props) { + const { classes } = props; + + return ( +
+

Goals

+ + + ONE + + + TWO + + + THREE + + +
+ ); +} + +Goals.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(Goals); +x diff --git a/client/src/GoalsTracker.js b/client/src/GoalsTracker.js new file mode 100644 index 00000000..be846de5 --- /dev/null +++ b/client/src/GoalsTracker.js @@ -0,0 +1,43 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import Paper from '@material-ui/core/Paper'; +import Grid from '@material-ui/core/Grid'; + +const styles = theme => ({ + root: { + flexGrow: 1, + }, + paper: { + padding: theme.spacing.unit * 2, + textAlign: 'center', + color: theme.palette.text.secondary, + }, +}); + +function Goals(props) { + const { classes } = props; + + return ( +
+

Goals

+ + + ONE + + + TWO + + + THREE + + +
+ ); +} + +Goals.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(Goals); diff --git a/client/src/Home.js b/client/src/Home.js new file mode 100644 index 00000000..be754deb --- /dev/null +++ b/client/src/Home.js @@ -0,0 +1,48 @@ +import React, {Component} from 'react'; +import Paper from '@material-ui/core/Paper'; +import Grid from '@material-ui/core/Grid'; + +class Home extends Component { + render() { + return ( +
+ +
+
+
+
+

Login form

+
+
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+ +
+ + +

GRID in Home

+
+ +
+ + +
+
+ ); + } +} + +export default Home; diff --git a/client/src/Navbar.js b/client/src/Navbar.js new file mode 100644 index 00000000..50a2c15f --- /dev/null +++ b/client/src/Navbar.js @@ -0,0 +1,31 @@ +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; +import Toolbar from '@material-ui/core/Toolbar' +import AppBar from '@material-ui/core/AppBar' +import Typography from '@material-ui/core/Typography' +import './App.css'; + +const Navbar = props => { + return ( +
+ + + + + This is where my navagation bar is. + + + +
+ ) +} + + + + +export default Navbar; diff --git a/client/src/User.js b/client/src/User.js new file mode 100644 index 00000000..7a716585 --- /dev/null +++ b/client/src/User.js @@ -0,0 +1,11 @@ +import React from 'react'; + +export class User extends React.Component { + render() { + return( +
+

This is the User page

+
+ ) + } +} diff --git a/client/src/index.css b/client/src/index.css new file mode 100644 index 00000000..b4cc7250 --- /dev/null +++ b/client/src/index.css @@ -0,0 +1,5 @@ +body { + margin: 0; + padding: 0; + font-family: sans-serif; +} diff --git a/client/src/index.js b/client/src/index.js new file mode 100644 index 00000000..fae3e350 --- /dev/null +++ b/client/src/index.js @@ -0,0 +1,8 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import registerServiceWorker from './registerServiceWorker'; + +ReactDOM.render(, document.getElementById('root')); +registerServiceWorker(); From 435fb491e0dc17f6042949ac9f622fd73fd0823f Mon Sep 17 00:00:00 2001 From: Matt Carver Date: Thu, 9 Aug 2018 15:52:00 -0700 Subject: [PATCH 02/57] github oauth --- .env | 2 + .gitignore | 1 + config/config.json | 18 +- config/passportConfig.js | 31 +++ index.js | 52 ++++ migrations/20180809221721-create-user.js | 30 ++ models/user.js | 11 + node_modules/connect-ensure-login/.travis.yml | 5 + node_modules/connect-ensure-login/LICENSE | 20 ++ node_modules/connect-ensure-login/README.md | 75 +++++ .../lib/ensureLoggedIn.js | 52 ++++ .../lib/ensureLoggedOut.js | 43 +++ .../connect-ensure-login/lib/index.js | 10 + .../connect-ensure-login/package.json | 71 +++++ node_modules/dotenv/CHANGELOG.md | 96 +++++++ node_modules/dotenv/LICENSE | 23 ++ node_modules/dotenv/README.md | 261 ++++++++++++++++++ node_modules/dotenv/appveyor.yml | 13 + node_modules/dotenv/config.js | 5 + node_modules/dotenv/lib/cli-options.js | 11 + node_modules/dotenv/lib/main.js | 77 ++++++ node_modules/dotenv/package.json | 70 +++++ node_modules/dotenv/tests/test-cli-options.js | 13 + node_modules/dotenv/tests/test-config-cli.js | 28 ++ node_modules/dotenv/tests/test-config.js | 99 +++++++ node_modules/dotenv/tests/test-parse.js | 43 +++ package-lock.json | 10 + package.json | 5 +- 28 files changed, 1162 insertions(+), 13 deletions(-) create mode 100644 .gitignore create mode 100644 config/passportConfig.js create mode 100644 index.js create mode 100644 migrations/20180809221721-create-user.js create mode 100644 models/user.js create mode 100644 node_modules/connect-ensure-login/.travis.yml create mode 100644 node_modules/connect-ensure-login/LICENSE create mode 100644 node_modules/connect-ensure-login/README.md create mode 100644 node_modules/connect-ensure-login/lib/ensureLoggedIn.js create mode 100644 node_modules/connect-ensure-login/lib/ensureLoggedOut.js create mode 100644 node_modules/connect-ensure-login/lib/index.js create mode 100644 node_modules/connect-ensure-login/package.json create mode 100644 node_modules/dotenv/CHANGELOG.md create mode 100644 node_modules/dotenv/LICENSE create mode 100644 node_modules/dotenv/README.md create mode 100644 node_modules/dotenv/appveyor.yml create mode 100644 node_modules/dotenv/config.js create mode 100644 node_modules/dotenv/lib/cli-options.js create mode 100644 node_modules/dotenv/lib/main.js create mode 100644 node_modules/dotenv/package.json create mode 100644 node_modules/dotenv/tests/test-cli-options.js create mode 100644 node_modules/dotenv/tests/test-config-cli.js create mode 100644 node_modules/dotenv/tests/test-config.js create mode 100644 node_modules/dotenv/tests/test-parse.js diff --git a/.env b/.env index e69de29b..bc85290c 100644 --- a/.env +++ b/.env @@ -0,0 +1,2 @@ +GITHUB_CLIENT_ID=841a9e6638e7bd42126a +GITHUB_CLIENT_SECRET=b68b548d21c43943c927db4b0c8d62d0684bd489 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4c49bd78 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/config/config.json b/config/config.json index 0f858c66..b3e04e5e 100644 --- a/config/config.json +++ b/config/config.json @@ -1,23 +1,17 @@ { "development": { - "username": "root", - "password": null, - "database": "database_development", + "database": "repotracker", "host": "127.0.0.1", - "dialect": "mysql" + "dialect": "postgres" }, "test": { - "username": "root", - "password": null, - "database": "database_test", + "database": "repotracker", "host": "127.0.0.1", - "dialect": "mysql" + "dialect": "postgres" }, "production": { - "username": "root", - "password": null, - "database": "database_production", + "database": "repotracker", "host": "127.0.0.1", - "dialect": "mysql" + "dialect": "postgres" } } diff --git a/config/passportConfig.js b/config/passportConfig.js new file mode 100644 index 00000000..14aab2c0 --- /dev/null +++ b/config/passportConfig.js @@ -0,0 +1,31 @@ +require('dotenv').config(); +var passport = require('passport'); +var GitHubStrategy = require('passport-github').Strategy; +var db = require("../models") + +passport.use(new GitHubStrategy({ + clientID: process.env.GITHUB_CLIENT_ID, + clientSecret: process.env.GITHUB_CLIENT_SECRET, + callbackURL: "http://localhost:3001/auth/github/callback" + }, + (accessToken, refreshToken, profile, cb) => { + console.log('this is the access token:', accessToken); + // console.log('refresh token', refreshToken); + console.log('see this profile:', profile); + User.findOrCreate({ githubid: profile.id }, function (err, user) { + return cb(err, user); + }); + User.findOrCreate({ accessToken: accessToken}, function(err, user) { + return cb(err, user); + }); + })); + +passport.serializeUser(function(user, cb) { + cb(null, user); +}); + +passport.deserializeUser(function(user, cb) { + cb(null, obj); +}); + +module.exports = passport; diff --git a/index.js b/index.js new file mode 100644 index 00000000..75d0da8d --- /dev/null +++ b/index.js @@ -0,0 +1,52 @@ +const express = require('express'); +const app = express(); +const bodyParser = require('body-parser'); + +const passport = require('./config/passportConfig.js'); +const session = require('express-session'); + +app.use(require('morgan')('combined')); +app.use(require('cookie-parser')()); +app.use(bodyParser.urlencoded({extended: true})); +app.use(bodyParser.json()); + +app.use(session({ secret: 'oauths are stupid', resave: true, saveUninitialized: true })); +app.use(passport.initialize()); +app.use(passport.session()); + +// app.get('/', +// function(req, res) { +// res.render('home', { user.req.user }); +// }); + +app.get('/', (req, res) => { + console.log('This is the user' + req.user) + res.json({ + status: "session cookie whatever" + }); +}); + +app.get('/login', + function(req, res) { + res.render('login') + }); + +app.get('/auth/github', + passport.authenticate('github')); + +app.get('/auth/github/callback', + passport.authenticate('github', { failureRedirect: '/login' }), + function(req, res) { + // Successful authentication, redirect home. + res.redirect('/'); + }); + + app.get('/profile', + require('connect-ensure-login').ensureLoggedIn(), + function(req, res) { + res.render('profile', { user: req.user }); + }); + + app.listen(3001, () => { + console.log('Server gitting run on port 3001') + }); diff --git a/migrations/20180809221721-create-user.js b/migrations/20180809221721-create-user.js new file mode 100644 index 00000000..26801a10 --- /dev/null +++ b/migrations/20180809221721-create-user.js @@ -0,0 +1,30 @@ +'use strict'; +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('users', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER + }, + githubid: { + type: Sequelize.INTEGER + }, + accesstoken: { + type: Sequelize.STRING + }, + createdAt: { + allowNull: false, + type: Sequelize.DATE + }, + updatedAt: { + allowNull: false, + type: Sequelize.DATE + } + }); + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('users'); + } +}; \ No newline at end of file diff --git a/models/user.js b/models/user.js new file mode 100644 index 00000000..53e3646a --- /dev/null +++ b/models/user.js @@ -0,0 +1,11 @@ +'use strict'; +module.exports = (sequelize, DataTypes) => { + var user = sequelize.define('user', { + githubid: DataTypes.INTEGER, + accesstoken: DataTypes.STRING + }, {}); + user.associate = function(models) { + // associations can be defined here + }; + return user; +}; \ No newline at end of file diff --git a/node_modules/connect-ensure-login/.travis.yml b/node_modules/connect-ensure-login/.travis.yml new file mode 100644 index 00000000..32a1cdcc --- /dev/null +++ b/node_modules/connect-ensure-login/.travis.yml @@ -0,0 +1,5 @@ +language: "node_js" +node_js: + - "0.4" + - "0.6" + - "0.8" diff --git a/node_modules/connect-ensure-login/LICENSE b/node_modules/connect-ensure-login/LICENSE new file mode 100644 index 00000000..d61567a2 --- /dev/null +++ b/node_modules/connect-ensure-login/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2012-2013 Jared Hanson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/connect-ensure-login/README.md b/node_modules/connect-ensure-login/README.md new file mode 100644 index 00000000..a0dc65f5 --- /dev/null +++ b/node_modules/connect-ensure-login/README.md @@ -0,0 +1,75 @@ +# connect-ensure-login + +This middleware ensures that a user is logged in. If a request is received that +is unauthenticated, the request will be redirected to a login page. The URL +will be saved in the session, so the user can be conveniently returned to the +page that was originally requested. + +## Install + + $ npm install connect-ensure-login + +## Usage + +#### Ensure Authentication + +In this example, an application has a settings page where preferences can be +configured. A user must be logged in before accessing this page. + + app.get('/settings', + ensureLoggedIn('/login'), + function(req, res) { + res.render('settings', { user: req.user }); + }); + +If a user is not logged in when attempting to access this page, the request will +be redirected to `/login` and the original request URL (`/settings`) will be +saved to the session at `req.session.returnTo`. + +#### Log In and Return To + +This middleware integrates seamlessly with [Passport](http://passportjs.org/). +Simply mount Passport's `authenticate()` middleware at the login route. + + app.get('/login', function(req, res) { + res.render('login'); + }); + + app.post('/login', passport.authenticate('local', { successReturnToOrRedirect: '/', failureRedirect: '/login' })); + +Upon log in, Passport will notice the `returnTo` URL saved in the session and +redirect the user back to `/settings`. + +#### Step By Step + +If the user is not logged in, the sequence of requests and responses that take +place during this process can be confusing. Here is a step-by-step overview of +what happens: + +1. User navigates to `GET /settings` + - Middleware sets `session.returnTo` to `/settings` + - Middleware redirects to `/login` +2. User's browser follows redirect to `GET /login` + - Application renders a login form (or, alternatively, offers SSO) +3. User submits credentials to `POST /login` + - Application verifies credentials + - Passport reads `session.returnTo` and redirects to `/settings` +4. User's browser follows redirect to `GET /settings` + - Now authenticated, application renders settings page + +## Tests + + $ npm install --dev + $ make test + +[![Build Status](https://secure.travis-ci.org/jaredhanson/connect-ensure-login.png)](http://travis-ci.org/jaredhanson/connect-ensure-login) + +## Credits + + - [Jared Hanson](http://github.com/jaredhanson) + +## License + +[The MIT License](http://opensource.org/licenses/MIT) + +Copyright (c) 2012-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/connect-ensure-login/lib/ensureLoggedIn.js b/node_modules/connect-ensure-login/lib/ensureLoggedIn.js new file mode 100644 index 00000000..23d2c63a --- /dev/null +++ b/node_modules/connect-ensure-login/lib/ensureLoggedIn.js @@ -0,0 +1,52 @@ +/** + * Ensure that a user is logged in before proceeding to next route middleware. + * + * This middleware ensures that a user is logged in. If a request is received + * that is unauthenticated, the request will be redirected to a login page (by + * default to `/login`). + * + * Additionally, `returnTo` will be be set in the session to the URL of the + * current request. After authentication, this value can be used to redirect + * the user to the page that was originally requested. + * + * Options: + * - `redirectTo` URL to redirect to for login, defaults to _/login_ + * - `setReturnTo` set redirectTo in session, defaults to _true_ + * + * Examples: + * + * app.get('/profile', + * ensureLoggedIn(), + * function(req, res) { ... }); + * + * app.get('/profile', + * ensureLoggedIn('/signin'), + * function(req, res) { ... }); + * + * app.get('/profile', + * ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }), + * function(req, res) { ... }); + * + * @param {Object} options + * @return {Function} + * @api public + */ +module.exports = function ensureLoggedIn(options) { + if (typeof options == 'string') { + options = { redirectTo: options } + } + options = options || {}; + + var url = options.redirectTo || '/login'; + var setReturnTo = (options.setReturnTo === undefined) ? true : options.setReturnTo; + + return function(req, res, next) { + if (!req.isAuthenticated || !req.isAuthenticated()) { + if (setReturnTo && req.session) { + req.session.returnTo = req.originalUrl || req.url; + } + return res.redirect(url); + } + next(); + } +} diff --git a/node_modules/connect-ensure-login/lib/ensureLoggedOut.js b/node_modules/connect-ensure-login/lib/ensureLoggedOut.js new file mode 100644 index 00000000..c7f7ae95 --- /dev/null +++ b/node_modules/connect-ensure-login/lib/ensureLoggedOut.js @@ -0,0 +1,43 @@ +/** + * Ensure that no user is logged in before proceeding to next route middleware. + * + * This middleware ensures that no user is logged in. If a request is received + * that is authenticated, the request will be redirected to another page (by + * default to `/`). + * + * Options: + * - `redirectTo` URL to redirect to in logged in, defaults to _/_ + * + * Examples: + * + * app.get('/login', + * ensureLoggedOut(), + * function(req, res) { ... }); + * + * app.get('/login', + * ensureLoggedOut('/home'), + * function(req, res) { ... }); + * + * app.get('/login', + * ensureLoggedOut({ redirectTo: '/home' }), + * function(req, res) { ... }); + * + * @param {Object} options + * @return {Function} + * @api public + */ +module.exports = function ensureLoggedOut(options) { + if (typeof options == 'string') { + options = { redirectTo: options } + } + options = options || {}; + + var url = options.redirectTo || '/'; + + return function(req, res, next) { + if (req.isAuthenticated && req.isAuthenticated()) { + return res.redirect(url); + } + next(); + } +} diff --git a/node_modules/connect-ensure-login/lib/index.js b/node_modules/connect-ensure-login/lib/index.js new file mode 100644 index 00000000..00dc3702 --- /dev/null +++ b/node_modules/connect-ensure-login/lib/index.js @@ -0,0 +1,10 @@ +/** + * Expose middleware. + */ +exports.ensureAuthenticated = +exports.ensureLoggedIn = require('./ensureLoggedIn'); + +exports.ensureUnauthenticated = +exports.ensureNotAuthenticated = +exports.ensureLoggedOut = +exports.ensureNotLoggedIn = require('./ensureLoggedOut'); diff --git a/node_modules/connect-ensure-login/package.json b/node_modules/connect-ensure-login/package.json new file mode 100644 index 00000000..3ac76b57 --- /dev/null +++ b/node_modules/connect-ensure-login/package.json @@ -0,0 +1,71 @@ +{ + "_from": "connect-ensure-login", + "_id": "connect-ensure-login@0.1.1", + "_inBundle": false, + "_integrity": "sha1-F03MUSQ7nqwj+NmCFa62aU4uihI=", + "_location": "/connect-ensure-login", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "connect-ensure-login", + "name": "connect-ensure-login", + "escapedName": "connect-ensure-login", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/connect-ensure-login/-/connect-ensure-login-0.1.1.tgz", + "_shasum": "174dcc51243b9eac23f8d98215aeb6694e2e8a12", + "_spec": "connect-ensure-login", + "_where": "/Users/carverme/code/unit4/project_four2", + "author": { + "name": "Jared Hanson", + "email": "jaredhanson@gmail.com", + "url": "http://www.jaredhanson.net/" + }, + "bugs": { + "url": "http://github.com/jaredhanson/connect-ensure-login/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Login session ensuring middleware for Connect.", + "devDependencies": { + "vows": "0.6.x" + }, + "engines": { + "node": ">= 0.4.0" + }, + "homepage": "https://github.com/jaredhanson/connect-ensure-login#readme", + "keywords": [ + "connect", + "express", + "auth", + "authn", + "authentication", + "login", + "session", + "passport" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "main": "./lib", + "name": "connect-ensure-login", + "repository": { + "type": "git", + "url": "git://github.com/jaredhanson/connect-ensure-login.git" + }, + "scripts": { + "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js" + }, + "version": "0.1.1" +} diff --git a/node_modules/dotenv/CHANGELOG.md b/node_modules/dotenv/CHANGELOG.md new file mode 100644 index 00000000..e604a474 --- /dev/null +++ b/node_modules/dotenv/CHANGELOG.md @@ -0,0 +1,96 @@ +# Change Log +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +## [5.0.0] - 2018-01-29 + +### Added + +- Testing against Node v8 and v9 +- Documentation on trim behavior of values +- Documentation on how to use with `import` + +### Changed + +- *Breaking*: default `path` is now `path.resolve(process.cwd(), '.env')` +- *Breaking*: does not write over keys already in `process.env` if the key has a falsy value +- using `const` and `let` instead of `var` + +### Removed + +- Testing aginst Node v7 + + +## [4.0.0] - 2016-12-23 +### Changed + +- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)). + + +### Removed + +- `verbose` option removed in favor of returning result. + + +## [3.0.0] - 2016-12-20 +### Added + +- `verbose` option will log any error messages. Off by default. +- parses email addresses correctly +- allow importing config method directly in ES6 + +### Changed + +- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154)) +- Ignoring more files for NPM to make package download smaller + +### Fixed + +- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124)) + +### Removed + +- `silent` option removed in favor of `verbose` + +## [2.0.0] - 2016-01-20 +### Added +- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README +- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README +- Testing nodejs v4 on travis-ci +- added examples of how to use dotenv in different ways +- return parsed object on success rather than boolean true + +### Changed +- README has shorter description not referencing ruby gem since we don't have or want feature parity + +### Removed +- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal + +## [1.2.0] - 2015-06-20 +### Added +- Preload hook to require dotenv without including it in your code + +### Changed +- clarified license to be "BSD-2-Clause" in `package.json` + +### Fixed +- retain spaces in string vars + +## [1.1.0] - 2015-03-31 +### Added +- Silent option to silence `console.log` when `.env` missing + +## [1.0.0] - 2015-03-13 +### Removed +- support for multiple `.env` files. should always use one `.env` file for the current environment + +[Unreleased]: https://github.com/motdotla/dotenv/compare/v5.0.0...HEAD +[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0 +[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0 +[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0 +[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0 +[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0 diff --git a/node_modules/dotenv/LICENSE b/node_modules/dotenv/LICENSE new file mode 100644 index 00000000..c430ad8b --- /dev/null +++ b/node_modules/dotenv/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Scott Motte +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/dotenv/README.md b/node_modules/dotenv/README.md new file mode 100644 index 00000000..c2cc1c99 --- /dev/null +++ b/node_modules/dotenv/README.md @@ -0,0 +1,261 @@ +# dotenv + +dotenv + +Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology. + +[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv) +[![Build status](https://ci.appveyor.com/api/projects/status/rnba2pyi87hgc8xw/branch/master?svg=true)](https://ci.appveyor.com/project/maxbeatty/dotenv/branch/master) +[![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) +[![Coverage Status](https://img.shields.io/coveralls/motdotla/dotenv/master.svg?style=flat-square)](https://coveralls.io/github/motdotla/dotenv?branch=coverall-intergration) + +## Install + +```bash +# with npm +npm install dotenv + +# or with Yarn +yarn add dotenv +``` + +## Usage + +As early as possible in your application, require and configure dotenv. + +```javascript +require('dotenv').config() +``` + +Create a `.env` file in the root directory of your project. Add +environment-specific variables on new lines in the form of `NAME=VALUE`. +For example: + +```dosini +DB_HOST=localhost +DB_USER=root +DB_PASS=s1mpl3 +``` + +That's it. + +`process.env` now has the keys and values you defined in your `.env` file. + +```javascript +const db = require('db') +db.connect({ + host: process.env.DB_HOST, + username: process.env.DB_USER, + password: process.env.DB_PASS +}) +``` + +### Preload + +You can use the `--require` (`-r`) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. This is the preferred approach when using `import` instead of `require`. + +```bash +$ node -r dotenv/config your_script.js +``` + +The configuration options below are supported as command line arguments in the format `dotenv_config_