Skip to content

Commit

Permalink
docs: move session_auth_event_and_logging.md contents to authenticati…
Browse files Browse the repository at this point in the history
…on/session.md
  • Loading branch information
kenjis committed Sep 22, 2023
1 parent 4914538 commit 5567353
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 47 deletions.
55 changes: 50 additions & 5 deletions docs/references/authentication/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on their device. This is the standard password-based login used in most web site
secure remember-me feature, and more. This can also be used to handle authentication for
single page applications (SPAs).

## attempt()
## Method References

### attempt()

When a user attempts to login with their email and password, you would call the `attempt()` method
on the auth class, passing in their credentials.
Expand Down Expand Up @@ -44,7 +46,7 @@ to set a secure remember-me cookie.
$loginAttempt = auth()->remember()->attempt($credentials);
```

## check()
### check()

If you would like to check a user's credentials without logging them in, you can use the `check()`
method.
Expand All @@ -64,7 +66,7 @@ if (! $validCreds->isOK()) {

The Result instance returned contains the valid user as `extraInfo()`.

## loggedIn()
### loggedIn()

You can determine if a user is currently logged in with the aptly titled method, `loggedIn()`.

Expand All @@ -74,7 +76,7 @@ if (auth()->loggedIn()) {
}
```

## logout()
### logout()

You can call the `logout()` method to log the user out of the current session. This will destroy and
regenerate the current session, purge any remember-me tokens current for this user, and trigger a
Expand All @@ -84,7 +86,50 @@ regenerate the current session, purge any remember-me tokens current for this us
auth()->logout();
```

## forget()
### forget()

The `forget` method will purge all remember-me tokens for the current user, making it so they
will not be remembered on the next visit to the site.

## Events and Logging

The following is a list of Events and Logging for Session Authenticator.

### Register

- Default Register
- Post email/username/password
- OK → event `register` and `login`
- NG → no event
- Register with Email Activation
1. Post email/username/password
- OK → event `register`
- NG → no event
2. Post token
- OK → event `login`
- NG → no event

### Login

- Default Login
- Post email/password
- OK → event `login` / table `auth_logins`
- NG → event `failedLogin` / table `auth_logins`
- Email2FA Login
1. Post email/password
- OK → no event / table `auth_logins`
- NG → event `failedLogin` / table `auth_logins`
2. Post token
- OK → event `login`
- NG → no event
- Remember-me
- Send remember-me cookie w/o session cookie
- OK → no event
- NG → no event
- Magic-link
1. Post email
- OK → no event
- NG → no event
2. Send request with token
- OK → event `login` and `magicLogin` / table `auth_logins`
- NG → event `failedLogin` / table `auth_logins`
42 changes: 0 additions & 42 deletions docs/references/session_auth_event_and_logging.md

This file was deleted.

0 comments on commit 5567353

Please sign in to comment.