@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * Make a JSON response. |
15 | 15 | * |
16 | - * @param $statusCode |
|
16 | + * @param integer $statusCode |
|
17 | 17 | * |
18 | 18 | * @return IlluminateJsonResponse |
19 | 19 | */ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * Make a web response. |
48 | 48 | * |
49 | - * @param $statusCode |
|
49 | + * @param integer $statusCode |
|
50 | 50 | * |
51 | 51 | * @return \Illuminate\Http\Response |
52 | 52 | */ |
@@ -103,5 +103,10 @@ discard block |
||
103 | 103 | |
104 | 104 | abstract public function getRequest(); |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $string |
|
108 | + * |
|
109 | + * @return string|null |
|
110 | + */ |
|
106 | 111 | abstract protected function config($string, $children = []); |
107 | 112 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | if (!Schema::hasTable('2fa_tokens')) { |
41 | 41 | Schema::create( |
42 | 42 | '2fa_tokens', |
43 | - static function (Blueprint $table) { |
|
43 | + static function(Blueprint $table) { |
|
44 | 44 | $table->increments('id'); |
45 | 45 | $table->integer('user_id', false, true); |
46 | 46 | $table->datetime('expires_at'); |
@@ -298,7 +298,7 @@ |
||
298 | 298 | $token = null; |
299 | 299 | $unique = false; |
300 | 300 | $user = $this->getUser(); |
301 | - $expire = time() + (int)$this->config('cookie_lifetime'); |
|
301 | + $expire = time() + (int) $this->config('cookie_lifetime'); |
|
302 | 302 | while ($loops < 10 && false === $unique) { |
303 | 303 | $token = Str::random(64); |
304 | 304 | try { |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function register() |
35 | 35 | { |
36 | - $this->app->singleton('pragmarx.google2fa', function ($app) { |
|
36 | + $this->app->singleton('pragmarx.google2fa', function($app) { |
|
37 | 37 | return $app->make(Google2FA::class); |
38 | 38 | }); |
39 | 39 | } |
@@ -126,9 +126,9 @@ |
||
126 | 126 | |
127 | 127 | // check DB for token. |
128 | 128 | $count = DB::table('2fa_tokens') |
129 | - ->where('token', $token) |
|
130 | - ->where('expires_at', '>', $time) |
|
131 | - ->where('user_id', $this->getUser()->id)->count(); |
|
129 | + ->where('token', $token) |
|
130 | + ->where('expires_at', '>', $time) |
|
131 | + ->where('user_id', $this->getUser()->id)->count(); |
|
132 | 132 | |
133 | 133 | return 1 === $count; |
134 | 134 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * If stored in a cookie, what's the lifetime of the cookie? |
29 | 29 | * Max value is 3 months (8035200 seconds). |
30 | 30 | */ |
31 | - 'cookie_lifetime' => (int)env('OTP_COOKIE_LIFETIME', 8035200), |
|
31 | + 'cookie_lifetime' => (int) env('OTP_COOKIE_LIFETIME', 8035200), |
|
32 | 32 | |
33 | 33 | /* |
34 | 34 | * Name of the cookie. |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | if (false === $cookieResult && true === $authResult) { |
32 | 32 | $cookieName = config('google2fa.cookie_name') ?? 'google2fa_token'; |
33 | - $lifetime = (int)(config('google2fa.cookie_lifetime') ?? 8035200); |
|
33 | + $lifetime = (int) (config('google2fa.cookie_lifetime') ?? 8035200); |
|
34 | 34 | $lifetime = $lifetime > 8035200 ? 8035200 : $lifetime; |
35 | 35 | $token = $authenticator->sessionGet(Constants::SESSION_TOKEN); |
36 | 36 | $response->withCookie(cookie()->make($cookieName, $token, $lifetime / 60)); |