Project

General

Profile

« Previous | Next » 

Revision 51275

fixed login

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/register-datasource-shareable.component.html
46 46
                      <span>
47 47
                        {{ repo.officialName }}
48 48
                        <span *ngIf="repo.registered" class="uk-label uk-label-warning registeredLabel">Registered</span>
49
                        <a target="_blank" href="{{repo.websiteUrl }}">
49
                        <a target="_blank" href="{{repo.websiteUrl }}" [ngStyle]="">
50 50
                          <i class="fa fa-external-link externalLink"></i>
51 51
                        </a>
52
                        <button class="uk-float-right uk-vertical-align-middle">BOOM</button>
52
                        <button class="uk-float-right uk-vertical-align-middle">NEXT</button>
53 53
                      </span>
54 54
                    </label>
55 55
                  </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-create-form.component.ts
229 229
    newRepo.issn = this.group.get('issn').value;
230 230
    newRepo.eissn = this.group.get('eissn').value;
231 231
    newRepo.lissn = this.group.get('lissn').value;
232
    newRepo.registeredBy = this.authService.userEmail;
232
    newRepo.registeredBy = this.authService.getUserEmail();
233 233
    newRepo.datasourceType = this.mode;
234 234

  
235 235
    newRepo.dateOfCreation = new Date(Date.now()); //is this correct ?????
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-enable.component.ts
91 91
        siteId: `${this.analyticsUrl}siteName=${this.repo.officialName}&url=${this.repo.websiteUrl}`,
92 92
        authenticationToken: this.authenticationToken,
93 93
        creationDate: null,
94
        requestorName: this.authService.userFullName,
95
        requestorEmail: this.authService.userEmail,
94
        requestorName: this.authService.getUserName(),
95
        requestorEmail: this.authService.getUserEmail(),
96 96
        validated: false,
97 97
        validationDate: null,
98 98
        comment: ''
modules/uoa-repository-dashboard-gui/trunk/app/pages/home/home.component.html
1
<div *ngIf="!authService.isLoggedIn">
1
<div *ngIf="!getIsUserLoggedIn()">
2 2
  <div class="image-front-topbar  uk-section-default"
3 3
       uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
4 4
    <div style="background-image: url('../../../assets/imgs/provide_2.jpg'); background-color: rgb(255, 255, 255); box-sizing: border-box; min-height: calc(-101.35px + 100vh);" class="uk-background-norepeat uk-background-cover uk-background-top-center uk-background-fixed uk-section uk-padding-remove-bottom uk-flex uk-flex-middle" uk-height-viewport="offset-top: true;offset-bottom: 20">
......
217 217

  
218 218
</div>
219 219

  
220
<div *ngIf="authService.isLoggedIn" id="contentWrapper" class="tm-main uk-section uk-section-default" uk-height-viewport="expand: true" style="box-sizing: border-box;" >
220
<div *ngIf="getIsUserLoggedIn()" id="contentWrapper" class="tm-main uk-section uk-section-default" uk-height-viewport="expand: true" style="box-sizing: border-box;" >
221 221

  
222 222
  <div>
223 223
    <div class="uk-container">
