Code Monkey home page Code Monkey logo

visor's People

Contributors

alonbardavid avatar cmtt avatar kennethlynne avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

visor's Issues

NPM Package - console.log

Again, thanks a lot for fixing the previous issue. It even resolved an other issue we had. Now it fulfills all requirements we have!

Might it be possible to pump the newest version to npm. The current npm version includes a console.log in the ui router code...

get permissions

Thanks!

expose addNextToUrl

Also it would be handy if we could change the next url manually whenever we needed, so please add it to the provider with:

visor.addNextToUrl = function addNextToUrl(restrictedUrl){
  $location.search('next', restrictedUrl);
};

split from #14.

NPM Package

Might it be possible to package visor as NPM-Package.

You really need to reformat the code

I am happy to provide a PR.

It is misaligned parentheses, inconsistent use of brackets and semicolons etc.

This makes it harder to contribute to the codebase.

startup visorProvider.authenticate

Hello

I don't understand the idea to launch the visorProvider.authenticate when the page is loaded.
Specially with your example with an $http promise.

Could you please explain more the concept ?

thanks

'next' query string parameter redirects to sign-in page when using @ui-router/angular-hybrid

AngularJS projects migrating to UI-Router V1 must use the stateEvents.js polyfill in order for angular-visor to continue working, see: #18

For UI-Router projects upgrading from AngularJS to Angular, this involves switching from https://www.npmjs.com/package/@uirouter/angularjs to https://www.npmjs.com/package/@uirouter/angular-hybrid for ngUpgrade support.

However, while the 'next' query string parameter works correctly using ui-router/angularjs + stateEvents.js polyfill, ui-router/angular-hybrid + stateEvents.js polyfill causes the 'next' query string parameter to behave incorrectly.

ui-router/angularjs trace:

Transition #0-0: <- Rejected "Transition#0( ''{} -> 'dashboard.phase'{} )", reason: Transition Rejection($id: 0 type: 3, message: The transition has been aborted, detail: Hook aborted transition)

Transition #1-0: Started -> "Transition#1( ''{} -> 'user.signin'{"next":"/dashboard/phase"} )"

Transition #1-0: <- Success "Transition#1( ''{} -> 'user.signin'{"next":"/dashboard/phase"} )", final state: user.signin

ui-router/angular-hybrid trace:

Transition #0-0: <- Rejected "Transition#0( ''{} -> 'dashboard.phase'{} )", reason: Transition Rejection($id: 0 type: 3, message: The transition has been aborted, detail: Hook aborted transition)

Transition #1-0: <- Rejected "Transition#1( ''{} -> 'dashboard.phase'{} )", reason: Transition Rejection($id: 1 type: 3, message: The transition has been aborted, detail: Hook aborted transition)

Transition #2-0: Started -> "Transition#2( ''{} -> 'user.signin'{"next":"/dashboard/phase"} )"

Transition #2-0: <- Success "Transition#2( ''{} -> 'user.signin'{"next":"/dashboard/phase"} )", final state: user.signin

Transition #3-0: Started -> "Transition#3( 'user.signin'{"next":"/dashboard/phase"} -> 'user.signin'{"next":"/user/signin?next=%2Fdashboard%2Fphase"} )"

Transition #3-0: <- Success "Transition#3( 'user.signin'{"next":"/dashboard/phase"} -> 'user.signin'{"next":"/user/signin?next=%2Fdashboard%2Fphase"} )", final state: user.signin

next url

Hello

The next parameter is always filled with the url where I came from, and not the restricted url ?

I am using the ui-router version.

any idea ?

function doOnNotAuthenticated should use $location properly

The current function has a bad behavior, which I caused.
I had to use this function to change the default next url to whatever I needed, but if the url has a next parameter then it starts replacing (which actually works), but it leaves a comma (,) in the url 😞

The correct behavior instead of replacing the url via regex is to use the built in $location.path() and $location.search().
The method then should look like:

config.doOnNotAuthenticated = ["$location", "restrictedUrl", function ($location, restrictedUrl) {
  $location.path(config.loginRoute).search('next', restrictedUrl);
}];

Also it would be handy if we could change the next url manually whenever we needed, so please add it to the provider with:

visor.addNextToUrl = function addNextToUrl(restrictedUrl){
  $location.search('next', restrictedUrl);
};

login form and visorProvider.authenticate

With a traditional login form (with username and password and a login button), when we click the "Login" button, should we call the visorProvider.authenticate (if we declare a $http promise) or should we manage the $http in the controller of the login form ?

Do you have an example ?

Thanks again

Uncaught TypeError: $injector.invoke(...).then(...).finally is not a function

Visor v0.1.2 doesn't work with AngularJS v1.6.4. It fails in method Visor.authenticate at line:

['finally'](function () {

Console log:

bundle.c3eb2f5….js:28906 Uncaught TypeError: $injector.invoke(...).then(...).finally is not a function
    at Object.authenticate (bundle.c3eb2f5….js:28906)
    at bundle.c3eb2f5….js:28989
    at Object.invoke (bundle.c3eb2f5….js:34488)
    at bundle.c3eb2f5….js:34290
    at forEach (bundle.c3eb2f5….js:29888)
    at createInjector (bundle.c3eb2f5….js:34290)
    at doBootstrap (bundle.c3eb2f5….js:31399)
    at bootstrap (bundle.c3eb2f5….js:31420)
    at angularInit (bundle.c3eb2f5….js:31305)
    at bundle.c3eb2f5….js:62852
authenticate @ bundle.c3eb2f5….js:28906
(anonymous) @ bundle.c3eb2f5….js:28989
invoke @ bundle.c3eb2f5….js:34488
(anonymous) @ bundle.c3eb2f5….js:34290
forEach @ bundle.c3eb2f5….js:29888
createInjector @ bundle.c3eb2f5….js:34290
doBootstrap @ bundle.c3eb2f5….js:31399
bootstrap @ bundle.c3eb2f5….js:31420
angularInit @ bundle.c3eb2f5….js:31305
(anonymous) @ bundle.c3eb2f5….js:62852
trigger @ bundle.c3eb2f5….js:32916

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.