This repository was archived by the owner on Apr 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-21
lines changed Expand file tree Collapse file tree 3 files changed +19
-21
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace MichaelDzjap \TwoFactorAuth \Providers ;
4+
5+ abstract class BaseProvider
6+ {
7+ /**
8+ * Check if two-factor authentication is enabled for a user.
9+ *
10+ * @param User $user
11+ * @return bool
12+ */
13+ public function enabled (User $ user )
14+ {
15+ return !is_null ($ user ->twoFactorAuth );
16+ }
17+ }
Original file line number Diff line number Diff line change 1313use MichaelDzjap \TwoFactorAuth \Exceptions \TokenExpiredException ;
1414use MichaelDzjap \TwoFactorAuth \Exceptions \TokenInvalidException ;
1515
16- class MessageBirdVerify implements TwoFactorProvider, SMSToken
16+ class MessageBirdVerify extends BaseProvider implements TwoFactorProvider, SMSToken
1717{
1818 /**
1919 * MessageBird client instance.
@@ -33,17 +33,6 @@ public function __construct(Client $client)
3333 $ this ->client = $ client ;
3434 }
3535
36- /**
37- * Check if two-factor authentication is enabled for a user.
38- *
39- * @param User $user
40- * @return bool
41- */
42- public function enabled (User $ user )
43- {
44- return $ user ->twoFactorAuth ;
45- }
46-
4736 /**
4837 * Register a user with this provider.
4938 *
Original file line number Diff line number Diff line change 66use MichaelDzjap \TwoFactorAuth \Contracts \SMSToken ;
77use MichaelDzjap \TwoFactorAuth \Contracts \TwoFactorProvider ;
88
9- class NullProvider implements TwoFactorProvider, SMSToken
9+ class NullProvider extends BaseProvider implements TwoFactorProvider, SMSToken
1010{
11- /**
12- * {@inheritdoc}
13- */
14- public function enabled (User $ user )
15- {
16- return $ user ->twoFactorAuth ;
17- }
18-
1911 /**
2012 * {@inheritdoc}
2113 */
You can’t perform that action at this time.
0 commit comments