Giter VIP home page Giter VIP logo

apostrophe-second-chance-login's Introduction

apostrophe-second-chance-login

If a user attempts to access a page that is a 404 for them, but would work for an admin, this module notes the URL in a cookie and redirects them to the login page. After successfully logging in, they are taken to the page.

Installation

npm install --save apostrophe-second-chance-login
  // in app.js, where you configure your modules...
  modules: {
    'apostrophe-second-change-login': {},
    // other modules, etc.
  }

That's all there is to it!

Warnings

There is a chance the user will still get a 404 not found error, as their account might or might not have sufficient privileges. In this case we show them the usual "not found" page and do not disclose extra information they should not have.

This module adds a performance hit to all 404 not found errors, so use it thoughtfully.

Limitations

Currently this module only understands pages. If the user gets a 404 due to permissions applied to a piece, this module currently cannot assist. A better implementation would probably carry out a complete request with an admin req, however this requires a more sophisticated fake res object than we have handy at the moment. And it also has an even greater performance overhead. So then again, maybe not.

apostrophe-second-chance-login's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

beaulac

apostrophe-second-chance-login's Issues

Unable to reach the 404 page with this module in place

For projects with this module, an actual 404 leads to the login page. The following projects are all using this module, and a URL which should show the 404 actually show the login page:

Either there is a bug (maybe? not sure) or there is some additional documentation required to clarify how to ensure that an actual 404 presents the 404 template.

For pages that exist but require permissions, I agree this module does the proper job (redirecting to login), but when an actual 404 is needed, the user experience of a visitor being thrown to the login page rather than the 404 template is not useful.

Note that this issue replaces the one originally reported on apostrophe-workflow, as it is most likely this module (apostrophe-second-chance-login) that is the cause.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.