route + verification key

85 views
Skip to first unread message

Thomas Steindl

unread,
Mar 6, 2020, 4:21:26 PM3/6/20
to Fat-Free Framework
Hey,

1. user registers account on: website/register
2. he gets an email sent to the email he provided
3. the email contains the link for verification 
4. user clicks the link and gets sent to website/register/verify.php?vkey=91cb65b234b0b5d67df68e0d7f72ed7e

test result: 

Not Found

HTTP 404 (GET /register/verify.php?vkey=91cb65b234b0b5d67df68e0d7f72ed7e)


How do I manage that in routing?
What I tried:
$f3->route('GET /register/verify/@vkey''Controller\UserController->registerverified');
$f3->route('GET /register/verify.php?vkey=''Controller\UserController->registerverified');

I`m confused, how to set the route since the paramater is dynamic obviously?


Thanks!!

ved

unread,
Mar 6, 2020, 7:12:38 PM3/6/20
to Fat-Free Framework
Hi,

Why even send the user that "/register/verify.php?vkey=somekey" in the first place?

Why not just send the customer a "/register/verify/somekey" link and handle it inside the registerverified() method?

tl;dr: Do not use any ".php" directly on your routes.

Cheers.

Thomas Steindl

unread,
Mar 7, 2020, 4:22:57 AM3/7/20
to f3-fra...@googlegroups.com
Hi,

because I save the verification key when the user registers.
And when the user comes back (after clicking the link within the email) I check if the vkey isset; and get the stored vkey from db and compare both. If they match, all good, user gets rerouted.
I don´t know how I would achieve that using your proposal ( "/register/verify/somekey" ).

Thanks

Paul Herring

unread,
Mar 7, 2020, 7:14:05 AM3/7/20
to Thomas Steindl via Fat-Free Framework, Fat-Free Framework
On Sat, Mar 7, 2020 at 9:22 AM Thomas Steindl via Fat-Free Framework <f3-framework+APn2wQcAIZ5Opuv3-Kj...@googlegroups.com> wrote:
Hi,

because I save the verification key whe the user registers.
And when the user comes back (after clicking the link within the email) I check if the vkey isset; and get the stored vkey from db and compare both. If they match, all good, user gets rerouted.
I don´t know how I would achieve that using your proposal ( "/register/verify/somekey" ).

$f3->route('GET /register/verify/@key', 'Controller\UserController->registerverified');

function registerverified($f3, $params){

... $key = $params['key'];

}

 

Thanks


On Saturday, 7 March 2020 01:12:38 UTC+1, ved wrote:
Hi,

Why even send the user that "/register/verify.php?vkey=somekey" in the first place?

Why not just send the customer a "/register/verify/somekey" link and handle it inside the registerverified() method?

tl;dr: Do not use any ".php" directly on your routes.

Cheers.

--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/06272eae-50bf-4727-837c-972ae3cbe042%40googlegroups.com.


--
PJH

ikkez

unread,
Mar 7, 2020, 10:22:45 AM3/7/20
to Fat-Free Framework
get parameters are not part of the route ( ?vkey= ) .. you access them via f3->GET
also naming a route like a php file could cause issues with apache and htaccess

ved

unread,
Mar 7, 2020, 10:22:46 AM3/7/20
to Fat-Free Framework
Hi,

What @PJH said or alternatively (depending on your app or if you don't want to keep passing $f3 and/or $params on all your methods) something like:

$f3 = \Base::instance();  // or get your F3 instance from someplace else
$key
= $f3->get('PARAMS.vkey');

But do read the docs as recommended.

Cheers.

Thomas Steindl

unread,
Mar 7, 2020, 4:29:28 PM3/7/20
to Fat-Free Framework
It´s what PJH said.
$f3->route('GET /register/verify/@vkey''Controller\UserController->registerverified');
and afterwards check if isset
$params['vkey']

Cheers, thanks again for your prompt replies!
Reply all
Reply to author
Forward
0 new messages