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

Best practices for login screen #1093

Description

@mercmobily

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions