Giter Site home page Giter Site logo

sequelize-passport-example's Introduction

Sequelize with Passport (local strategy)

This is based on the sequelize / passport local strategy example from class...now using express's new method router() to organize routes!

Changes

  • Fixed a bug in the old boilerplate that leaked hashed passwords to the front end
  • Routes now use express.router to separate concerns

How to Use

  1. Clone this repository to your local machine
  2. In MySQL Workbench, create a blank database named whatever you'd like
  3. In the root of the project directory, create a file called .env
  4. Inside .env, put your database information in the following format:
DB_USER_LOCAL=yoursqlaccount
DB_PASSWORD_LOCAL=yourdevpassword
DB_DATABASE_LOCAL=yourdbnmae
DB_HOST_LOCAL=localhost
DB_USER_TEST=yourtestsqlaccount
DB_PASSWORD_TEST=yourtestpassword
DB_DATABASE_TEST=yourtestdbname
DB_HOST_TEST=localhost
SESSION_KEY=arandompasswordmadeupbyyou

How to Protect Routes

  • If a user is logged in, there will be an object req.user available within every function(req, res) {} that you write! You can check if(req.user) to see if someone is logged in
  • To figure out which SPECIFIC user is logged in, check the value of req.user.id.

Suggestions

  • Take a look at the existing html files. They're pretty bare bones! What additional form validation could you add for login and signup? What about custom error handling?
  • Hint: take a look at the error object that comes to the front end. It may not be a standard format Error object.
  • Note: password reset is its own kettle of wax! For this project, it would be okay not to add a reset route -- or you can do some research and figure it out :)

Additional Resources

sequelize-passport-example's People

Contributors

kmtenhouse avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.