Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit eac11fa

Browse files
committed
Merge branch 'develop' into master
2 parents 51927e1 + 56ed4f5 commit eac11fa

File tree

8 files changed

+52
-10
lines changed

8 files changed

+52
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The first route is the route the user will be redirected to once the two-factor
163163
* Log out the user and start the two factor authentication state.
164164
*
165165
* @param \Illuminate\Http\Request $request
166-
* @param \App\User $user
166+
* @param \App\Models\User $user
167167
* @return \Illuminate\Http\Response
168168
*/
169169
private function startTwoFactorAuthProcess(Request $request, $user)
@@ -185,7 +185,7 @@ The first route is the route the user will be redirected to once the two-factor
185185
* Provider specific two-factor authentication logic. In the case of MessageBird
186186
* we just want to send an authentication token via SMS.
187187
*
188-
* @param \App\User $user
188+
* @param \App\Models\User $user
189189
* @return mixed
190190
*/
191191
private function registerUserAndSendToken(User $user)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "package",
88
"minimum-stability": "dev",
99
"require": {
10-
"illuminate/support": "^5.5.0 || ^6.0 || ^7.0"
10+
"illuminate/support": "^8.0"
1111
},
1212
"extra": {
1313
"laravel": {
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<?php
22

3-
namespace MichaelDzjap\TwoFactorAuth;
3+
namespace MichaelDzjap\TwoFactorAuth\Models;
44

5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use Illuminate\Database\Eloquent\Factories\HasFactory;
57
use Illuminate\Database\Eloquent\Model;
68
use Illuminate\Database\Eloquent\Relations\BelongsTo;
79

810
class TwoFactorAuth extends Model
911
{
12+
use HasFactory;
13+
1014
/**
1115
* The reference to the user model.
1216
*
@@ -64,4 +68,14 @@ private function model(): string
6468

6569
return $this->model;
6670
}
71+
72+
/**
73+
* Create a new factory instance for the model.
74+
*
75+
* @return \Illuminate\Database\Eloquent\Factories\Factory
76+
*/
77+
protected static function newFactory(): Factory
78+
{
79+
return \MichaelDzjap\TwoFactorAuth\Database\Factories\TwoFactorAuthFactory::new();
80+
}
6781
}

src/TwoFactorAuthManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function provider(string $driver = null): TwoFactorProvider
2929
protected function createMessageBirdDriver(): TwoFactorProvider
3030
{
3131
return new MessageBirdVerify(
32-
new Client($this->app['config']['twofactor-auth.providers.messagebird.key'])
32+
new Client($this->config['twofactor-auth.providers.messagebird.key'])
3333
);
3434
}
3535

@@ -50,7 +50,7 @@ protected function createNullDriver(): TwoFactorProvider
5050
*/
5151
public function getDefaultDriver(): string
5252
{
53-
return $this->app['config']['twofactor-auth.default'];
53+
return $this->config['twofactor-auth.default'];
5454
}
5555

5656
/**
@@ -61,6 +61,6 @@ public function getDefaultDriver(): string
6161
*/
6262
public function setDefaultDriver(string $name): void
6363
{
64-
$this->app['config']['twofactor-auth.default'] = $name;
64+
$this->config['twofactor-auth.default'] = $name;
6565
}
6666
}

src/TwoFactorAuthenticable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getMobile(): string
2727
public function twoFactorAuth(): HasOne
2828
{
2929
return $this->hasOne(
30-
\MichaelDzjap\TwoFactorAuth\TwoFactorAuth::class, 'user_id', $this->getKeyName()
30+
\MichaelDzjap\TwoFactorAuth\Models\TwoFactorAuth::class, 'user_id', $this->getKeyName()
3131
);
3232
}
3333

src/config/twofactor-auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@
9292
|
9393
*/
9494

95-
'model' => \App\User::class,
95+
'model' => \App\Models\User::class,
9696

9797
];
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace MichaelDzjap\TwoFactorAuth\Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use MichaelDzjap\TwoFactorAuth\Models\TwoFactorAuth;
7+
8+
class TwoFactorAuthFactory extends Factory
9+
{
10+
/**
11+
* The name of the factory's corresponding model.
12+
*
13+
* @var string
14+
*/
15+
protected $model = TwoFactorAuth::class;
16+
17+
/**
18+
* Define the model's default state.
19+
*
20+
* @return array
21+
*/
22+
public function definition(): array
23+
{
24+
return [
25+
'user_id' => config('twofactor-auth.model')::factory(),
26+
];
27+
}
28+
}

src/resources/views/form.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<label for="token" class="col-md-4 col-form-label text-md-right">@lang('twofactor-auth::twofactor-auth.label')</label>
1616

1717
<div class="col-md-6">
18-
<input id="token" type="text" class="form-control{{ $errors->has('token') ? ' is-invalid' : '' }}" name="token" value="{{ old('token') }}" required autofocus>
18+
<input id="token" type="text" autocomplete="one-time-code" class="form-control{{ $errors->has('token') ? ' is-invalid' : '' }}" name="token" value="{{ old('token') }}" required autofocus>
1919

2020
@if ($errors->has('token'))
2121
<span class="invalid-feedback" role="alert">

0 commit comments

Comments
 (0)