public getQRContent ( Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface $user ) : string | ||
$user | Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface | |
return | string |
public function getQRContent(TwoFactorInterface $user)
{
$userAndHost = rawurlencode($user->getUsername()) . ($this->server ? '@' . rawurlencode($this->server) : '');
if ($this->issuer) {
$qrContent = sprintf('otpauth://totp/%s:%s?secret=%s&issuer=%s', rawurlencode($this->issuer), $userAndHost, $user->getGoogleAuthenticatorSecret(), rawurlencode($this->issuer));
} else {
$qrContent = sprintf('otpauth://totp/%s?secret=%s', $userAndHost, $user->getGoogleAuthenticatorSecret());
}
return $qrContent;
}