6
6
7
7
use App \Repository \UserRepository ;
8
8
use Doctrine \ORM \Mapping as ORM ;
9
- use Scheb \TwoFactorBundle \Model \Email \TwoFactorInterface as TwoFactorInterfaceEmail ;
10
9
use Scheb \TwoFactorBundle \Model \Totp \TotpConfiguration ;
11
10
use Scheb \TwoFactorBundle \Model \Totp \TotpConfigurationInterface ;
12
11
use Scheb \TwoFactorBundle \Model \Totp \TwoFactorInterface as TwoFactorInterfaceTotp ;
13
12
use Symfony \Component \Security \Core \User \PasswordAuthenticatedUserInterface ;
14
13
use Symfony \Component \Security \Core \User \UserInterface ;
15
14
use Symfony \Component \Uid \Uuid ;
16
15
use DateTimeImmutable ;
17
- use LogicException ;
18
16
19
17
#[ORM \Entity(repositoryClass: UserRepository::class)]
20
18
#[ORM \Table(name: '`user` ' )]
21
19
#[ORM \UniqueConstraint(name: 'UNIQ_IDENTIFIER_UUID ' , fields: ['uuid ' ])]
22
20
#[ORM \UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL ' , fields: ['email ' ])]
23
- class User implements PasswordAuthenticatedUserInterface, TwoFactorInterfaceEmail, TwoFactorInterfaceTotp, UserInterface
21
+ class User implements PasswordAuthenticatedUserInterface, TwoFactorInterfaceTotp, UserInterface
24
22
{
25
23
#[ORM \Id]
26
24
#[ORM \GeneratedValue]
@@ -45,15 +43,9 @@ class User implements PasswordAuthenticatedUserInterface, TwoFactorInterfaceEmai
45
43
#[ORM \Column(nullable: true )]
46
44
private ?DateTimeImmutable $ lastLoginAt = null ;
47
45
48
- #[ORM \Column]
49
- private bool $ twoFactorsAuthenticationEmailEnabled = false ;
50
-
51
46
#[ORM \Column]
52
47
private bool $ twoFactorsAuthenticationTotpEnabled = false ;
53
48
54
- #[ORM \Column(nullable: true )]
55
- private ?string $ twoFactorsAuthenticationEmailCode = null ;
56
-
57
49
#[ORM \Column(nullable: true )]
58
50
private ?string $ twoFactorsAuthenticationTotpSecret = null ;
59
51
@@ -143,15 +135,6 @@ public function setLastLoginAt(): self
143
135
return $ this ;
144
136
}
145
137
146
- public function getEmailAuthCode (): ?string
147
- {
148
- if (null === $ this ->twoFactorsAuthenticationEmailCode ) {
149
- throw new LogicException ('The email authentication code was not set ' );
150
- }
151
-
152
- return $ this ->twoFactorsAuthenticationEmailCode ;
153
- }
154
-
155
138
public function isTotpAuthenticationEnabled (): bool
156
139
{
157
140
return $ this ->twoFactorsAuthenticationTotpEnabled && null !== $ this ->twoFactorsAuthenticationTotpSecret ;
@@ -176,21 +159,6 @@ public function getTotpAuthenticationConfiguration(): ?TotpConfigurationInterfac
176
159
);
177
160
}
178
161
179
- public function hasTwoFactorsAuthentication (): bool
180
- {
181
- return $ this ->twoFactorsAuthenticationEmailEnabled ;
182
- }
183
-
184
- public function getEmailAuthRecipient (): string
185
- {
186
- return $ this ->email ;
187
- }
188
-
189
- public function setEmailAuthCode (string $ authCode ): void
190
- {
191
- $ this ->twoFactorsAuthenticationEmailCode = $ authCode ;
192
- }
193
-
194
162
public function setTwoFactorsAuthenticationTotpSecret (?string $ secret ): self
195
163
{
196
164
$ this ->twoFactorsAuthenticationTotpSecret = $ secret ;
@@ -208,9 +176,4 @@ public function enableTwoFactorsAuthenticationTotp(): void
208
176
{
209
177
$ this ->twoFactorsAuthenticationTotpEnabled = true ;
210
178
}
211
-
212
- public function enableTwoFactorsAuthenticationEmail (): void
213
- {
214
- $ this ->twoFactorsAuthenticationEmailEnabled = true ;
215
- }
216
179
}
0 commit comments