Laragear / TwoFactor

Two-Factor Authentication for all your users out-of-the-box.
https://github.com/sponsors/DarkGhostHunter
MIT License
273 stars 20 forks source link

Update README.md for Laravel UI #54

Closed jonathan-bird closed 1 year ago

jonathan-bird commented 1 year ago

Description

This readme updates provides more details to someone overriding in Laravel UI.

Code samples

For example, in Laravel UI, a basic example in the LoginController would be:

protected function validateLogin(Request $request)
{
    // If the user is trying for the first time, ensure both email and the password are
    // required to log in. If it's not, then he would issue its 2FA code. This ensures
    // the credentials are not required again when is just issuing his 2FA code alone.
    if ($request->isNotFilled('2fa_code')) {
        $request->validate([
            'email' => 'required|email',
            'password' => 'required|string'
        ]);
    }
}

protected function attemptLogin(Request $request)
{
    return Auth2FA::attempt($this->credentials($request), $request->filled('remember'));
}
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (0e3949e) 99.75% compared to head (b175218) 99.75%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## 1.x #54 +/- ## ========================================= Coverage 99.75% 99.75% Complexity 140 140 ========================================= Files 18 18 Lines 408 408 ========================================= Hits 407 407 Misses 1 1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.