Skip to content

Commit 14e65b9

Browse files
author
rpichioli
committed
Passport code dropped and finished repository - Will be in another repo
1 parent d8594c5 commit 14e65b9

File tree

24 files changed

+206
-566
lines changed

24 files changed

+206
-566
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
> **Status:** In development stage
22
3-
# react-with-sequelize-and-passport
3+
# react-with-nodejs-and-sequelize
44

55
### Summary
66
The main idea of this project is to create an application with relational database exposing data through API services using NodeJS + Express. The front-end uses React and Redux working directly with state that is filled by the NodeJS API.
77

8-
The registration layer has a simple login/logout feature made using HOC (High Order Component) in React-side that calls an authorization middleware in the API backend, as a layer, that authorizes the user to access all the stuff - if everything is OK.
9-
108
> - The **client-side** is a React + Redux app based.
119
> - The **server-side** is built in NodeJS (Express) and works like an API server.
1210
> - This application uses Sequelize ORM to manage relational database and maintain it's data.
13-
> - The [Passport](https://www.npmjs.com/package/passport) is basically an Express-compatible authentication middleware for Node.js.
14-
15-
The authentication process uses some features like [BCrypt](https://www.npmjs.com/package/bcrypt) and [JSONWebToken](https://www.npmjs.com/package/jsonwebtoken) to pass data through API encrypted and based in token, saved in storage to control in client-side state syncronized with Redux store and in server-side saved in NodeJS session.
16-
17-
The configuration files are located in config folder inside server scope. The token configurations are at `/server/config/secret.js` and Passport strategies at `/server/config/passport.js` individually.
1811
1912
I choose to use only [prop-types](https://www.npmjs.com/package/prop-types) to cover all data typing and obligation requirements in React Components, when it's necessary.
2013

client/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"classnames": "^2.2.5",
88
"history": "^4.7.2",
99
"jsonwebtoken": "^8.2.2",
10+
"jwt-decode": "^2.2.0",
1011
"lodash": "^4.17.10",
1112
"prop-types": "^15.6.1",
1213
"react": "^16.4.0",

client/src/actions/authentication.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

client/src/actions/user.js

Whitespace-only changes.

client/src/components/Authentication/LogIn.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

client/src/components/Menu.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ class Menu extends React.Component {
1414
<NavLink className="item" activeonlywhenexact="active" exact to="/bands">
1515
Nested CRUD (Bands and Albums)
1616
</NavLink>
17-
18-
<div class="right menu">
19-
<div class="item">
20-
<NavLink className="ui button" to="/log-in">Log in</NavLink>
21-
</div>
22-
<div class="item">
23-
<NavLink className="ui button blue" to="/sign-up">Sign Up</NavLink>
24-
</div>
25-
</div>
2617
</div>
2718
);
2819
}

client/src/components/User/SignUp.js

Lines changed: 0 additions & 81 deletions
This file was deleted.

client/src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import registerServiceWorker from './registerServiceWorker';
1818
// Root reducer to use in Redux Store
1919
import rootReducer from './reducers/rootReducer';
2020
// Actions
21-
import { setCurrentUser } from './actions/authActions';
21+
//import { setCurrentUser } from './actions/authActions';
2222
// The application, high order component
2323
import App from './components/App';
2424
// Application routes as external component
@@ -38,10 +38,10 @@ const store = createStore(
3838
);
3939

4040
// Verify if token exists and set it to request headers
41-
if (localStorage.jwtToken) {
42-
setAuthorizationToken(localStorage.jwtToken);
43-
store.dispatch(setCurrentUser(jwt.decode(localStorage.jwtToken)));
44-
}
41+
// if (localStorage.jwtToken) {
42+
// setAuthorizationToken(localStorage.jwtToken);
43+
// store.dispatch(setCurrentUser(jwt.decode(localStorage.jwtToken)));
44+
// }
4545

4646
ReactDOM.render(
4747
<Provider store={store}>

client/src/reducers/authentication.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)