[Library]: Fix isLogged in function
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57075 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
7955acd2bc
commit
a77afb15c9
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Route, CanLoad} from '@angular/router';
|
import {ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterStateSnapshot} from '@angular/router';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Session} from './utils/helper.class';
|
import {Session} from './utils/helper.class';
|
||||||
import {LoginErrorCodes} from './utils/guardHelper.class';
|
import {LoginErrorCodes} from './utils/guardHelper.class';
|
||||||
|
|
|
@ -23,19 +23,10 @@ export class Session{
|
||||||
return this.getUserFromCookie();
|
return this.getUserFromCookie();
|
||||||
}
|
}
|
||||||
public static isLoggedIn(): boolean {
|
public static isLoggedIn(): boolean {
|
||||||
var loggedIn:boolean = false;
|
|
||||||
var user:User = null;
|
|
||||||
var cookie= COOKIE.getCookie(COOKIE.cookieName_id);
|
var cookie= COOKIE.getCookie(COOKIE.cookieName_id);
|
||||||
if(cookie == null ||cookie == ""){
|
return (cookie != null && cookie != "");
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
var user:User = this.getUserFromCookie();
|
|
||||||
if(user ==null){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getUserFromCookie():User{
|
public static getUserFromCookie():User{
|
||||||
var cookie= COOKIE.getCookie(COOKIE.cookieName_u);
|
var cookie= COOKIE.getCookie(COOKIE.cookieName_u);
|
||||||
if(cookie != null && cookie!=""){
|
if(cookie != null && cookie!=""){
|
||||||
|
|
Loading…
Reference in New Issue