Project

General

Profile

« Previous | Next » 

Revision 56922

Add property afterLoginRedirect and use it user-mini to redirect after login.

View differences:

userMini.component.ts
81 81
    @Input() logInUrl;
82 82
    @Input() logOutUrl;
83 83
    @Input() cookieDomain;
84
    @Input() communityId = null;
85
    public redirectUrl: string = "";
84
    @Input() redirectUrl: string;
86 85
    sub:any;
87 86

  
88 87
    constructor( private router: Router, private  route: ActivatedRoute, private location: Location) {}
......
104 103
    }
105 104

  
106 105
    initialize(){
107
      this.redirectUrl = this.location.path();
106
      if(!this.redirectUrl) {
107
        this.redirectUrl = location.pathname;
108
      }
108 109
      if(Session.isLoggedIn()){
109 110
          this.loggedIn = true;
110 111
          this.user = Session.getUser();
......
134 135
    }
135 136

  
136 137
    logIn(){
137
      if(this.communityId && this.communityId === 'connect') {
138
        Session.setReloadUrl(location.protocol +"//"+location.host, '/myCommunities', null);
139
      }
140
      else {
141
        Session.setReloadUrl(location.protocol +"//"+location.host, location.pathname, location.search);
142
      }
138
      Session.setReloadUrl(location.protocol +"//"+location.host, this.redirectUrl, location.search);
143 139
      window.location.href = this.logInUrl;
144 140
    }
145 141

  

Also available in: Unified diff