<![CDATA[ not working link in register new user with login addon and friendly url - My Forums]]> https://forums.modx.com/thread/?thread=44918 <![CDATA[Re: not working link in register new user with login addon and friendly url]]> https://forums.modx.com/thread/44918/not-working-link-in-register-new-user-with-login-addon-and-friendly-url#dis-post-533256 (http://php.net/manual/de/function.base64-encode.php)

function base64url_encode($data) { 
    return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); 
} 

function base64url_decode($data) { 
    return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); 
}
]]>
gadgetto Oct 15, 2015, 11:02 AM https://forums.modx.com/thread/44918/not-working-link-in-register-new-user-with-login-addon-and-friendly-url#dis-post-533256
<![CDATA[Re: not working link in register new user with login addon and friendly url]]> https://forums.modx.com/thread/44918/not-working-link-in-register-new-user-with-login-addon-and-friendly-url#dis-post-533248 Thanks alot for workaround!]]> gadgetto Oct 15, 2015, 10:29 AM https://forums.modx.com/thread/44918/not-working-link-in-register-new-user-with-login-addon-and-friendly-url#dis-post-533248 <![CDATA[not working link in register new user with login addon and friendly url]]> https://forums.modx.com/thread/44918/not-working-link-in-register-new-user-with-login-addon-and-friendly-url#dis-post-258281 we got a Error Code: 500 Internal Server Error. Friendly url off worked fine.
we thought that it had to do with the .htaccess.
// htaccess code
RewriteEngine On
RewriteBase /
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NE]


the link we have is "?lp=NjE5cWpyMm4%253D&lu=bWFydHluMg%253D%253D"
we saw that the url is encoded 2 times. Becauce %253D should be =
But the translation the first time "%3D" is "=" which is correct, but after the second loop it took "%3D" and translated the "%" into "%253D" because "%25" is equal to "%"

after we had remove d 1 encode and decode from the login code it worked .

//code from core/components/login/processors/register.php
change on line 122 and 123
$confirmParams['lp'] = urlencode(base64_encode($pword));
    $confirmParams['lu'] = urlencode(base64_encode($user->get('username')));

to
$confirmParams['lp'] = base64_encode($pword);
    $confirmParams['lu'] = base64_encode($user->get('username'));


//code from snippet ConfirmRegister
change on line 45 and 46
$username = base64_decode(urldecode(rawurldecode($_REQUEST['lu'])));
    $password = base64_decode(urldecode(rawurldecode($_REQUEST['lp'])));

to
$username = base64_decode(rawurldecode($_REQUEST['lu']));
    $password = base64_decode(rawurldecode($_REQUEST['lp']));


the url is now "?lp=NjE5cWpyMm4%3D&lu=bWFydHluMg%3D%3D"
this link is working with friendly url]]>
mpaalvast Jul 22, 2011, 07:18 AM https://forums.modx.com/thread/44918/not-working-link-in-register-new-user-with-login-addon-and-friendly-url#dis-post-258281