How to send user on to another page/template?
I am trying to learn dancer and have run across the following problem. In my starter app after a user logs in I want to send them to a welcome page. For now I am just trying to send them back to the index page. However, I am having problems doing so with the following syntax. I get: Error 404 - Not Found /index Powered by Dancer2 <http://perldancer.org/> 0.161000 Am I going about this the wrong way or is redirect the way to go and if so what would be the proper syntax to make redirect work? Thanks if ( passphrase( $input_hash->{Pswd} )->matches( $ctsn ) ) { redirect '/index'; } else { return "Incorrect Unsername of Password\n"; }
On Tue, 2015-08-18 at 16:21 -0500, Richard Reina wrote:
I am trying to learn dancer and have run across the following problem. In my starter app after a user logs in I want to send them to a welcome page. For now I am just trying to send them back to the index page. However, I am having problems doing so with the following syntax.
I get: Error 404 - Not Found /index
That means that you do not have a route that will handle /index, hence the 404.
Am I going about this the wrong way or is redirect the way to go and if so what would be the proper syntax to make redirect work?
redirect '/index';
Yep, that's correct in terms of the redirect. If you want to go to the "index" of your site (i.e. the root), then you probably want: redirect '/'; Regards, Andy
Wow! What a silly mistake on my part. Thank you so much for the insight Andy. That worked perfectly. 2015-08-18 18:47 GMT-05:00 Andrew Beverley <andy@andybev.com>:
On Tue, 2015-08-18 at 16:21 -0500, Richard Reina wrote:
I am trying to learn dancer and have run across the following problem. In my starter app after a user logs in I want to send them to a welcome page. For now I am just trying to send them back to the index page. However, I am having problems doing so with the following syntax.
I get: Error 404 - Not Found /index
That means that you do not have a route that will handle /index, hence the 404.
Am I going about this the wrong way or is redirect the way to go and if so what would be the proper syntax to make redirect work?
redirect '/index';
Yep, that's correct in terms of the redirect. If you want to go to the "index" of your site (i.e. the root), then you probably want:
redirect '/';
Regards,
Andy
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
participants (2)
-
Andrew Beverley -
Richard Reina