title: Login page before main (Aurelia)
body: <p>I want when user coming check if he login before -        if not -> redirect to login page -> if his email &amp; password are okay -> redirect back to welcome page.</p>
  
  <p>What problem I have -> service work properly with login class but welcome class totally ignore any changes in service.</p>
  
  <h1>Code</h1>
  
  <h2>users.js</h2>
  
  <pre><code>export class Users {
  users = [
      { name: 'Lucian', email: 'lucian1992@zalando.de', password: 'lucian' },
      { name: 'Corki', email: 'corki2010@supplier.de', password: 'corki' },
      { name: 'Vayne', email: 'vaynii@zalando.de', password: 'vayne' }];
  
  securedUser = {};
  error = {};
  usedOnce = 0;
  
  check(checkUser) {
      this.usedOnce = 1;
      this.securedUser = this.users.filter((user) =&gt; user.email === checkUser.email
                                                  &amp;&amp; user.password ===   checkUser.password)[0];
      if (typeof this.securedUser === 'undefined'){
          this.error = { message: "No such kind of user or wrong password" };
      }
   }
  
  }
  </code></pre>
  
  <h2>login.js</h2>
  
  <pre><code>import {inject} from 'aurelia-framework';
  import {Users} from 'users-list';
  import {Router} from 'aurelia-router';
  
  @inject(Users, Router)
  export class Login {
      constructor(userData, router) {
          this.router = router;
          this.users = userData.users;
          this.check = userData.check;
          this.securedUser = userData.securedUser;  // Changed after check function
          this.userError = userData.error;
      }
      checkUser = {};
      login() {
          this.check(this.checkUser);
          if (typeof this.userError === 'undefined') {
              alert(this.error.message);
          } else {
              this.router.navigate("")
          }
      }
  }
  </code></pre>
  
  <h2>welcome.js</h2>
  
  <pre><code>import {inject} from 'aurelia-framework';
  import {Users} from 'users-list';
  import {Redirect} from 'aurelia-router';
  
  @inject(Users)
  export class Overview {
    constructor(userData) {
      this.usedOnce  = userData.usedOnce;
      this.securedUser = userData.securedUser;  // This object changed in login.js, but totally ignores in this class
    }
    heading = 'Welcome to the Article Manager Prototype!';
  
    canActivate() {
      if (this.securedUser) {
        return new Redirect('/login')
      }
    }
  }
  </code></pre>
  
  <p>So, tech issue that securedUser changed in login.js, but totally ignored in welcome.js. Is this because of canActivate method? Because I also use activate() - the same problem.</p>
  
  <p>Will appreciate any help with understanding the issue.</p>