-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f942721
commit ea8c6d6
Showing
12 changed files
with
4,411 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
package-lock.json | ||
/client/node_modules | ||
/client/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# Kanbanize | ||
Workflow Management Chrome Extension for the Atlassian Hack (IITM) | ||
# Login and registration with MERN stack | ||
|
||
 | ||
User Registration and Login functionality with validations using React, NodeJs, ExpressJs and MongoDB and authentication using passport and JWTs. | ||
|
||
Live Demo: https://mern-login-register.herokuapp.com/ | ||
|
||
This project uses the following technologies: | ||
|
||
- [React](https://reactjs.org) and [React Router](https://reacttraining.com/react-router/) for frontend | ||
- [Express](http://expressjs.com/) and [Node](https://nodejs.org/en/) for the backend | ||
- [MongoDB](https://www.mongodb.com/) for the database | ||
- [Redux](https://redux.js.org/basics/usagewithreact) for state management between React components | ||
|
||
## Reference via | ||
|
||
- [Build a Login/Auth App with the MERN Stack — Part 1 (Backend)](https://blog.bitsrc.io/build-a-login-auth-app-with-mern-stack-part-1-c405048e3669) | ||
|
||
|
||
## Quick Start | ||
|
||
``` | ||
// Install dependencies for server & client | ||
npm install && npm run client-install | ||
// Run client & server with concurrently | ||
npm run dev | ||
// Server runs on http://localhost:5000 and client on http://localhost:3000 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
mongoURI: "mongodb://localhost:27017/mern-auth", | ||
secretOrKey: "secret" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const JwtStrategy = require("passport-jwt").Strategy; | ||
const ExtractJwt = require("passport-jwt").ExtractJwt; | ||
const mongoose = require("mongoose"); | ||
const User = mongoose.model("users"); | ||
const keys = require("../config/keys"); | ||
|
||
const opts = {}; | ||
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken(); | ||
opts.secretOrKey = keys.secretOrKey; | ||
|
||
module.exports = passport => { | ||
passport.use( | ||
new JwtStrategy(opts, (jwt_payload, done) => { | ||
User.findById(jwt_payload.id) | ||
.then(user => { | ||
if (user) { | ||
return done(null, user); | ||
} | ||
return done(null, false); | ||
}) | ||
.catch(err => console.log(err)); | ||
}) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const mongoose = require("mongoose"); | ||
const Schema = mongoose.Schema; | ||
|
||
// Create Schema | ||
const UserSchema = new Schema({ | ||
name: { | ||
type: String, | ||
required: true | ||
}, | ||
email: { | ||
type: String, | ||
required: true | ||
}, | ||
password: { | ||
type: String, | ||
required: true | ||
}, | ||
date: { | ||
type: Date, | ||
default: Date.now | ||
} | ||
}); | ||
|
||
module.exports = mongoose.model("users", UserSchema); |
Oops, something went wrong.