mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-08-30 03:57:29 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 37983bf675 | |||
| 1a941f0c86 | |||
| c6f1f47481 |
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.4
|
|
||||||
- 5.5
|
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
- 7.2
|
||||||
|
- 7.3
|
||||||
|
- 7.4
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer install
|
- composer install
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ PHP library for [two-factor (or multi-factor) authentication](http://en.wikipedi
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* Tested on PHP 5.4 up to 7.2
|
* Tested on PHP 5.6 up to 7.4
|
||||||
* [cURL](http://php.net/manual/en/book.curl.php) when using the provided `ImageChartsQRCodeProvider` (default), `QRServerProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
|
* [cURL](http://php.net/manual/en/book.curl.php) when using the provided `ImageChartsQRCodeProvider` (default), `QRServerProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
|
||||||
* [random_bytes()](http://php.net/manual/en/function.random-bytes.php), [MCrypt](http://php.net/manual/en/book.mcrypt.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.
|
* [random_bytes()](http://php.net/manual/en/function.random-bytes.php), [MCrypt](http://php.net/manual/en/book.mcrypt.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "robthree/twofactorauth",
|
"name": "robthree/twofactorauth",
|
||||||
"description": "Two Factor Authentication",
|
"description": "Two Factor Authentication",
|
||||||
"version": "1.6.7",
|
"version": "1.7.0",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"keywords": [ "Authentication", "Two Factor Authentication", "Multi Factor Authentication", "TFA", "MFA", "PHP", "Authenticator", "Authy" ],
|
"keywords": [ "Authentication", "Two Factor Authentication", "Multi Factor Authentication", "TFA", "MFA", "PHP", "Authenticator", "Authy" ],
|
||||||
"homepage": "https://github.com/RobThree/TwoFactorAuth",
|
"homepage": "https://github.com/RobThree/TwoFactorAuth",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"source": "https://github.com/RobThree/TwoFactorAuth"
|
"source": "https://github.com/RobThree/TwoFactorAuth"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.6.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "@stable"
|
"phpunit/phpunit": "@stable"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class NTPTimeProvider implements ITimeProvider
|
|||||||
public $port;
|
public $port;
|
||||||
public $timeout;
|
public $timeout;
|
||||||
|
|
||||||
function __construct($host = 'pool.ntp.org', $port = 123, $timeout = 1)
|
function __construct($host = 'time.google.com', $port = 123, $timeout = 1)
|
||||||
{
|
{
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ class NTPTimeProvider implements ITimeProvider
|
|||||||
try {
|
try {
|
||||||
/* Create a socket and connect to NTP server */
|
/* Create a socket and connect to NTP server */
|
||||||
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||||
|
socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, ['sec' => $this->timeout, 'usec' => 0]);
|
||||||
socket_connect($sock, $this->host, $this->port);
|
socket_connect($sock, $this->host, $this->port);
|
||||||
|
|
||||||
/* Send request */
|
/* Send request */
|
||||||
@@ -35,7 +36,8 @@ class NTPTimeProvider implements ITimeProvider
|
|||||||
socket_send($sock, $msg, strlen($msg), 0);
|
socket_send($sock, $msg, strlen($msg), 0);
|
||||||
|
|
||||||
/* Receive response and close socket */
|
/* Receive response and close socket */
|
||||||
socket_recv($sock, $recv, 48, MSG_WAITALL);
|
if (socket_recv($sock, $recv, 48, MSG_WAITALL) === false)
|
||||||
|
throw new \Exception(socket_strerror(socket_last_error($sock)));
|
||||||
socket_close($sock);
|
socket_close($sock);
|
||||||
|
|
||||||
/* Interpret response */
|
/* Interpret response */
|
||||||
@@ -49,4 +51,4 @@ class NTPTimeProvider implements ITimeProvider
|
|||||||
throw new \TimeException(sprintf('Unable to retrieve time from %s (%s)', $this->host, $ex->getMessage()));
|
throw new \TimeException(sprintf('Unable to retrieve time from %s (%s)', $this->host, $ex->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user