Index: modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload.module.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload.module.ts	(nonexistent)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload.module.ts	(revision 48966)
@@ -0,0 +1,29 @@
+import { NgModule}            from '@angular/core';
+import { CommonModule }        from '@angular/common';
+import { FormsModule }         from '@angular/forms';
+import { RouterModule } from '@angular/router';
+
+import{ReloadRoutingModule } from './reload-routing.module';
+import{ReloadComponent} from './reload.component';
+
+
+ import {FreeGuard} from'../login/freeGuard.guard';
+import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
+
+@NgModule({
+  imports: [
+    CommonModule, FormsModule, RouterModule,
+      ReloadRoutingModule
+
+  ],
+  declarations: [
+    ReloadComponent
+   ],
+  providers:[
+    FreeGuard, PreviousRouteRecorder
+    ],
+  exports: [
+    ReloadComponent
+     ]
+})
+export class ReloadModule { }
Index: modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload-routing.module.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload-routing.module.ts	(nonexistent)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload-routing.module.ts	(revision 48966)
@@ -0,0 +1,16 @@
+import { NgModule } from '@angular/core';
+import { RouterModule } from '@angular/router';
+
+import{ReloadComponent} from './reload.component';
+import {FreeGuard} from'../login/freeGuard.guard';
+import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
+
+@NgModule({
+  imports: [
+    RouterModule.forChild([
+     	{ path: '', component: ReloadComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
+
+    ])
+  ]
+})
+export class ReloadRoutingModule { }
Index: modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload.component.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload.component.ts	(nonexistent)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/reload/reload.component.ts	(revision 48966)
@@ -0,0 +1,51 @@
+import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
+import {Observable}       from 'rxjs/Observable';
+import {ActivatedRoute, Router} from '@angular/router';
+import {Location} from '@angular/common';
+
+import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {ErrorCodes} from '../utils/properties/openaireProperties';
+import {RouterHelper} from '../utils/routerHelper.class';
+import {Session} from '../login/utils/helper.class';
+
+@Component({
+    selector: 'reload',
+    template: `
+    <div id="tm-main" class=" uk-section  uk-margin-small-top tm-middle"   >
+      <div uk-grid uk-grid>
+       <div class="tm-main uk-width-1-1@s uk-width-1-1@m  uk-width-1-1@l uk-row-first ">
+
+          <div class="uk-container uk-margin-top publication">
+            Go to initial page....
+          </div>
+        </div>
+      </div>
+    </div>
+     `
+})
+export class ReloadComponent {
+
+  constructor (
+    private route: ActivatedRoute,
+      private _router: Router,
+       private location: Location
+    ) {
+
+   }
+
+  public ngOnInit() {
+
+        var url = Session.getCurrentUrl();
+        if(url && url != null && url != ""){
+          Session.setCurrentUrl("");
+          var array = Session.getCurrentParameters();
+          Session.setCurrentParameters("");
+           this._router.navigate([url],{ queryParams: array});
+
+        }else{
+          this._router.navigate(['/']);
+
+        }
+  }
+
+}
Index: modules/uoa-services-portal/trunk/portal-2/src/app/login/utils/helper.class.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/login/utils/helper.class.ts	(revision 48965)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/login/utils/helper.class.ts	(revision 48966)
@@ -9,7 +9,7 @@
     id: string;
     fullname: string;
     expirationDate: number;
-    role:string;
+    role:string[];
     jwt:string;
 
 }