modules/uoa-repository-dashboard-gui/trunk/app/pages/home/home.component.ts
1
import {Component, OnInit} from '@angular/core';
2
import {AuthenticationService} from '../../services/authentication.service';
3
import { ActivatedRoute, Router } from '@angular/router';
1
import { Component, OnInit } from '@angular/core';
2
import { AuthenticationService } from '../../services/authentication.service';
4 3

  
4

  
5 5
@Component ({
6 6
  selector: 'app-home',
7 7
  templateUrl: 'home.component.html'
......
9 9

  
10 10
export class HomeComponent implements OnInit {
11 11

  
12
  constructor(private authService: AuthenticationService, private router: Router, private route: ActivatedRoute) { }
12
  constructor(private authService: AuthenticationService) { }
13 13

  
14 14
  ngOnInit() {}
15 15

  
16
  getIsUserLoggedIn() {
17
    return this.authService.getIsUserLoggedIn();
18
  }
16 19
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility-validate-type.component.ts
255 255
      cris: isCris,
256 256
      crisReferentialChecks: this.crisRefIntegrity,
257 257

  
258
      userEmail: this.authService.userEmail,
258
      userEmail: this.authService.getUserEmail(),
259 259

  
260 260
      adminEmails: [],
261 261
      officialName: '',
modules/uoa-repository-dashboard-gui/trunk/app/pages/content/content-events-of-repo-eventslist.component.ts
57 57
               private authService: AuthenticationService) {}
58 58

  
59 59
  ngOnInit () {
60
    this.userEmail = this.authService.userEmail;
60
    this.userEmail = this.authService.getUserEmail();
61 61
    this.getParams();
62 62
    this.initQuery();
63 63
    this.initForm();
modules/uoa-repository-dashboard-gui/trunk/app/pages/content/content-notifications.component.ts
30 30

  
31 31
  getSubscriptions() {
32 32
    this.loadingMessage = loadingSubscriptions;
33
    this.brokerService.getSimpleSubscriptionsOfUser(this.authService.userEmail).subscribe(
33
    this.brokerService.getSimpleSubscriptionsOfUser(this.authService.getUserEmail()).subscribe(
34 34
      subscrs => this.subscrOfUser = subscrs,
35 35
      error => {
36 36
        console.log(error);
modules/uoa-repository-dashboard-gui/trunk/app/services/authentication.service.ts
4 4
import { deleteCookie, getCookie } from '../domain/utils';
5 5
import { Http } from '@angular/http';
6 6
import { User } from '../domain/typeScriptClasses';
7
import {CookieService} from "angular2-cookie/core";
8 7

  
9 8
@Injectable()
10 9
export class AuthenticationService {
11 10

  
12 11
  constructor(private route: ActivatedRoute,
13 12
              private router: Router,
14
              private http: Http,
15
              private _cookie: CookieService) {}
13
              private http: Http) {}
16 14

  
17 15
  private loginUrl : string = loginUrl;
18 16
  private apiUrl : string = apiUrl;
......
34 32
    window.location.href = this.loginUrl;
35 33
  }
36 34

  
37
  login(user: User){
38
    localStorage.setItem('user', JSON.stringify(user));
39
    this.isLoggedIn = true;
40
    this.userEmail = localStorage.getItem('email');
41
    this.userFullName = localStorage.getItem('name');
42
    this.userRole = localStorage.getItem('role');
43
  }
44

  
45
  logout(){
35
  public logout(){
46 36
    deleteCookie('currentUser');
47 37
    sessionStorage.removeItem('name');
48 38
    sessionStorage.removeItem('email');
49 39
    sessionStorage.removeItem('role');
40
    this.isLoggedIn = false;
50 41
    this.router.navigate(['/home']);
42
    window.location.replace(`https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=${this.router.url}`);
51 43
  }
52 44

  
53 45
  public tryLogin() {
54

  
55 46
    if(getCookie('currentUser')) {
56 47
      console.log(`I got the cookie!`);
57 48
      this.http.get(this.apiUrl + '/user/login',{ withCredentials: true }).subscribe(
......
87 78
    }
88 79
  }
89 80

  
90
    public getIsUserLoggedIn() {
91
      return this.isLoggedIn;
92
    }
81
  public getIsUserLoggedIn() {
82
    return this.isLoggedIn;
83
  }
93 84

  
94
    public getUserName() {
95
      if (this.isLoggedIn)
96
        return sessionStorage.getItem('name');
97
    }
85
  public getUserName() {
86
    if (this.isLoggedIn)
87
      return sessionStorage.getItem('name');
88
  }
98 89

  
99
    public getUserEmail() {
100
      if (this.isLoggedIn)
101
        return sessionStorage.getItem('email');
102
    }
90
  public getUserEmail() {
91
    if (this.isLoggedIn)
92
      return sessionStorage.getItem('email');
93
  }
103 94

  
104
    public getUserRole() {
105
      if (this.isLoggedIn)
106
        return sessionStorage.getItem('role');
107
    }
95
  public getUserRole() {
96
    if (this.isLoggedIn)
97
      return sessionStorage.getItem('role');
98
  }
108 99

  
109 100
}
modules/uoa-repository-dashboard-gui/trunk/app/app.component.ts
13 13
export class AppComponent implements OnInit {
14 14

  
15 15
  constructor(private router: Router,private authService: AuthenticationService) {
16

  
16 17
    // URL of the SPA to redirect the user to after login
17 18
    this.authService.redirectUrl = "/home";
18 19

  
19
/*    // The SPA's id. The SPA is registerd with this id at the auth-server
20
    this.authService.clientId = "dfd9f71e-2d7e-41a7-a9c5-bc27cc815868";
21

  
22
    // set the scope for the permissions the client should request
23
    // The first three are defined by OIDC. The 4th is a usecase-specific one
24
    this.authService.scope = "openid";
25

  
26
    // The name of the auth-server that has to be mentioned within the token
27
    this.authService.loginUrl = "https://aai.openminted.eu/oidc/authorize";*/
28

  
29 20
    this.authService.tryLogin();
30

  
31 21
  }
32 22

  
33

  
34 23
  ngOnInit() {
35 24
    this.router.events.subscribe((evt) => {
36 25
      if (!(evt instanceof NavigationEnd)) {
modules/uoa-repository-dashboard-gui/trunk/app/shared/topmenu/topmenu.component.html
104 104

  
105 105
            <!-- THERE WAS COMMENTED SCRIPT HERE - CHECK REPOSITORYMANAGER.HTML -->
106 106

  
107
            <div class="uk-navbar-center" *ngIf="isLoggedIn">
107
            <div class="uk-navbar-center" *ngIf="getIsUserLoggedIn()">
108 108

  
109 109
              <ul class="uk-navbar-nav">
110 110
                <li class="uk-parent" [routerLinkActive]="['uk-active']">
......
164 164
            </div>
165 165
            <div class="uk-navbar-right">
166 166

  
167
              <ul *ngIf="!authService.isLoggedIn" class="uk-navbar-nav">
167
              <ul *ngIf="!getIsUserLoggedIn()" class="uk-navbar-nav">
168 168
                <li class="uk-parent">
169 169
                  <a class="loginLink" (click)="login()">
170 170
                    <span class="uk-margin-small-right uk-icon">
......
178 178
                </li>
179 179
              </ul>
180 180

  
181
              <ul *ngIf="authService.isLoggedIn" class="uk-navbar-nav">
181
              <ul *ngIf="getIsUserLoggedIn()" class="uk-navbar-nav">
182 182
                <li class="uk-parent">
183 183
                  <a class="loginLink" aria-expanded="false">
184 184
                    <span class="uk-margin-small-right uk-icon">
modules/uoa-repository-dashboard-gui/trunk/app/shared/topmenu/topmenu.component.ts
12 12
})
13 13

  
14 14
export class TopMenuComponent implements OnInit {
15
  isLoggedIn: boolean;
16 15

  
17 16
  constructor(public authService: AuthenticationService) { }
18 17

  
19
  ngOnInit(){
20
    this.isLoggedIn = false;
21
  }
18
  ngOnInit() {}
22 19

  
23 20

  
24 21
  onClick(id: string) {
......
32 29
  }
33 30

  
34 31
  logout(){
35
    if(this.authService.isLoggedIn){
32
    if(this.getIsUserLoggedIn()){
36 33
      this.authService.logout();
37
      this.isLoggedIn = false;
38 34
    }
39 35
  }
40 36

  
41 37
  register(){
42 38
    this.authService.loginWithState();
43
    this.isLoggedIn = true;
44 39
  }
45 40

  
46 41
  getUserName() {
47 42
    return this.authService.getUserName();
48 43
  }
44

  
45
  getIsUserLoggedIn() {
46
    return this.authService.getIsUserLoggedIn();
47
  }
49 48
}
modules/uoa-repository-dashboard-gui/trunk/app/domain/tempAPI.ts
1 1
/* export const apiUrl = 'http://195.134.66.230:8380/uoa-repository-manager-service'; */
2 2
/* export const apiUrl = 'http://194.177.192.121:8380/uoa-repository-manager-service';*/
3
/*export const apiUrl = 'http://194.177.192.121:8380/repomanager-service-dev';*/
4
export const apiUrl = 'http://195.134.66.230:8380/repomanager-service-dev';
5
/*export const loginUrl = 'http://194.177.192.121:8380/repomanager-service-dev/openid_connect_login';*/
6
export const loginUrl = 'http://195.134.66.230:8380/repomanager-service-dev/openid_connect_login';
3
export const apiUrl = 'http://194.177.192.121:8380/repomanager-service-dev';
4
/*export const apiUrl = 'http://195.134.66.230:8380/repomanager-service-dev';*/
5
export const loginUrl = 'http://194.177.192.121:8380/repomanager-service-dev/openid_connect_login';
6
/*export const loginUrl = 'http://195.134.66.230:8380/repomanager-service-dev/openid_connect_login';*/
modules/uoa-repository-dashboard-gui/trunk/app/app.module.ts
1 1
/**
2 2
 * Created by stefania on 10/3/16.
3 3
 */
4
import {NgModule} from '@angular/core';
5
import {BrowserModule} from '@angular/platform-browser';
6
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
7
import {HttpModule, JsonpModule} from '@angular/http';
4
import { NgModule } from '@angular/core';
5
import { BrowserModule } from '@angular/platform-browser';
6
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
7
import { HttpModule, JsonpModule } from '@angular/http';
8 8

  
9
import {TabsModule, ModalModule} from 'ngx-bootstrap';
9
import { TabsModule, ModalModule } from 'ngx-bootstrap';
10 10

  
11
import {AppRouting} from './app.routing';
12
import {AppComponent} from './app.component';
13
import {UserModule} from './user/user.module';
14
import {HomeComponent} from './pages/home/home.component';
15
import {TopMenuComponent} from './shared/topmenu/topmenu.component';
16
import {FooterComponent} from './shared/footer/footer.component';
17
import {MetricsModule} from './pages/metrics/metrics.module';
18
import {SourcesModule} from './pages/sources/sources.module';
19
import {CompatibilityModule} from './pages/compatibility/compatibility.module';
20
import {ContentModule} from './pages/content/content.module';
21
import {AdminPgModule} from './pages/adminPg/adminPg.module';
22
import {RepositoryService} from "./services/repository.service";
23
import {AuthenticationService} from './services/authentication.service';
24
import {AuthGuardService} from './services/auth-guard.service';
11
import { AppRouting } from './app.routing';
12
import { AppComponent } from './app.component';
13
import { UserModule } from './user/user.module';
14
import { HomeComponent } from './pages/home/home.component';
15
import { TopMenuComponent } from './shared/topmenu/topmenu.component';
16
import { FooterComponent } from './shared/footer/footer.component';
17
import { MetricsModule } from './pages/metrics/metrics.module';
18
import { SourcesModule } from './pages/sources/sources.module';
19
import { CompatibilityModule } from './pages/compatibility/compatibility.module';
20
import { ContentModule } from './pages/content/content.module';
21
import { AdminPgModule } from './pages/adminPg/adminPg.module';
22
import { RepositoryService } from "./services/repository.service";
23
import { AuthenticationService } from './services/authentication.service';
24
import { AuthGuardService } from './services/auth-guard.service';
25 25
import { ValidatorService } from './services/validator.service';
26 26
import { PiwikService } from './services/piwik.service';
27 27
import { BrokerService } from './services/broker.service';
28 28
import { MonitorService } from './services/monitor.service';
29
import { ReusableComponentsModule } from './shared/reusablecomponents/reusable-components.module';
30
import { HelpContentService } from './services/help-content.service';
31
import {CookieService} from "angular2-cookie/core";
32 29

  
33 30

  
34 31
@NgModule({
......
63 60
    RepositoryService,
64 61
    ValidatorService,
65 62
    AuthGuardService,
66
    AuthenticationService,
67
    CookieService
63
    AuthenticationService
68 64
  ],
69 65
  bootstrap: [AppComponent]
70 66
})
71 67

  
72
export class AppModule {
73
}
68
export class AppModule {}
modules/uoa-repository-dashboard-gui/trunk/package.json
9 9
    "deploy:server": "docker rm -f uoa-repository-dashboard-gui && docker run --name uoa-repository-dashboard-gui -d -p 80:80 uoa-repository-dashboard-gui",
10 10
    "deploy:complete": "npm run build:docker && npm run deploy:server",
11 11
    "watch": "npm run build -- --watch",
12
    "server": "webpack-dev-server --inline --progress --port 3000 --host 195.134.66.230 --content-base .",
12
    "server": "webpack-dev-server --inline --progress --port 3000 --content-base .",
13 13
    "start": "npm run server",
14 14
    "stats": "webpack --progress -p --profile --env.release=true --json > stats.json"
15 15
  },
......
25 25
    "@angular/upgrade": "~4.4.3",
26 26
    "angular-in-memory-web-api": "~0.3.2",
27 27
    "angular-oauth2-oidc": "^1.0.20",
28
    "angular2-cookie": "^1.2.6",
29 28
    "bootstrap": "^3.3.7",
30 29
    "bootstrap-slider": "^10.0.0",
31 30
    "core-js": "^2.5.3",
modules/uoa-repository-dashboard-gui/trunk/package-lock.json
1316 1316
        "sha256": "0.2.0"
1317 1317
      }
1318 1318
    },
1319
    "angular2-cookie": {
1320
      "version": "1.2.6",
1321
      "resolved": "https://registry.npmjs.org/angular2-cookie/-/angular2-cookie-1.2.6.tgz",
1322
      "integrity": "sha1-j6hFUx53etsEL+LzOcAED23b8J0="
1323
    },
1324 1319
    "angular2-router-loader": {
1325 1320
      "version": "0.3.5",
1326 1321
      "resolved": "https://registry.npmjs.org/angular2-router-loader/-/angular2-router-loader-0.3.5.tgz",

Also available in: Unified diff