Git Product home page Git Product logo

Comments (8)

eddiemonge avatar eddiemonge commented on June 23, 2024

maybe you should change your login dialog pop up to not fire if one is already open, say in maybe a service that handles that.

from angular-http-auth.

xmlking avatar xmlking commented on June 23, 2024

I am doing that as workaround, in my auth controller using a scope variable to suppress login popups until previous dialog is closed.
It would be nice if it is implemented in framwork level to delay subsequent 'event:auth-loginRequired' events untile e.g $stateChangeError or $stateChangeSuccess events received.

from angular-http-auth.

eddiemonge avatar eddiemonge commented on June 23, 2024

Those should be done in your app. There is no way to account for all that (ngRoute vs ui-router vs custom) in this module.

from angular-http-auth.

witoldsz avatar witoldsz commented on June 23, 2024

@eddiemonge is right, just ignore the messages if you are still waiting for user to submit...

from angular-http-auth.

tkrotoff avatar tkrotoff commented on June 23, 2024

Why not wait for loginConfirmed() or loginCancelled() before issuing new 'event:auth-loginRequired'?

from angular-http-auth.

Mr-Anonymous avatar Mr-Anonymous commented on June 23, 2024

how did you resolve this? I have the exact same scenario. If I have to add a check in service that opens the modal, how do I do that? Say my modal is called from a service like this everytime the 401 is thrown:

                                var modalInstance = $modal.open({
                                    templateUrl: 'views/LoginModalTemplate.html',
                                    controller: 'LoginModalCtrl'
                              });
                                modalInstance.result.then(function () {
                                        // If Confirmed
                                        authService.loginConfirmed();
                                }, function () {
                                        // If cancelled                                     
                                        //$state.go('index');
                                        authService.loginCancelled();
                                });

The above opens multiple login modals when http-auth-interceptor catches multiple 401's from the api for 1 page load. How do I stop the other modals from opening up when one is already existing? Do I need to add a switch to the $rootscope and check in service before the modal instance opens up? An example will greatly help please ..

from angular-http-auth.

xmlking avatar xmlking commented on June 23, 2024

I used a flag
https://github.com/xmlking/spa-starter-kit/blob/master/app/common/controllers/LoginController.js

from angular-http-auth.

Mr-Anonymous avatar Mr-Anonymous commented on June 23, 2024

Thanks heaps for that @xmlking That certainly gives me an idea now on how to approach this. Thanks again for helping. I was stuck on that for a long time wondering how to resolve it. Much appreciated. :)

from angular-http-auth.

Related Issues (20)

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.