Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Routes #10

Closed
mahr-martin opened this issue Mar 27, 2014 · 4 comments
Closed

Routes #10

mahr-martin opened this issue Mar 27, 2014 · 4 comments

Comments

@mahr-martin
Copy link

Hello,
I'm using Nette 2.1.0 and route settings:

class RouterFactory {
    public function createRouter() {
        $router = new RouteList();

        // Register OPAuth routers
        $router[] = $opauthRouter = new RouteList('Opauth');
        \NetteOpauth\NetteOpauth::register($opauthRouter);

        $router[] = $adminRouter = new RouteList('Admin');
        $adminRouter[] = new Route('admin/<presenter>/<action>/[<id>]', 'Homepage:default');

        $router[] = $frontRouter = new RouteList('Public');
        $frontRouter[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');

        $router[] = $frontRouter = new RouteList('Private');
        $frontRouter[] = new Route('private/<presenter>/<action>[/<id>]', 'Homepage:default');

        return $router;
    }
}

And it didn't work until I change \NetteOpauth\NetteOpauth::register() to:

public static function register($router) {
    $router[] = new Route('auth/logout', 'Auth:logout');
    $router[] = new Route('auth/callback', 'Auth:callback');
    $router[] = new Route('auth/<strategy>', 'Auth:auth');
    $router[] = new Route('auth/<strategy>/oauth2callback', 'Auth:auth');
    $router[] = new Route('auth/<strategy>/oauth_callback', 'Auth:auth');
    $router[] = new Route('auth/<strategy>/int_callback', 'Auth:auth');
}
  • removed initial "/" from all routes. Is it a bug or is it my mistake?
@michalsvec
Copy link
Owner

What exactly didn't work? Works fine for me even on Nette 2.1.

@Marduke
Copy link

Marduke commented Aug 15, 2014

i use nette 2.2, only sandbox with added opauth
routing not works
solution is easy remove first '/' from start of route and everything works, maybe change in 2.2 as wrote before

$router[] = new Route('/auth/logout', 'Auth:logout');....
====>
$router[] = new Route('auth/logout', 'Auth:logout');....

@michalsvec
Copy link
Owner

I will check and let you know.

@michalsvec
Copy link
Owner

You are right. Trailing slashes are useless.
Fixed in https://github.com/michalsvec/nette-opauth/releases/tag/v0.6.6

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants