Wiser-Frontend Developer Test completed By Tian Liu - #12
hnamdev008 wants to merge 3 commits into
Conversation
Test code-base complete
Updated README
johnfedoruk
left a comment
There was a problem hiding this comment.
Automated Testing:
- Lint: fails
- Test: fails
- Coverage: fails
- Build: fails
Manual Review
- No demonstration of Angular animation implementation
- Good use of services
- Has auth guards
- No readme describing changes
- Good use of form logic
- No lazy loading
- No application modules
- Has shared module for auth service
- Authentication broken (refresh doesn't work)
- Using promises, but no async
- Use of local storage for a JWT is a security vulnerability.
- Good directory structure
- Would like to see more typescript features (privacy modifiers / return types / type setting)
| "tslint": "~5.9.1", | ||
| "typescript": "~2.5.3" | ||
| "typescript": "~2.5.3", | ||
| "jwt-decode": "2.2.0", |
| }, | ||
| { | ||
| path: 'secure', | ||
| component: SecureComponent, |
There was a problem hiding this comment.
This is supposed to be lazy loaded
| path: 'error/:status_code', | ||
| component: ErrorComponent | ||
| }, | ||
| { |
There was a problem hiding this comment.
The paths /auth/login and auth/logout are supposed to be handled by a distinct application module
| { | ||
| path: 'secure', | ||
| component: SecureComponent, | ||
| canActivate: [AuthGuard] |
| #password="ngModel" | ||
| id="password" | ||
| class="w3-input ng-untouched ng-pristine ng-valid" name="password" type="password" /> | ||
| <div [hidden]="password.valid || password.pristine" class="alert alert-danger"> |
| export class AuthService { | ||
|
|
||
| _baseURL = "https://dev-test-service.madebywiser.com"; | ||
| _userName = ""; |
There was a problem hiding this comment.
Should have a privacy modifier of private
| @Injectable() | ||
| export class AuthService { | ||
|
|
||
| _baseURL = "https://dev-test-service.madebywiser.com"; |
There was a problem hiding this comment.
Should have a privacy modifier of private
| localStorage.setItem(username, JSON.stringify({ username: username, token: data })); | ||
|
|
||
| this.profile$.next({ | ||
| username: username; |
There was a problem hiding this comment.
Using semi-colons does not comply with JSON standards.
| .then((data)=> | ||
| { | ||
| this._userName = username; | ||
| localStorage.setItem(username, JSON.stringify({ username: username, token: data })); |
There was a problem hiding this comment.
Using localStorage is a security vulnerability - should be using sessionStorage
| private authService: AuthService) {} | ||
|
|
||
| canActivate() { | ||
| if (!this.authService.isTokenExpired()) { |
There was a problem hiding this comment.
This does nothing to help in the situation in which the window is refreshed. Also, it doesn't validate that the token has been signed by the server after performing a login.
No description provided.