This commit is contained in:
Lorenzo Milesi
2022-08-11 09:08:25 +02:00
51 changed files with 2004 additions and 40 deletions

8
docs/events/user-events.md Normal file → Executable file
View File

@ -20,7 +20,9 @@ On Controllers
- **UserEvent::EVENT_BEFORE_UNBLOCK**: Occurs before a user is being un-blocked
- **UserEvent::EVENT_AFTER_UNBLOCK**: Occurs after a user is being un-blocked
- **UserEvent::EVENT_BEFORE_SWITCH_IDENTITY**: Occurs before a user is being impersonated by admin
- **UserEvent::EVENT_AFTER_SWITCH_IDENTITY**: Occurs after a user his being impersonated by admin
- **UserEvent::EVENT_AFTER_SWITCH_IDENTITY**: Occurs after a user his being impersonated by admin
- **SessionEvent::EVENT_BEFORE_TERMINATE_USER_SESSIONS**
- **SessionEvent::EVENT_AFTER_TERMINATE_USER_SESSIONS**
- **RegistrationController**
@ -41,6 +43,10 @@ On Controllers
- **UserEvent::EVENT_BEFORE_DELETE**: Occurs before the user account is deleted
- **UserEvent::EVENT_AFTER_DELETE**: Occurs after the user account is deleted
- **SessionController**
- **SessionEvent::EVENT_BEFORE_TERMINATE_USER_SESSIONS**: Occurs before the user sessions is terminated
- **SessionEvent::EVENT_AFTER_TERMINATE_USER_SESSIONS**: Occurs after the user sessions is terminated
On Models
---------

View File

@ -0,0 +1,60 @@
How to enable session history
============================
Session history list user sessions.
User can delete all sessions except current.
Configure Module and Application
--------------------------------
```php
// ...
'modules' => [
'user' => [
'class' => Da\User\Module::class,
'enableSessionHistory' => true,
]
],
// ...
'components' => [
'session' => Da\User\Service\SessionHistory\SessionHistoryDecorator::class,
]
// ...
'container' => [
'singletons' => [
Da\User\Service\SessionHistory\TerminateSessionsServiceInterface::class => Da\User\Service\SessionHistory\TerminateSessionsService::class
]
]
// ...
'controllerMap' => [
'migrate' => [
...
'migrationNamespaces' => [
'Da\User\Migration\Session',
],
],
],
```
Additionally for upping migration can use
```
./yii migrate --migrationNamespaces=Da\\User\\Migration\Session
```
Setting user screenshot:
![Settings user screenshot](./session-history/settings.png)
Admin screenshot:
![Admin screenshot](./session-history/admin.png)
© [2amigos](http://www.2amigos.us/) 2013-2019

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

1
docs/index.md Normal file → Executable file
View File

@ -188,6 +188,7 @@ Helpful Guides
- [How to Switch Identities](helpful-guides/how-to-switch-identities.md)
- [Separate Frontend and Backend Sessions](helpful-guides/separate-frontend-and-backend-sessions.md)
- [Social Network Authentication](helpful-guides/social-network-authentication.md)
- [How to Enable session history](helpful-guides/how-to-use-session-history.md)
Contributing
------------

16
docs/installation/configuration-options.md Normal file → Executable file
View File

@ -3,6 +3,22 @@ Configuration Options
The module comes with a set of attributes to configure. The following is the list of all available options:
#### enableSessionHistory (Type: `boolean, integer`, Default value: `false`)
If this option is to `true`, session history will be kept, [more](../helpful-guides/how-to-use-session-history.md).
#### numberSessionHistory (Type: `boolean, integer`, Default value: `false`)
Number of expired storing records `session history`, values:
- `false` Store all records without deleting
- `integer` Count of records for storing
#### timeoutSessionHistory (Type: `boolean, integer`, Default value: `false`)
How long store `session history` after expiring, values:
- `false` Store all records without deleting
- `integer` Time for storing after expiring in seconds
#### enableTwoFactorAuthentication (type: `boolean`, default: `false`)
Setting this attribute will allow users to configure their login process with two-factor authentication.