Skip to content

Commit b7b6720

Browse files
authored
Merge pull request #403 from kenjis/fix-docs-quickstart.md
docs: change section order in quickstart.md
2 parents e75a492 + b4a9d82 commit b7b6720

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

docs/quickstart.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ NOTE: The examples assume that you have run the setup script and that you have c
66

77
- [Quick Start Guide](#quick-start-guide)
88
- [Authentication Flow](#authentication-flow)
9-
- [Customize login redirect](#customize-login-redirect)
109
- [Customize register redirect](#customize-register-redirect)
10+
- [Customize login redirect](#customize-login-redirect)
1111
- [Customize logout redirect](#customize-logout-redirect)
1212
- [Customize Remember-me functionality](#customize-remember-me-functionality)
1313
- [Change Access Token Lifetime](#change-access-token-lifetime)
14-
- [Enable Two-Factor Authentication](#enable-two-factor-authentication)
1514
- [Enable Account Activation via Email](#enable-account-activation-via-email)
15+
- [Enable Two-Factor Authentication](#enable-two-factor-authentication)
1616
- [Authorization Flow](#authorization-flow)
1717
- [Change Available Groups](#change-available-groups)
1818
- [Set the Default Group](#set-the-default-group)
@@ -42,29 +42,29 @@ public array $redirects = [
4242

4343
NOTE: This redirect happens after the specified action is complete. In the case of register or login, it might not happen immediately. For example, if you have any Auth Actions specified, they will be redirected when those actions are completed successfully. If no Auth Actions are specified, they will be redirected immediately after registration or login.
4444

45-
### Customize login redirect
45+
### Customize register redirect
4646

47-
You can further customize where a user is redirected to on login with the `loginRedirect` method of the `Auth` config file. This is handy if you want to redirect based on user group or other criteria.
47+
You can customize where a user is redirected to after registration in the `registerRedirect` method of the `Auth` config file.
4848

4949
```php
50-
public function loginRedirect(): string
50+
public function registerRedirect(): string
5151
{
52-
$url = auth()->user()->inGroup('admin')
53-
? '/admin'
54-
: setting('Auth.redirects')['login'];
52+
$url = setting('Auth.redirects')['register'];
5553

5654
return $this->getUrl($url);
5755
}
5856
```
5957

60-
### Customize register redirect
58+
### Customize login redirect
6159

62-
You can customize where a user is redirected to after registration in the `registerRedirect` method of the `Auth` config file.
60+
You can further customize where a user is redirected to on login with the `loginRedirect` method of the `Auth` config file. This is handy if you want to redirect based on user group or other criteria.
6361

6462
```php
65-
public function registerRedirect(): string
63+
public function loginRedirect(): string
6664
{
67-
$url = setting('Auth.redirects')['register'];
65+
$url = auth()->user()->inGroup('admin')
66+
? '/admin'
67+
: setting('Auth.redirects')['login'];
6868

6969
return $this->getUrl($url);
7070
}
@@ -104,17 +104,6 @@ By default, Access Tokens can be used for 1 year since the last use. This can be
104104
public int $unusedTokenLifetime = YEAR;
105105
```
106106

107-
### Enable Two-Factor Authentication
108-
109-
Turned off by default, Shield's Email-based 2FA can be enabled by specifying the class to use in the `Auth` config file.
110-
111-
```php
112-
public array $actions = [
113-
'register' => null,
114-
'login' => 'CodeIgniter\Shield\Authentication\Actions\Email2FA',
115-
];
116-
```
117-
118107
### Enable Account Activation via Email
119108

120109
By default, once a user registers they have an active account that can be used. You can enable Shield's built-in, email-based activation flow within the `Auth` config file.
@@ -126,8 +115,16 @@ public array $actions = [
126115
];
127116
```
128117

118+
### Enable Two-Factor Authentication
129119

120+
Turned off by default, Shield's Email-based 2FA can be enabled by specifying the class to use in the `Auth` config file.
130121

122+
```php
123+
public array $actions = [
124+
'register' => null,
125+
'login' => 'CodeIgniter\Shield\Authentication\Actions\Email2FA',
126+
];
127+
```
131128

132129
## Authorization Flow
133130

@@ -180,7 +177,6 @@ public array $matrix = [
180177
];
181178
```
182179

183-
184180
### Assign Permissions to a User
185181

186182
Permissions can also be assigned directly to a user, regardless of what groups they belong to. This is done programatically on the `User` Entity.
@@ -256,8 +252,6 @@ if ($user->inGroup('admin', 'beta')) {
256252
}
257253
```
258254

259-
260-
261255
## Managing Users
262256

263257
Shield uses a more complex user setup than many other systems, separating [User Identities](concepts.md#identities) from the user accounts themselves. This quick overview should help you feel more confident when working with users on a day-to-day basis.

0 commit comments

Comments
 (0)