src/app/auth/auth.service.ts
Service for user authentication on the SWIM platform
Properties |
|
Methods |
constructor(http: HttpClient, http2: HttpClient, router: Router, handler: HttpBackend)
|
||||||||||||||||||||
Class contructor
Parameters :
|
autoLogin |
autoLogin()
|
renew login
Returns :
void
|
autoLogout | ||||||||
autoLogout(expirationDuration: number)
|
||||||||
Logout when token expires
Parameters :
Returns :
void
|
changePassword |
changePassword(oldP: string, newP: string)
|
Change password of conected user
Returns :
any
|
guest |
guest()
|
Auto login guest user
Returns :
void
|
guestLogin | ||||||
guestLogin(isGuest: boolean)
|
||||||
On submit login Dev endpoint: http://localhost:3000/api/authenticate
Parameters :
Returns :
any
|
Private handleAuthentication | ||||||||||||||||||||||||||||||||
handleAuthentication(email: string, token: string, expiresIn: number, id: number, isGuest: boolean, role?: string, isCont?: boolean)
|
||||||||||||||||||||||||||||||||
Call authentication mechanism
Parameters :
Returns :
void
|
Private handleError | ||||||||
handleError(errorRes: any)
|
||||||||
Handle authentication errors
Parameters :
Returns :
any
|
login | ||||||||||||
login(email: string, password: string)
|
||||||||||||
On submit login Dev endpoint: http://localhost:3000/api/authenticate
Parameters :
Returns :
any
|
logout |
logout()
|
Logout from the system but leaves guest account open
Returns :
void
|
removeCredentials |
removeCredentials()
|
Remove user credentials without auto guest login
Returns :
void
|
signup | ||||||||||||||||||||||||||||||||
signup(email: string, password: string, firstname: string, lastname: string, institution?: string, department?: string, role?: string)
|
||||||||||||||||||||||||||||||||
Self registration form for SWIM
Parameters :
Returns :
any
|
Private tokenExpirationTimer |
Type : any
|
Token expiration timer |
user |
Default value : new BehaviorSubject<User>(null)
|
Monitor changes in user information |