Skip to content

Commit

Permalink
Fix: Use rawurlencode to encode spaces correctly
Browse files Browse the repository at this point in the history
Fix of the first fix. PHP's urlencode uses '+' to encode spaces which
is not valid in the url path section. The rawurlencode function is the
PHP function that does it right.
  • Loading branch information
weyhmueller committed May 17, 2021
1 parent 03fc19b commit a481e09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/GoogleAuthenticatorDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getQrCodeSecretKeyFile($requirePinCode = false)
}

return $this->renderFile([
'qrCodeText' => 'otpauth://totp/' . Yii::$app->request->hostName . ':' . urlencode(TwofaHelper::getAccountName()) . '?secret=' . $secret . '&issuer=' . Yii::$app->request->hostName,
'qrCodeText' => 'otpauth://totp/' . Yii::$app->request->hostName . ':' . rawurlencode(TwofaHelper::getAccountName()) . '?secret=' . $secret . '&issuer=' . Yii::$app->request->hostName,
'secret' => $secret,
'requirePinCode' => $requirePinCode,
], ['suffix' => 'Code']);
Expand Down

0 comments on commit a481e09

Please sign in to comment.