Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Authenticating Routes

Received: by 10.66.72.134 with SMTP id d6mr1791146pav.20.1349417959821;
        Thu, 04 Oct 2012 23:19:19 -0700 (PDT)
X-BeenThere: mojolicious@googlegroups.com
Received: by 10.68.189.162 with SMTP id gj2ls13664962pbc.6.gmail; Thu, 04 Oct
 2012 23:19:18 -0700 (PDT)
Received: by 10.68.216.202 with SMTP id os10mr1012866pbc.17.1349417958748;
        Thu, 04 Oct 2012 23:19:18 -0700 (PDT)
Date: Thu, 4 Oct 2012 23:19:18 -0700 (PDT)
From: Amit <am...@rae-consulting.com>
To: mojolicious@googlegroups.com
Cc: alis...@alisterwest.com
Message-Id: <415c0484-6cc9-49f4-a78b-0b8a75e8d46e@googlegroups.com>
In-Reply-To: <CALy2Nv8fYSrDqGVKaEVGzyWKHabcp4YhbRF53rN+WpnqTyii+Q@mail.gmail.com>
References: <31610ff6-6870-48ab-b90d-1c8e6782a096@googlegroups.com>
 <CAKTcQ96TnSVw7N-9Vyk1_MkdsP4MP8Qd0Q-QdniB4Tir0rmAig@mail.gmail.com>
 <CAKTcQ95xn50GrAkHCtQ-iM=uVy7WHdOr0ibgX_qttODBd6FW+Q@mail.gmail.com>
 <f5b91f53-20ea-4ceb-b826-763352495be1@googlegroups.com>
 <SNT134-W211D312ED996C1407BCD7ED0C60@phx.gbl>
 <20e43211-cf92-479c-b1d5-23200aa94707@googlegroups.com>
 <58fcbb1b-5695-4ffc-b699-e5fce3f3bff9@googlegroups.com>
 <b270fcca-ede6-42f5-b01a-5a5ec20e3c16@googlegroups.com>
 <SNT134-W37068B15863F7AA0B65332D0C40@phx.gbl>
 <2dc8b9c2-f9fe-4512-93de-c6ae440ab6e3@googlegroups.com>
 <f291a113-c32f-44f5-942a-01ee170bb0d2@googlegroups.com>
 <Pine.LNX.4.64.1210041036430.20086@e-smith.charlieb.ott.istop.com>
 <be18d7ae-de03-4816-827b-e5bc906904c3@googlegroups.com>
 <CALy2Nv-KUiv+CWF5EXowWUrS5fjwvx-KOp8--GPODzWnqAMwJA@mail.gmail.com>
 <3f41ac4e-f02c-4579-9fc6-17da5e75d418@googlegroups.com>
 <CALy2Nv8fYSrDqGVKaEVGzyWKHabcp4YhbRF53rN+WpnqTyii+Q@mail.gmail.com>
Subject: Re: [Mojolicious] Authenticating Routes
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_335_7431746.1349417958202"

------=_Part_335_7431746.1349417958202
Content-Type: multipart/alternative; 
	boundary="----=_Part_336_15766791.1349417958202"

------=_Part_336_15766791.1349417958202
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Thanks a lot Alister. It worked fine. :)

Thanks once again.

Regards,

Amit Khurana

