Skip to content

Commit

Permalink
Using the new auth pathTo does not work with parametric paths.
Browse files Browse the repository at this point in the history
If you have a route to a path like 'page/:id' and you that requires authentication you will also need to set the pathTo to 'page/:id' but this doesn't parameterize the path it actually just treats it like a static string and send you back to 'page/:id'.

In actuality I would prefer that the redirect to path be the path I just visited. So if I go to 'page/1' I would like to be taken back to 'page/1' after logging in.

Here is a screencast to explain the issue and the fix: http://screencast.com/t/P32218p4
  • Loading branch information
rmontgomery429 committed Jun 29, 2013
1 parent c849d02 commit 531cdc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions angularFire.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,11 @@ angular.module("firebase").factory("angularFireAuth", [
if (options.path) {
$rootScope.$on("$routeChangeStart", function(e, next, current) {
if (next.authRequired && !self._authenticated) {
self._redirectTo =
next.pathTo === options.path ? "/" : next.pathTo;
if(next.pathTo === undefined) {
self._redirectTo = $location.path();
} else {
self._redirectTo = next.pathTo === options.path ? "/" : next.pathTo;
}
$location.path(options.path);
}
});
Expand Down
2 changes: 1 addition & 1 deletion angularfire.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 531cdc7

Please sign in to comment.