/** * @param UserInterface $user * * @return string */ public function getUrl(UserInterface $user) { return $this->authenticator->getUrl($user->getUsername(), $this->server, $user->getTwoStepVerificationCode()); }
/** * Get the QR code url * @return string */ public function getURL() { return $this->googleAuthenticator->getUrl("admin", $this->serviceName, $this->secret); }
public function testGetUrl() { $url = $this->helper->getUrl('foo', 'foobar.org', '3DHTQX4GCRKHGS55CJ'); $expected = "https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/foo@foobar.org%3Fsecret%3D3DHTQX4GCRKHGS55CJ"; $this->assertEquals($expected, $url); }