On Thursday, October 4, 2012 11:18:22 PM UTC+5:30, Alister West wrote:
>
> Hi, here is a working example using a bridge. 
>
> #!/usr/bin/env perl 
> use Mojolicious::Lite; 
> my $self = app(); 
>
> my $public = $self->routes; 
>
> $public->route("/"     )->to( cb => sub { shift->render(text => "to 
> slash\n") }); 
>
> $public->route("/main" )->to( cb => sub { 
>     my $self = shift; 
>     $self->render( text => "to Main::index (". $self->session('user') 
> .")\n"); 
> }); 
>
> $public->get("/login" )->to( cb => sub { 
>     my $self = shift; 
>     $self->session( user => 'Bender'); 
>     $self->render(text => "Logged in as Bender\n") 
> }); 
>
> $public->get("/logout")->to( cb => sub { 
>     my $self = shift; 
>     $self->session( user => '' ); 
>     $self->render(text => "You are logged out\n") 
> }); 
>
> my $auth = $public->bridge->to(cb => sub { my $self = shift; 
>     return 1 if $self->session('user'); 
>     # do a redirect to /login here. 
>     $self->render( text => 'You are not logged in'); 
>     return; 
>  }); 
>
> $auth->get("/foo")->to( cb => sub { shift->render(text => "this is 
> foo\n"); }); 
>
> $self->start; 
>
>
>
> ~~ 
>  c|_|  alisterwest.com - mmm coffee! 
>
>
> On 4 October 2012 09:21, Amit <am...@rae-consulting.com <javascript:>> 
> wrote: 
> > Hi Alister, 
> > 
> > Thanks for the prompt reply. I tried. I also added more routes to the 
> $auth, 
> > but those routes are not working. I mean, after, 
> > 
> >      my $pubic = $self->routes; 
> > 
> >       $public->route('/')->to('main#index'); 
> >       $public->route('/main')->to('main#index'); 
> >       $public->post('/login')->to('main#post_login'); 
> >       $public->post('/logout')->to('main#logout'); 
> > 
> >       my $auth = $public->bridge->to('UserAuthUtil#check'); 
> >       $auth->post('/main')->to('main#post_login'); 
> > 
> > I added: $auth->route('/foo')->to('foo#bar'); 
> > 
> > But its not working. I am able to login but accessing any link or 
> putting 
> > any other page address directly in URL throws me following error: 
> > 
> > Page not found... yet! 
> > 
> > None of these routes matched your GET request for /foo, maybe you need 
> to 
> > add a new one? 
> > 
> > 
> > 
> > Regards, 
> > 
> > Amit 
> > 
> > 
> > On Thursday, October 4, 2012 9:32:08 PM UTC+5:30, Alister West wrote: 
> >> 
> >> It seems like your providing your routes backwards. This is probably 
> >> not what you want (but is what you have). 
> >> 
> >> Unauthenticated (called $auth??) 
> >> /main (get + post) 
> >> 
> >> Authenticated (called $r ??) 
> >> / 
> >> /main 
> >> /login 
> >> /logout 
> >> 
> >> Try: 
> >>      my $pubic = $self->routes; 
> >> 
> >>       $public->route('/')->to('main#index'); 
> >>       $public->route('/main')->to('main#index'); 
> >>       $public->post('/login')->to('main#post_login'); 
> >>       $public->post('/logout')->to('main#logout'); 
> >> 
> >>       my $auth = $public->bridge->to('UserAuthUtil#check'); 
> >>       $auth->post('/main')->to('main#post_login'); 
> >> 
> >> 
> >> ~~ 
> >>  c|_|  alisterwest.com - mmm coffee! 
> >> 
> >> 
> >> On 4 October 2012 08:39, Amit <am...@rae-consulting.com> wrote: 
> >> > Oh yeah thats right. The earlier suggestion given by byterock is not 
> >> > working. I mean, I tried that way but its not working. 
> >> > 
> >> > Please suggest. The sample code is provided in my previous post. I'll 
> >> > again 
> >> > provide it. 
> >> > 
> >> >  My Login and logout form is the same one (main). It has a small 
> section 
> >> > on 
> >> >  top which contains credential textboxes and login button. When the 
> user 
> >> > is 
> >> >  successfully logged in, that section is hidden and logout button 
> >> > appears. 
> >> >  Code: 
> >> > 
> >> >      my $auth = $self->routes; 
> >> >      $auth->route('/main')->via('get')->to('main#index'); 
> >> >      $auth->route('/main')->via('post')->to('main#post_login'); 
> >> > 
> >> >      my $r = $auth->bridge->to('UserAuthUtil#check'); 
> >> > 
> >> >      $r->route('/')->to('main#index'); 
> >> >      $r->route('/main')->to('main#index'); 
> >> >      $r->post('/login')->to('main#post_login'); 
> >> >      $r->post('/logout')->to('main#logout'); 
> >> > 
> >> > There are more routes need to be added in $r after this. 
> >> > 
> >> > Thanks & Regards, 
> >> > 
> >> > Amit Khurana 
> >> > 
> >> > 
> >> > On Thursday, October 4, 2012 8:08:08 PM UTC+5:30, Charlie Brady 
> wrote: 
> >> >> 
> >> >> 
> >> >> If you want some help, I suggest you provide more detail that "it 
> >> >> didn't 
> >> >> worked" and "its[ not working". 
> >> >> 
> >> >> On Thu, 4 Oct 2012, Amit wrote: 
> >> >> 
> >> >> > Hi All, 
> >> >> > 
> >> >> > I apologize to reopen this thread again. Due to some other 
> priority 
> >> >> > work, I 
> >> >> > had to leave this but now I am back again on this. I tried the way 
> >> >> > byterock 
> >> >> > explained. But it didn't worked. I'll again explain my form with 
> >> >> > code. 
> >> >> > 
> >> >> > My Login and logout form is the same one (main). It has a small 
> >> >> > section 
> >> >> > on 
> >> >> > top which contains credential textboxes and login button. When the 
> >> >> > user 
> >> >> > is 
> >> >> > successfully logged in, that section is hidden and logout button 
> >> >> > appears. 
> >> >> > Code: 
> >> >> > 
> >> >> >     my $auth = $self->routes; 
> >> >> >     $auth->route('/main')->via('get')->to('main#index'); 
> >> >> >     $auth->route('/main')->via('post')->to('main#post_login'); 
> >> >> >     # 
> >> >> >     my $r = $auth->bridge->to('UserAuthUtil#check'); 
> >> >> > 
> >> >> >     $r->route('/')->to('main#index'); 
> >> >> >     $r->route('/main')->to('main#index'); 
> >> >> >     $r->post('/login')->to('main#post_login'); 
> >> >> >     $r->post('/logout')->to('main#logout'); 
> >> >> > 
> >> >> > Not sure what I am doing wrong here but its not working. 
> >> >> > 
> >> >> > Thanks & Regards, 
> >> >> > 
> >> >> > Amit Khurana 
> >> >> > 
> >> >> > On Friday, August 3, 2012 10:48:38 AM UTC+5:30, Amit wrote: 
> >> >> > > 
> >> >> > > Thanks all for your valuable inputs. 
> >> >> > > 
> >> >> > > Amit 
> >> >> > > 
> >> >> > > On Wednesday, August 1, 2012 4:30:41 PM UTC+5:30, byterock 
> wrote: 
> >> >> > >> 
> >> >> > >> 
> >> >> > >> Try if like i shoewed before with a named route to some place. 
>  A 
> >> >> > >> general 
> >> >> > >> catchall or redirect to  '/' is never a good idea 
> >> >> > >> 
> >> >> > >> so in your controller you would have something like this 
> >> >> > >> 
> >> >> > >>   $r->route('/login')  ->via('get') 
> >> >> > >> ->to('authn#form')->name('authn_form'); 
> >> >> > >>   $r->route('/login')  ->via('post')->to('authn#login'); 
> >> >> > >>   my $rb = $r->bridge->to('authn#check'); 
> >> >> > >>   $mb->route('/main')->to('main#index'); 
> >> >> > >> 
> >> >> > >> and in Authn.pm 
> >> >> > >> 
> >> >> > >> sub check { 
> >> >> > >>  my $self = shift; 
> >> >> > >> $self->redirect_to('authn_form') and return 0 
> >> >> > >>    unless($self->is_user_authenticated); 
> >> >> > >>   return 1; 
> >> >> > >> } 
> >> >> > >> 
> >> >> > >> 
> >> >> > >> 
> >> >> > >>  ________________________________ 
> >> >> > >> > Date: Tue, 31 Jul 2012 23:15:17 -0700 
> >> >> > >> > From: 
> >> >> > >> > To: mojol...@googlegroups.com 
> >> >> > >> > Subject: Re: [Mojolicious] Authenticating Routes 
> >> >> > >> > 
> >> >> > >> > Hi Jay, 
> >> >> > >> > 
> >> >> > >> > I had tried that also. But, I have this in my check(): 
> >> >> > >> > 
> >> >> > >> > sub check { 
> >> >> > >> > my $self = shift; 
> >> >> > >> > $self->redirect_to("/") and return 0 
> >> >> > >> > unless($self->is_user_authenticated); 
> >> >> > >> > return 1; 
> >> >> > >> > } 
> >> >> > >> > 
> >> >> > >> > So when I enter credentials and click Submit, it calls check 
> >> >> > >> > first 
> >> >> > >> > and 
> >> >> > >> > redirects me back to the root. i.e. it does not call 
> >> >> > >> > "post_login" 
> >> >> > >> > method. 
> >> >> > >> > 
> >> >> > >> > Thanks, 
> >> >> > >> > 
> >> >> > >> > Amit 
> >> >> > >> > 
> >> >> > >> > On Tuesday, July 31, 2012 7:02:52 PM UTC+5:30, jay m wrote: 
> >> >> > >> > the page with your login form needs to be accessible by 
> >> >> > >> > unauthenticated 
> >> >> > >> > users. the way you have it now, when you redirect to / it 
> sends 
> >> >> > >> > you 
> >> >> > >> > back through the bridge again, and again, and again... 
> something 
> >> >> > >> > like 
> >> >> > >> > this will work: 
> >> >> > >> > 
> >> >> > >> > my $public = $self->routes; 
> >> >> > >> > my $r = $public->bridge->to('main#check'); 
> >> >> > >> > $public->route('/')->to('main#index'); 
> >> >> > >> > $r->route('/main')->to('main#index'); 
> >> >> > >> > 
> >> >> > >> > 
> >> >> > >> > On Tuesday, July 31, 2012 3:32:54 AM UTC-4, Amit wrote: 
> >> >> > >> > Thanks John and David. Actually my main has a section which 
> >> >> > >> > renders 
> >> >> > >> > another small login section based on user is authenticated or 
> >> >> > >> > not. 
> >> >> > >> > So I 
> >> >> > >> > login page is the same as my logout page. I made that small 
> >> >> > >> > change 
> >> >> > >> > in 
> >> >> > >> > the check() but now I am getting too many redirects error. 
> >> >> > >> > 
> >> >> > >> > I have: 
> >> >> > >> > 
> >> >> > >> > my $auth = $self->routes; 
> >> >> > >> > my $r = $auth->bridge('/')->to('main#check'); 
> >> >> > >> > $r->route('/')->to('main#index'); 
> >> >> > >> > $r->route('/main')->to('main#index'); 
> >> >> > >> > 
> >> >> > >> > Last 2 lines of code, because I want user to logon and 
> display 
> >> >> > >> > information upon successful login. And second is when user 
> >> >> > >> > clicks 
> >> >> > >> > on 
> >> >> > >> > menu "Main". 
> >> >> > >> > 
> >> >> > >> > So if in check(), I put: 
> >> >> > >> > 
> >> >> > >> > $self->redirect_to("/") and return 0 
> >> >> > >> > unless($self->is_user_authenticated); , or 
> >> >> > >> > $self->redirect_to("/main") and return 0 
> >> >> > >> > unless($self->is_user_authenticated); 
> >> >> > >> > 
> >> >> > >> > I get too many redirects error. 
> >> >> > >> > 
> >> >> > >> > Thanks in advance 
> >> >> > >> > 
> >> >> > >> > Amit 
> >> >> > >> > 
> >> >> > >> > On Monday, July 30, 2012 4:18:37 PM UTC+5:30, byterock wrote: 
> >> >> > >> > 
> >> >> > >> > that won't realy work on a bridge as a bridge just goes to 
> the 
> >> >> > >> > controller it is not condtional route 
> >> >> > >> > 
> >> >> > >> > try this in you check 
> >> >> > >> > 
> >> >> > >> > sub check { 
> >> >> > >> > my $self = shift; 
> >> >> > >> > $self->redirect_to('not_authn') and return 0 
> >> >> > >> > unless($self->is_user_authenticated); 
> >> >> > >> > return 1; 
> >> >> > >> > } 
> >> >> > >> > 
> >> >> > >> > where not_authn is a template or named route that you want 
> your 
> >> >> > >> > user to 
> >> >> > >> > go to when they are not authenticated 
> >> >> > >> > 
> >> >> > >> > A condtionaly controller works like this 
> >> >> > >> > 
> >> >> > >> > $r->route('/home')->over(authenticated => 
> >> >> > >> > 1)->to('example#home')->name('home'); 
> >> >> > >> > 
> >> >> > >> > however what you want(catch all) is what you have now with 
> the 
> >> >> > >> > small 
> >> >> > >> > change above 
> >> >> > >> > 
> >> >> > >> > Cheers 
> >> >> > >> > John 
> >> >> > >> > 
> >> >> > >> > ________________________________ 
> >> >> > >> > > Date: Mon, 30 Jul 2012 03:37:07 -0700 
> >> >> > >> > > From: 
> >> >> > >> > > To: 
> >> >> > >> > > mojol...@googlegroups.com<mailto:mojol...@googlegroups.com> 
>
> >> >> > >> 
> >> >> > >> > > Subject: Re: [Mojolicious] Authenticating Routes 
> >> >> > >> > > 
> >> >> > >> > > Thanks David for the info. Following is the code inside 
> check: 
> >> >> > >> > > 
> >> >> > >> > > sub check { 
> >> >> > >> > > my $self = shift; 
> >> >> > >> > > return 0 unless($self->is_user_authenticated); 
> >> >> > >> > > return 1; 
> >> >> > >> > > } 
> >> >> > >> > > 
> >> >> > >> > > On Monday, July 30, 2012 1:26:51 PM UTC+5:30, David Oswald 
> >> >> > >> > > wrote: 
> >> >> > >> > > > 'main', Main::check, main::check, Main::check, 
> >> >> > >> > > > main::check code (pay attention to capitalization). 
> >> >> > >> > > 
> >> >> > >> > > You see, even after talking about it, I still am getting it 
> >> >> > >> > > mixed 
> >> >> > >> > > up. 
> >> >> > >> > > 'main' vs 'Main'. ...that controller name is begging to be 
> >> >> > >> > > changed to 
> >> >> > >> > > something that doesn't resemble Perl's default package. ;) 
> >> >> > >> > > 
> >> >> > >> > > 
> >> >> > >> > > -- 
> >> >> > >> > > 
> >> >> > >> > > David Oswald 
> >> >> > >> > > 
> >> >> > >> > > 
> >> >> > >> > > -- 
> >> >> > >> > > You received this message because you are subscribed to the 
> >> >> > >> > > Google 
> >> >> > >> > > Groups "Mojolicious" group. 
> >> >> > >> > > To view this discussion on the web visit 
> >> >> > >> > > https://groups.google.com/d/msg/mojolicious/-/_uy0fIj3haIJ. 
>
> >> >> > >> > > To post to this group, send email to 
> >> >> > >> > mojol...@googlegroups.com<mailto:mojol...@googlegroups.com>. 
> >> >> > >> > > To unsubscribe from this group, send email to 
> >> >> > >> > > 
> >> >> > >> > mojolicious...@googlegroups.com<mailto: 
> >> >> > >> mojolicious%...@googlegroups.com>. 
> >> >> > >> > > For more options, visit this group at 
> >> >> > >> > > http://groups.google.com/group/mojolicious?hl=en. 
> >> >> > >> > 
> >> >> > >> > -- 
> >> >> > >> > You received this message because you are subscribed to the 
> >> >> > >> > Google 
> >> >> > >> > Groups "Mojolicious" group. 
> >> >> > >> > To view this discussion on the web visit 
> >> >> > >> > https://groups.google.com/d/msg/mojolicious/-/AnH1vfcVzzoJ. 
> >> >> > >> > To post to this group, send email to 
> mojol...@googlegroups.com. 
> >> >> > >> > To unsubscribe from this group, send email to 
> >> >> > >> > mojolicious...@googlegroups.com. 
> >> >> > >> > For more options, visit this group at 
> >> >> > >> > http://groups.google.com/group/mojolicious?hl=en. 
> >> >> > >> 
> >> >> > > 
> >> >> > > 
> >> >> > 
> >> >> > 
> >> > 
> >> > -- 
> >> > You received this message because you are subscribed to the Google 
> >> > Groups 
> >> > "Mojolicious" group. 
> >> > To view this discussion on the web visit 
> >> > https://groups.google.com/d/msg/mojolicious/-/y09M4gItKSEJ. 
> >> > 
> >> > To post to this group, send email to mojol...@googlegroups.com. 
> >> > To unsubscribe from this group, send email to 
> >> > mojolicious...@googlegroups.com. 
> >> > For more options, visit this group at 
> >> > http://groups.google.com/group/mojolicious?hl=en. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Mojolicious" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/mojolicious/-/LiM2MGKGwDQJ. 
> > 
> > To post to this group, send email to mojol...@googlegroups.com<javascript:>. 
>
> > To unsubscribe from this group, send email to 
> > mojolicious...@googlegroups.com <javascript:>. 
> > For more options, visit this group at 
> > http://groups.google.com/group/mojolicious?hl=en. 
>

------=_Part_336_15766791.1349417958202
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

Thanks a lot Alister. It worked fine. :)<div><br></div><div>Thanks once again.</div><div><br></div><div>Regards,</div><div><br></div><div>Amit Khurana<br><br>On Thursday, October 4, 2012 11:18:22 PM UTC+5:30, Alister West wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi, here is a working example using a bridge.
<br>
<br>#!/usr/bin/env perl
<br>use Mojolicious::Lite;
<br>my $self = app();
<br>
<br>my $public = $self-&gt;routes;
<br>
<br>$public-&gt;route("/" &nbsp; &nbsp; )-&gt;to( cb =&gt; sub { shift-&gt;render(text =&gt; "to
<br>slash\n") });
<br>
<br>$public-&gt;route("/main" )-&gt;to( cb =&gt; sub {
<br>&nbsp; &nbsp; my $self = shift;
<br>&nbsp; &nbsp; $self-&gt;render( text =&gt; "to Main::index (". $self-&gt;session('user') .")\n");
<br>});
<br>
<br>$public-&gt;get("/login" )-&gt;to( cb =&gt; sub {
<br>&nbsp; &nbsp; my $self = shift;
<br>&nbsp; &nbsp; $self-&gt;session( user =&gt; 'Bender');
<br>&nbsp; &nbsp; $self-&gt;render(text =&gt; "Logged in as Bender\n")
<br>});
<br>
<br>$public-&gt;get("/logout")-&gt;to( cb =&gt; sub {
<br>&nbsp; &nbsp; my $self = shift;
<br>&nbsp; &nbsp; $self-&gt;session( user =&gt; '' );
<br>&nbsp; &nbsp; $self-&gt;render(text =&gt; "You are logged out\n")
<br>});
<br>
<br>my $auth = $public-&gt;bridge-&gt;to(cb =&gt; sub { my $self = shift;
<br>&nbsp; &nbsp; return 1 if $self-&gt;session('user');
<br>&nbsp; &nbsp; # do a redirect to /login here.
<br>&nbsp; &nbsp; $self-&gt;render( text =&gt; 'You are not logged in');
<br>&nbsp; &nbsp; return;
<br>&nbsp;});
<br>
<br>$auth-&gt;get("/foo")-&gt;to( cb =&gt; sub { shift-&gt;render(text =&gt; "this is foo\n"); });
<br>
<br>$self-&gt;start;
<br>
<br>
<br>
<br>~~
<br>&nbsp;c|_| &nbsp;<a href="http://alisterwest.com" target="_blank">alisterwest.com</a> - mmm coffee!
<br>
<br>
<br>On 4 October 2012 09:21, Amit &lt;<a href="javascript:" target="_blank" gdf-obfuscated-mailto="4dht-K1RyacJ">am...@rae-consulting.com</a>&gt; wrote:
<br>&gt; Hi Alister,
<br>&gt;
<br>&gt; Thanks for the prompt reply. I tried. I also added more routes to the $auth,
<br>&gt; but those routes are not working. I mean, after,
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp;my $pubic = $self-&gt;routes;
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp; $public-&gt;route('/')-&gt;to('main#<wbr>index');
<br>&gt; &nbsp; &nbsp; &nbsp; $public-&gt;route('/main')-&gt;to('<wbr>main#index');
<br>&gt; &nbsp; &nbsp; &nbsp; $public-&gt;post('/login')-&gt;to('<wbr>main#post_login');
<br>&gt; &nbsp; &nbsp; &nbsp; $public-&gt;post('/logout')-&gt;to('<wbr>main#logout');
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp; my $auth = $public-&gt;bridge-&gt;to('<wbr>UserAuthUtil#check');
<br>&gt; &nbsp; &nbsp; &nbsp; $auth-&gt;post('/main')-&gt;to('<wbr>main#post_login');
<br>&gt;
<br>&gt; I added: $auth-&gt;route('/foo')-&gt;to('foo#<wbr>bar');
<br>&gt;
<br>&gt; But its not working. I am able to login but accessing any link or putting
<br>&gt; any other page address directly in URL throws me following error:
<br>&gt;
<br>&gt; Page not found... yet!
<br>&gt;
<br>&gt; None of these routes matched your GET request for /foo, maybe you need to
<br>&gt; add a new one?
<br>&gt;
<br>&gt;
<br>&gt;
<br>&gt; Regards,
<br>&gt;
<br>&gt; Amit
<br>&gt;
<br>&gt;
<br>&gt; On Thursday, October 4, 2012 9:32:08 PM UTC+5:30, Alister West wrote:
<br>&gt;&gt;
<br>&gt;&gt; It seems like your providing your routes backwards. This is probably
<br>&gt;&gt; not what you want (but is what you have).
<br>&gt;&gt;
<br>&gt;&gt; Unauthenticated (called $auth??)
<br>&gt;&gt; /main (get + post)
<br>&gt;&gt;
<br>&gt;&gt; Authenticated (called $r ??)
<br>&gt;&gt; /
<br>&gt;&gt; /main
<br>&gt;&gt; /login
<br>&gt;&gt; /logout
<br>&gt;&gt;
<br>&gt;&gt; Try:
<br>&gt;&gt; &nbsp; &nbsp; &nbsp;my $pubic = $self-&gt;routes;
<br>&gt;&gt;
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; $public-&gt;route('/')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; $public-&gt;route('/main')-&gt;to('<wbr>main#index');
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; $public-&gt;post('/login')-&gt;to('<wbr>main#post_login');
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; $public-&gt;post('/logout')-&gt;to('<wbr>main#logout');
<br>&gt;&gt;
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; my $auth = $public-&gt;bridge-&gt;to('<wbr>UserAuthUtil#check');
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; $auth-&gt;post('/main')-&gt;to('<wbr>main#post_login');
<br>&gt;&gt;
<br>&gt;&gt;
<br>&gt;&gt; ~~
<br>&gt;&gt; &nbsp;c|_| &nbsp;<a href="http://alisterwest.com" target="_blank">alisterwest.com</a> - mmm coffee!
<br>&gt;&gt;
<br>&gt;&gt;
<br>&gt;&gt; On 4 October 2012 08:39, Amit &lt;<a>am...@rae-consulting.com</a>&gt; wrote:
<br>&gt;&gt; &gt; Oh yeah thats right. The earlier suggestion given by byterock is not
<br>&gt;&gt; &gt; working. I mean, I tried that way but its not working.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Please suggest. The sample code is provided in my previous post. I'll
<br>&gt;&gt; &gt; again
<br>&gt;&gt; &gt; provide it.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; &nbsp;My Login and logout form is the same one (main). It has a small section
<br>&gt;&gt; &gt; on
<br>&gt;&gt; &gt; &nbsp;top which contains credential textboxes and login button. When the user
<br>&gt;&gt; &gt; is
<br>&gt;&gt; &gt; &nbsp;successfully logged in, that section is hidden and logout button
<br>&gt;&gt; &gt; appears.
<br>&gt;&gt; &gt; &nbsp;Code:
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;my $auth = $self-&gt;routes;
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;$auth-&gt;route('/main')-&gt;via('<wbr>get')-&gt;to('main#index');
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;$auth-&gt;route('/main')-&gt;via('<wbr>post')-&gt;to('main#post_login');
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;my $r = $auth-&gt;bridge-&gt;to('<wbr>UserAuthUtil#check');
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;$r-&gt;route('/')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;$r-&gt;route('/main')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;$r-&gt;post('/login')-&gt;to('main#<wbr>post_login');
<br>&gt;&gt; &gt; &nbsp; &nbsp; &nbsp;$r-&gt;post('/logout')-&gt;to('<wbr>main#logout');
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; There are more routes need to be added in $r after this.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Thanks &amp; Regards,
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Amit Khurana
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; On Thursday, October 4, 2012 8:08:08 PM UTC+5:30, Charlie Brady wrote:
<br>&gt;&gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; If you want some help, I suggest you provide more detail that "it
<br>&gt;&gt; &gt;&gt; didn't
<br>&gt;&gt; &gt;&gt; worked" and "its[ not working".
<br>&gt;&gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; On Thu, 4 Oct 2012, Amit wrote:
<br>&gt;&gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; Hi All,
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; I apologize to reopen this thread again. Due to some other priority
<br>&gt;&gt; &gt;&gt; &gt; work, I
<br>&gt;&gt; &gt;&gt; &gt; had to leave this but now I am back again on this. I tried the way
<br>&gt;&gt; &gt;&gt; &gt; byterock
<br>&gt;&gt; &gt;&gt; &gt; explained. But it didn't worked. I'll again explain my form with
<br>&gt;&gt; &gt;&gt; &gt; code.
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; My Login and logout form is the same one (main). It has a small
<br>&gt;&gt; &gt;&gt; &gt; section
<br>&gt;&gt; &gt;&gt; &gt; on
<br>&gt;&gt; &gt;&gt; &gt; top which contains credential textboxes and login button. When the
<br>&gt;&gt; &gt;&gt; &gt; user
<br>&gt;&gt; &gt;&gt; &gt; is
<br>&gt;&gt; &gt;&gt; &gt; successfully logged in, that section is hidden and logout button
<br>&gt;&gt; &gt;&gt; &gt; appears.
<br>&gt;&gt; &gt;&gt; &gt; Code:
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; my $auth = $self-&gt;routes;
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; $auth-&gt;route('/main')-&gt;via('<wbr>get')-&gt;to('main#index');
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; $auth-&gt;route('/main')-&gt;via('<wbr>post')-&gt;to('main#post_login');
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; #
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; my $r = $auth-&gt;bridge-&gt;to('<wbr>UserAuthUtil#check');
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; $r-&gt;route('/')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; $r-&gt;route('/main')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; $r-&gt;post('/login')-&gt;to('main#<wbr>post_login');
<br>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; $r-&gt;post('/logout')-&gt;to('main#<wbr>logout');
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; Not sure what I am doing wrong here but its not working.
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; Thanks &amp; Regards,
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; Amit Khurana
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; On Friday, August 3, 2012 10:48:38 AM UTC+5:30, Amit wrote:
<br>&gt;&gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt; Thanks all for your valuable inputs.
<br>&gt;&gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt; Amit
<br>&gt;&gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt; On Wednesday, August 1, 2012 4:30:41 PM UTC+5:30, byterock wrote:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; Try if like i shoewed before with a named route to some place. &nbsp;A
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; general
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; catchall or redirect to &nbsp;'/' is never a good idea
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; so in your controller you would have something like this
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp; $r-&gt;route('/login') &nbsp;-&gt;via('get')
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; -&gt;to('authn#form')-&gt;name('<wbr>authn_form');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp; $r-&gt;route('/login') &nbsp;-&gt;via('post')-&gt;to('authn#<wbr>login');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp; my $rb = $r-&gt;bridge-&gt;to('authn#check');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp; $mb-&gt;route('/main')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; and in Authn.pm
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; sub check {
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp;my $self = shift;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; $self-&gt;redirect_to('authn_<wbr>form') and return 0
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp; &nbsp;unless($self-&gt;is_user_<wbr>authenticated);
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp; return 1;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; }
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &nbsp;_____________________________<wbr>___
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Date: Tue, 31 Jul 2012 23:15:17 -0700
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; From:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; To: <a>mojol...@googlegroups.com</a>
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Subject: Re: [Mojolicious] Authenticating Routes
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Hi Jay,
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; I had tried that also. But, I have this in my check():
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; sub check {
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; my $self = shift;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $self-&gt;redirect_to("/") and return 0
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; unless($self-&gt;is_user_<wbr>authenticated);
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; return 1;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; }
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; So when I enter credentials and click Submit, it calls check
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; first
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; and
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; redirects me back to the root. i.e. it does not call
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; "post_login"
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; method.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Thanks,
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Amit
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; On Tuesday, July 31, 2012 7:02:52 PM UTC+5:30, jay m wrote:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; the page with your login form needs to be accessible by
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; unauthenticated
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; users. the way you have it now, when you redirect to / it sends
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; you
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; back through the bridge again, and again, and again... something
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; like
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; this will work:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; my $public = $self-&gt;routes;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; my $r = $public-&gt;bridge-&gt;to('main#<wbr>check');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $public-&gt;route('/')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $r-&gt;route('/main')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; On Tuesday, July 31, 2012 3:32:54 AM UTC-4, Amit wrote:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Thanks John and David. Actually my main has a section which
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; renders
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; another small login section based on user is authenticated or
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; not.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; So I
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; login page is the same as my logout page. I made that small
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; change
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; in
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; the check() but now I am getting too many redirects error.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; I have:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; my $auth = $self-&gt;routes;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; my $r = $auth-&gt;bridge('/')-&gt;to('main#<wbr>check');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $r-&gt;route('/')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $r-&gt;route('/main')-&gt;to('main#<wbr>index');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Last 2 lines of code, because I want user to logon and display
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; information upon successful login. And second is when user
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; clicks
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; on
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; menu "Main".
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; So if in check(), I put:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $self-&gt;redirect_to("/") and return 0
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; unless($self-&gt;is_user_<wbr>authenticated); , or
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $self-&gt;redirect_to("/main") and return 0
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; unless($self-&gt;is_user_<wbr>authenticated);
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; I get too many redirects error.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Thanks in advance
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Amit
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; On Monday, July 30, 2012 4:18:37 PM UTC+5:30, byterock wrote:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; that won't realy work on a bridge as a bridge just goes to the
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; controller it is not condtional route
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; try this in you check
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; sub check {
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; my $self = shift;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $self-&gt;redirect_to('not_authn'<wbr>) and return 0
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; unless($self-&gt;is_user_<wbr>authenticated);
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; return 1;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; }
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; where not_authn is a template or named route that you want your
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; user to
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; go to when they are not authenticated
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; A condtionaly controller works like this
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; $r-&gt;route('/home')-&gt;over(<wbr>authenticated =&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; 1)-&gt;to('example#home')-&gt;name('<wbr>home');
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; however what you want(catch all) is what you have now with the
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; small
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; change above
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Cheers
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; John
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; ______________________________<wbr>__
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; Date: Mon, 30 Jul 2012 03:37:07 -0700
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; From:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; To:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; <a>mojol...@googlegroups.com</a>&lt;<wbr>mailto:<a>mojol...@googlegroups.<wbr>com</a>&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; Subject: Re: [Mojolicious] Authenticating Routes
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; Thanks David for the info. Following is the code inside check:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; sub check {
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; my $self = shift;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; return 0 unless($self-&gt;is_user_<wbr>authenticated);
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; return 1;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; }
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; On Monday, July 30, 2012 1:26:51 PM UTC+5:30, David Oswald
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; wrote:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; &gt; 'main', Main::check, main::check, Main::check,
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; &gt; main::check code (pay attention to capitalization).
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; You see, even after talking about it, I still am getting it
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; mixed
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; up.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; 'main' vs 'Main'. ...that controller name is begging to be
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; changed to
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; something that doesn't resemble Perl's default package. ;)
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; --
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; David Oswald
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; --
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; You received this message because you are subscribed to the
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; Google
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; Groups "Mojolicious" group.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; To view this discussion on the web visit
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; <a href="https://groups.google.com/d/msg/mojolicious/-/_uy0fIj3haIJ" target="_blank">https://groups.google.com/d/<wbr>msg/mojolicious/-/_uy0fIj3haIJ</a><wbr>.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; To post to this group, send email to
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; <a>mojol...@googlegroups.com</a>&lt;<wbr>mailto:<a>mojol...@googlegroups.<wbr>com</a>&gt;.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; To unsubscribe from this group, send email to
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; <a>mojolicious...@googlegroups.<wbr>com</a>&lt;mailto:
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; <a>mojolicious%...@googlegroups.<wbr>com</a>&gt;.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; For more options, visit this group at
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; <a href="http://groups.google.com/group/mojolicious?hl=en" target="_blank">http://groups.google.com/<wbr>group/mojolicious?hl=en</a>.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; --
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; You received this message because you are subscribed to the
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Google
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; Groups "Mojolicious" group.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; To view this discussion on the web visit
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; <a href="https://groups.google.com/d/msg/mojolicious/-/AnH1vfcVzzoJ" target="_blank">https://groups.google.com/d/<wbr>msg/mojolicious/-/AnH1vfcVzzoJ</a><wbr>.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; To post to this group, send email to <a>mojol...@googlegroups.com</a>.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; To unsubscribe from this group, send email to
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; <a>mojolicious...@googlegroups.<wbr>com</a>.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; For more options, visit this group at
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt; &gt; <a href="http://groups.google.com/group/mojolicious?hl=en" target="_blank">http://groups.google.com/<wbr>group/mojolicious?hl=en</a>.
<br>&gt;&gt; &gt;&gt; &gt; &gt;&gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;&gt; &gt;
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; --
<br>&gt;&gt; &gt; You received this message because you are subscribed to the Google
<br>&gt;&gt; &gt; Groups
<br>&gt;&gt; &gt; "Mojolicious" group.
<br>&gt;&gt; &gt; To view this discussion on the web visit
<br>&gt;&gt; &gt; <a href="https://groups.google.com/d/msg/mojolicious/-/y09M4gItKSEJ" target="_blank">https://groups.google.com/d/<wbr>msg/mojolicious/-/y09M4gItKSEJ</a><wbr>.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; To post to this group, send email to <a>mojol...@googlegroups.com</a>.
<br>&gt;&gt; &gt; To unsubscribe from this group, send email to
<br>&gt;&gt; &gt; <a>mojolicious...@googlegroups.<wbr>com</a>.
<br>&gt;&gt; &gt; For more options, visit this group at
<br>&gt;&gt; &gt; <a href="http://groups.google.com/group/mojolicious?hl=en" target="_blank">http://groups.google.com/<wbr>group/mojolicious?hl=en</a>.
<br>&gt;
<br>&gt; --
<br>&gt; You received this message because you are subscribed to the Google Groups
<br>&gt; "Mojolicious" group.
<br>&gt; To view this discussion on the web visit
<br>&gt; <a href="https://groups.google.com/d/msg/mojolicious/-/LiM2MGKGwDQJ" target="_blank">https://groups.google.com/d/<wbr>msg/mojolicious/-/LiM2MGKGwDQJ</a><wbr>.
<br>&gt;
<br>&gt; To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="4dht-K1RyacJ">mojol...@googlegroups.com</a>.
<br>&gt; To unsubscribe from this group, send email to
<br>&gt; <a href="javascript:" target="_blank" gdf-obfuscated-mailto="4dht-K1RyacJ">mojolicious...@<wbr>googlegroups.com</a>.
<br>&gt; For more options, visit this group at
<br>&gt; <a href="http://groups.google.com/group/mojolicious?hl=en" target="_blank">http://groups.google.com/<wbr>group/mojolicious?hl=en</a>.
<br></blockquote></div>
------=_Part_336_15766791.1349417958202--

------=_Part_335_7431746.1349417958202--