Project

General

Profile

« Previous | Next » 

Revision 59472

[Library | Trunk]: User mini change conditions of redirect url

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/login/userMini.component.ts
12 12
  selector: 'user-mini',
13 13
  template: `
14 14
    <ng-container *ngIf="!dashboard">
15
      
15

  
16 16
      <ul *ngIf="!mobileView" class="uk-navbar-nav" [class.uk-dark]="dark">
17 17
        <li class="uk-parent">
18 18
          <a *ngIf="loggedIn" class="login">
......
184 184
  
185 185
  constructor(private router: Router, private  route: ActivatedRoute) {
186 186
    this.router.events.forEach(event => {
187
      if(event instanceof NavigationStart) {
187
      if (event instanceof NavigationStart) {
188 188
        this.initialize(event.url);
189 189
      }
190 190
    });
......
212 212
  }
213 213
  
214 214
  initialize(url: string = null) {
215
    if (typeof location !== 'undefined') {
216
      if(url) {
217
        let parts = StringUtils.split(url, ['?']);
218
        this.redirectUrl = properties.baseLink + parts[0];
219
        if(parts.length == 2) {
220
          this.search = parts[1];
221
        } else {
222
          this.search = null;
223
        }
215
    if (url) {
216
      let parts = StringUtils.split(url, ['?']);
217
      this.redirectUrl = properties.baseLink + parts[0];
218
      if (parts.length == 2) {
219
        this.search = parts[1];
224 220
      } else {
225
        this.redirectUrl = location.pathname;
226
        this.search = location.search;
221
        this.search = null;
227 222
      }
223
    } else if (typeof location !== 'undefined') {
224
      this.redirectUrl = location.pathname;
225
      this.search = location.search;
228 226
    }
229 227
    if (this.user) {
230 228
      this.loggedIn = true;
......
243 241
    if (this.user) {
244 242
      Session.removeUser();
245 243
      // New method
246
      if(properties.logoutUrl.includes('openid_logout')) {
244
      if (properties.logoutUrl.includes('openid_logout')) {
247 245
        Session.setReloadUrl(location.protocol + "//" + location.host, this.redirectUrl, this.search);
248 246
        window.location.href = this.logOutUrl;
249 247
      } else {
......
257 255
  
258 256
  logIn() {
259 257
    Session.setReloadUrl(location.protocol + "//" + location.host,
260
      this.fixRedirectUrl?(properties.baseLink + this.fixRedirectUrl):this.redirectUrl, this.search);
258
      this.fixRedirectUrl ? (properties.baseLink + this.fixRedirectUrl) : this.redirectUrl, this.search);
261 259
    window.location.href = this.logInUrl;
262 260
  }
263 261
  

Also available in: Unified diff