Valid special characters in email address like + do not work

Permalink Browser Info Environment
If a user has an email address such as
test+1@example.com
when they are logging in they are redirected to a url similar to:
/login/callback/concrete/two_step_authentication_advanced/test%201%40example.com/


It appears that the first parameter would translate to
test 1@example.com
without the + symbol. In
Kalmoya\TwoStepAdvanced\Overrides\Authentication\Concrete\Controller:42
when trying to load the $userInfo by email address the user cannot be found.

A quick workaround is to add
$uName = str_replace(' ', '+', $uName);
but this only works for plus symbols and is incorrect as we can't assume that all spaces should be a +.

Let me know if you need any other details

Type: Ticket
Status: Resolved
triplei
View Replies:
mnakalay replied on at Permalink Reply
mnakalay
Hello again, and thank you for finding this issue :)

I don't have much control over how the URL is generated, that's concrete core stuff, so I'm thinking about 2 possibilities:

The first one would be to assume concrete is doing something wrong (can't imagine what) and encode the email myself before adding it to the URL, hoping concrete doesn't further process it.

The second one is to slice the Gordian knot and send it base64 encoded instead of in clear. Like that, it's all numbers and letters and easy to decode on arrival.

Would you agree the second option is best?
mnakalay replied on at Permalink Reply
mnakalay
Correction, base64 might add = / and + signs in the string so that's not going to work...
I need a different reversible encoding...
mnakalay replied on at Permalink Reply
mnakalay
Me again...

It seems that a library is included in my package (and also in concrete's core) that has methods base64UrlSafeEncode() and base64UrlSafeDecode() so this seems promising
mnakalay replied on at Permalink Reply
mnakalay
This was taken care of

concrete5 Environment Information

N/A

Browser User-Agent String

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.