bomber-team / web-bomber

Load Testing system with gamification web-part
GNU General Public License v3.0
0 stars 0 forks source link

Add checking authenticated user in localstorage #14

Closed kubitre closed 5 years ago

kubitre commented 5 years ago

https://github.com/kostya05983/web-bomber/blob/5be7f1500f274db0dfc6a98a6a7e461fc0ea11e9/src/store/Auth/reducer.js#L26

There is you should add checking auth token in localstorage such as like this:

function IsAuthentificatedLS(){
   let token = window.localStorage.getItem("token");
   if (token !== null ) {
     return true;
   }
   return false;
}
kubitre commented 5 years ago

In line https://github.com/kostya05983/web-bomber/blob/5be7f1500f274db0dfc6a98a6a7e461fc0ea11e9/src/store/Auth/reducer.js#L26

you should call the function IsAuthentificatedLS:

return {...state, isAuthentificated:  IsAuthentificatedLS()}
kubitre commented 5 years ago

For the maintain security, it would be nice to also validate the token on the server side in order to exclude the possibility of token substitution. Therefore, we should add function for send LS token to backend and response validation status of our information use for set to state Auth