-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call Auth2FA::attempt gives warning 'Non static method 'attempt' should not be called statically.' #34
Comments
That's clearly a bug on VS Code intelephense, because You can raise this issue on their repository of 500+ issues and pray it's fixed. |
If I do: Auth2FA::guard('admin')->attempt I get the warning on ::guard When doing Auth2FA::attempt I get the warning on attempt. The functions indeed return an instance from where the second call can be done using -> but it's the first call using the static :: that gives the warning. |
This is how it's done in Laravel's original Auth facade. In that case it has no warnings in VSCode. If you change to: /**
the warning is gone |
You're totally right. My mistake. Can you open a PR? I'm AFK right now. |
I created the PR. Hope I have done it right. It's the first time I use github. I normally use Bitbucket. Meanwhile I have a small other question. Totally unrelated: In the database table I see that a users email is used in the 'label' column and that is used as a label in the authenticator app. If every application does this, then it would be hard to distinguish in the authenticator app from which application it is. Would it be possible to get the APP_NAME in that column? Or at least send that to the auth app when pairing? |
Published. Thanks for the PR.
You mean these lines? You can change it to your app name like this: /**
* Returns the label for TOTP URI.
*
* @return string
*/
protected function twoFactorLabel(): string
{
return config('app.name') . ' - '. $this->getAttribute('email');
} I don't remember why I set the label to be the email, but I think now the format is |
Thanks. I'll override the method. Maybe it's an idea to make it a config option. Then it won't be a breaking change. Something like:
See PR #36 |
PHP & Platform
8.1.6 Windows
Database
mysqlnd 8.1.6
Laravel version
9.43.0
Have you done this?
Expectation
No warnings should be issued
Description
When using this line:
$attempt = Auth2FA::attempt($request->only('email', 'password'), $request->filled('remember'));
like in the documentation VSCode intelephense marks it as: "Non static method 'attempt' should not be called statically."
Reproduction
Stack trace & logs
No response
The text was updated successfully, but these errors were encountered: