I managed to get a working security authentication, so basically I am redirecting to the login login, since the user is not logged in.
This works fine, but I was wondering if someone is doing something similar, as soon as I get redirected to the login page, I would like to return to the original page after they authenticated. Asp.net mvc does this with returnUrl in querystring, but it is really ugly, I think.
So, I have a.
/items // this show my items.. /login // this is the login view.
therefore, if the user goes to / items and does not register, I am currently redirected to the login window, but after successful login, I need to redirect the user to where he wanted to execute the original go ie / items
I'm doing it now
$rootScope.$on("$routeChangeStart", function ( next, current) { if (!authentication.getIsLoggedIn()) $location.path('/login'); });
If I canβt pass the original url or save it somehow, like after a successful login, I donβt know where to send the user.
Love to hear any feedback.
thanks
source share