Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Best practices for login screen #1093

Open
mercmobily opened this issue Mar 19, 2018 · 1 comment
Open

Best practices for login screen #1093

mercmobily opened this issue Mar 19, 2018 · 1 comment

Comments

@mercmobily
Copy link
Contributor

Hi people,

what are the best practices for adding a login screen in PSK in terms of PRPL?
I already have the logic, the ajax etc.
At the moment, I have the login page added just as another page. However, I have:

      <iron-selector selected="[[page]]" attr-for-selected="name" class="drawer-list" role="navigation">
        <template is="dom-if" if="[[userData.loggedIn]]">
          <a name="home" href="[[rootPath]]home">Home</a>
          <a name="view-jobs" href="[[rootPath]]view-jobs">View Jobs</a>
          ...
          <a name="logout" on-tap="_logout">Logout</a>
        </template>

        <template is="dom-if" if="[[!userData.loggedIn]]">
          <a name="login">Login</a>
        </template>

And then:

  _routePageChanged (page, loggedIn) {
    // If no page was found in the route data, page will be an empty string.
    // Default to 'home' in that case.
    this.page = loggedIn ? page || 'home' : 'login'
  }

However, <view-jobs> might have a record open. Even though the page is no longer visible as such, it's still "there". Even after logout, the page might get server push updates; or, a user could logout and log back in as a different user -- and see the "old" data in that page.
I am not sure how iron-pages would deal with restamping things. Initial testing showed that it doesn't seem to change anything.
The only sure way I have to reset the app to zero is to actually reload the whole page. However, that feels a little lame...

Ideas?

Merc.

@spencerwmiles
Copy link

https://stackoverflow.com/a/46105917

Hope that helps a little friend

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants