You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/2 - quickstart.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Quick Start Guide
2
2
3
-
Learning any new authentication system can, especially as the get more flexible and sophisticated. This guide is intended to provide short examples for common actions you'll take when working Shield. It is not intended to be the exhaustive documentation for each section. That's better handled through the area-specific doc files.
3
+
Learning any new authentication system can be difficult, especially as they get more flexible and sophisticated. This guide is intended to provide short examples for common actions you'll take when working with Shield. It is not intended to be the exhaustive documentation for each section. That's better handled through the area-specific doc files.
4
4
5
5
NOTE: The examples assume that you have run the setup script and that you have copies of the `Auth` and `AuthGroups` config files in your application's `app/Config` folder.
6
6
@@ -16,7 +16,7 @@ public array $redirects = [
16
16
];
17
17
```
18
18
19
-
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 redirect immediately after registration or login.
19
+
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.
20
20
21
21
### Customize login redirect
22
22
@@ -61,7 +61,7 @@ public function logoutRedirect(): string
61
61
62
62
### Customize Remember-me functionality
63
63
64
-
Remember-me functionality is enabled by default for the `Session` handler. While this is handled in a secure manner, some sites may want it disbled. You might also want to change how long it remberers a user and doesn't require additional login.
64
+
Remember-me functionality is enabled by default for the `Session` handler. While this is handled in a secure manner, some sites may want it disabled. You might also want to change how long it remembers a user and doesn't require additional login.
65
65
66
66
```php
67
67
public array $sessionConfig = [
@@ -74,7 +74,7 @@ public array $sessionConfig = [
74
74
75
75
### Change Access Token Lifetime
76
76
77
-
By default, Access Tokens can be used for 1 year since they last use. This can be easily modified in the `Auth` config file.
77
+
By default, Access Tokens can be used for 1 year since the last use. This can be easily modified in the `Auth` config file.
78
78
79
79
```php
80
80
public int $unusedTokenLifetime = YEAR;
@@ -93,7 +93,7 @@ public array $actions = [
93
93
94
94
### Enable Account Activation via Email
95
95
96
-
By deafult, once a user registers they have an active account that can be used. You enable Shield's built-in email-based activation flow within the `Auth` config file.
96
+
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.
97
97
98
98
```php
99
99
public array $actions = [
@@ -127,7 +127,7 @@ When a user registers on your site, they are assigned the group specified at `Co
127
127
128
128
### Change Available Permissions
129
129
130
-
The permissions on the site are store in the `AuthGroups` config file, also. Each one is defined by a string that represents a context and a permission, joined with a decimal point.
130
+
The permissions on the site are stored in the `AuthGroups` config file also. Each one is defined by a string that represents a context and a permission, joined with a decimal point.
131
131
132
132
```php
133
133
public array $permissions = [
@@ -159,7 +159,7 @@ public array $matrix = [
159
159
160
160
### Assign Permissions to a User
161
161
162
-
Permissions can also be assigned directly to a user, irregardless of what groups they are a part of. This is done programatically on the `User` Entity.
162
+
Permissions can also be assigned directly to a user, regardless of what groups they belong to. This is done programatically on the `User` Entity.
When you need to check if a user has a specific permission, you want to check both within the groups they are a part of, as well as any specifically assigned to them, you should use the `can()` method on the `User` entity.
180
+
When you need to check if a user has a specific permission use the `can()` method on the `User` entity. This method checks permissions within the groups they belong to and permissions directly assigned to the user.
181
181
182
182
```php
183
183
if (! auth()->user()->can('users.create')) {
184
184
return redirect()->back()->with('error', 'You do not have permissions to access that page.');
185
185
}
186
186
```
187
187
188
-
This can also be done through a [controller filter](https://codeigniter.com/user_guide/incoming/filters.html) if you want to apply it to multiple pages of your site.
188
+
Note: The example above can also be done through a [controller filter](https://codeigniter.com/user_guide/incoming/filters.html) if you want to apply it to multiple pages of your site.
189
189
190
190
191
191
192
192
193
193
194
194
## Managing Users
195
195
196
-
Since Shield uses a more complex user setup than many other systems, due to the [User Identities](1-concepts.md#identities), this quick overview should help you feel more confident when working with users on a day-to-day basis.
196
+
Shield uses a more complex user setup than many other systems, separating [User Identities](1-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.
197
197
198
198
### Creating Users
199
199
@@ -227,11 +227,11 @@ $users->delete($user->id);
227
227
228
228
### Editing A User
229
229
230
-
The `UserModel::save()` method has been modified to ensure that an email or password previously set on the `User` entity will be automatically in the correct `UserIdentity` record.
230
+
The `UserModel::save()` method has been modified to ensure that an email or password previously set on the `User` entity will be automatically updated in the correct `UserIdentity` record.
231
231
232
232
```php
233
233
$users = model('UserModel');
234
-
$user = $users->findById(123);
234
+
$user = $users->findById(123);
235
235
236
236
$user->fill([
237
237
'username' => 'JoeSmith111',
@@ -241,7 +241,7 @@ $user->fill([
241
241
$users->save($user);
242
242
```
243
243
244
-
If you prefer to user the `update()` method, than you will have to update the user's appropriate UserIdentity manually.
244
+
If you prefer to use the `update()` method then you will have to update the user's appropriate UserIdentity manually.
0 commit comments