@@ -50,7 +50,7 @@
               loggedIn = false;
             }
           }else{
-            if(cookie != null && this.getUserFromCookie()!= null){
+            if(cookie != null && this.getUserFromCookie()!= null){              
                loggedIn = true
             }else{
               loggedIn = false;
@@ -68,7 +68,7 @@
       var user:User = MyJWT.parseUserInfo(cookie);
        if( typeof localStorage !== 'undefined') {
          localStorage.setItem("user", JSON.stringify(user));
-         if(user && user.email){
+         if(user && user.email && Session.isRegisteredUser()){
            COOKIE.deleteCookie(COOKIE.cookieName_u); // delete cookie to avoid transfer through requests
            return user;
          }else{
@@ -97,12 +97,67 @@
       }
 
   }
+  public static getCurrentUrl():string {
+    if( typeof localStorage !== 'undefined') {
+        return localStorage.getItem("url");
+    }
+    return "";
+
+    }
+  public static setCurrentUrl(url:string) {
+        if( typeof localStorage !== 'undefined') {
+          localStorage.setItem("url", url);
+        }
+  }
+  public static getCurrentParameters():any {
+    if( typeof localStorage !== 'undefined') {
+      var params = localStorage.getItem("params");
+       var object= {};
+      for(var i=0; i<params.split("&").length; i++){
+        object[(params.split("&")[i]).split("=")[0]] = (params.split("&")[i]).split("=")[1];
+      }
+      return object;
+    }
+    return {};
+  }
+  public static setCurrentParameters(params:string) {
+    if( typeof localStorage !== 'undefined') {
+         localStorage.setItem("params",(params && params.length > 1)? params.substring(1):"");
+       }
+  }
   public static isAdminUser():boolean {
+      var isAdmin = false;
       if(Session.isLoggedIn()){
-          return (Session.getUser().role == '2');
+        var claimRoles = ["urn:mace:openminted.eu:aai.openminted.eu:group:OpenAIRE+Curator+-+Claim","urn:mace:openminted.eu:aai.openminted.eu:group:OpenAIRE+Portal+Administrator"]
+
+        for (var i = 0; i < claimRoles.length; i++) {
+            if ((Session.getUser().role).indexOf(claimRoles[i]) > -1) {
+                isAdmin = true;
+                break;
+            }
+        }
+          // console.log("Is admin:"+ isAdmin)
+          return (isAdmin);
       }
-
+      // console.log("Is admin:"+ isAdmin)
+      return (isAdmin);
   }
+  public static isRegisteredUser():boolean {
+      var isRegisteredUser = false;
+      if(Session.isLoggedIn()){
+        var claimRoles = ["urn:mace:openminted.eu:aai.openminted.eu:group:Registered+User"];
+        for (var i = 0; i < claimRoles.length; i++) {
+            if ((Session.getUser().role).indexOf(claimRoles[i]) > -1) {
+                isRegisteredUser = true;
+                break;
+            }
+        }
+          // console.log("Is isRegisteredUser:"+ isRegisteredUser)
+          return (isRegisteredUser);
+      }
+      // console.log("Is isRegisteredUser:"+ isRegisteredUser)
+      return (isRegisteredUser);
+  }
   public static isUserValid() {
     if(Session.isLoggedIn()){
         var expires = Session.getUser().expirationDate;
@@ -150,7 +205,9 @@
       user.email = info.email;
       // user.id = info.userId;
       user.fullname = (StringUtils.URIDecode(info.fullname)).replace("+"," ");
-      user.role = info.role;;
+      user.role =JSON.parse( StringUtils.URIDecode(info.role));
+      // console.log("User Role is:");
+      // console.log(user.role)
       user.jwt = data;
       user.expirationDate = info.exp;
       localStorage.setItem("user", JSON.stringify(user));
Index: modules/uoa-services-portal/trunk/portal-2/src/app/login/userMini.component.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/login/userMini.component.ts	(revision 48965)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/login/userMini.component.ts	(revision 48966)
@@ -6,6 +6,7 @@
 import {User,Session} from './utils/helper.class';
 import {RouterHelper} from '../utils/routerHelper.class';
 import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {StringUtils} from '../utils/string-utils.class';
 
 @Component({
     selector: 'user-mini',
@@ -16,7 +17,7 @@
   <a   *ngIf="loggedIn" >
        <span>{{user.fullname+" "}} <span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9.9" cy="6.4" r="4.4"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2"></path></svg></span></span>
      </a>
-         <a  *ngIf="!loggedIn" class="loginLink" [href]="loginUrl"  >Sign in | Register <span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9.9" cy="6.4" r="4.4"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2"></path></svg> </span>
+         <a  *ngIf="!loggedIn" class="loginLink" (click)="logIn()" >Sign in | Register <span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9.9" cy="6.4" r="4.4"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2"></path></svg> </span>
        </a>
 
 
@@ -40,7 +41,7 @@
       <span>{{user.fullname+" "}}<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9.9" cy="6.4" r="4.4"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2"></path></svg></span></span>
     </span>
     <span  *ngIf="!loggedIn">
-        <a  class="loginLink" [href]="loginUrl"  >Sign in | Register <span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9.9" cy="6.4" r="4.4"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2"></path></svg></span>
+        <a  class="loginLink" (click)="logIn()" >Sign in | Register <span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9.9" cy="6.4" r="4.4"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2"></path></svg></span>
         </a>
    </span>
 
@@ -62,7 +63,6 @@
     @Input() public mobileView:boolean = false ;
     public server: boolean = true;
     public routerHelper:RouterHelper = new RouterHelper();
-    public loginUrl= OpenaireProperties.getLoginURL();
 
     public redirectUrl: string = "";
     private baseUrl = "user-info";
@@ -92,6 +92,7 @@
            }else {
                  this.isAuthorized = false;
            }
+
         }else{
           Session.removeUser();
             this.loggedIn = false;
@@ -116,7 +117,8 @@
     logOut(){
       if(Session.isLoggedIn()){
         Session.removeUser();
-        window.location.href = OpenaireProperties.getLogoutURL()+ location.href;
+        console.log("Redirect to "+location.href);
+        window.location.href = OpenaireProperties.getLogoutURL()+ StringUtils.URIEncode(location.href);
 
       }
       this.loggedIn = false;
@@ -124,6 +126,12 @@
       this.user = new User();
     }
 
+    logIn(){
+      Session.setCurrentUrl(location.pathname);
+      Session.setCurrentParameters(location.search);
+      window.location.href = OpenaireProperties.getLoginURL();
+    }
+
     onClick(id: string) {
           var el: HTMLElement = document.getElementById(id);
           el.classList.remove('uk-open');
Index: modules/uoa-services-portal/trunk/portal-2/src/app/app-routing.module.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/app/app-routing.module.ts	(revision 48965)
+++ modules/uoa-services-portal/trunk/portal-2/src/app/app-routing.module.ts	(revision 48966)
@@ -148,6 +148,10 @@
   return System.import('./login/user.module' + (process.env.AOT ? '.ngfactory' : ''))
     .then(mod => mod[(process.env.AOT ? 'UserModuleNgFactory' : 'UserModule')]);
 }
+export function getReloadModule() {
+  return System.import('./reload/reload.module' + (process.env.AOT ? '.ngfactory' : ''))
+    .then(mod => mod[(process.env.AOT ? 'ReloadModuleNgFactory' : 'ReloadModule')]);
+}
 @NgModule({
   imports: [
     RouterModule.forChild([
@@ -187,6 +191,7 @@
       { path: 'participate/direct-claim', loadChildren: getDirectLinkingModule },
       { path: 'claims-project-manager', loadChildren: getClaimsByTokenModule },
       { path: 'user-info', loadChildren: getUserModule },
+      { path: 'reload', loadChildren: getReloadModule },
 
     ])
   ],
Index: modules/uoa-services-portal/trunk/portal-2/src/server.routes.ts
===================================================================
--- modules/uoa-services-portal/trunk/portal-2/src/server.routes.ts	(revision 48965)
+++ modules/uoa-services-portal/trunk/portal-2/src/server.routes.ts	(revision 48966)
@@ -17,7 +17,7 @@
   'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'participate/deposit-subject-result',
   'search/content-providers','search/content-providers-table','search/entity-registries','search/entity-registries-table','search/journals','search/journals-table',
   'project-report', 'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager',
-  'test', 'user-info',
+  'test', 'user-info', 'reload',
   '**','error'
 
 ];
