-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEXT-24677 - Limit admin session time
- Loading branch information
Showing
14 changed files
with
134 additions
and
2 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
changelog/_unreleased/2022-12-29-implement-logout-for-inactive-users.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Implement logout for inactive users | ||
issue: NEXT-24677 | ||
author: Sebastian Seggewiss | ||
author_email: s.seggewiss@shopware.com | ||
author_github: @seggewiss | ||
--- | ||
# Administration | ||
* Added 30-minute logout for inactive users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...tion/Resources/app/administration/src/app/component/structure/sw-admin/sw-admin.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...Administration/Resources/app/administration/src/app/service/user-activity.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import UserActivityService from './user-activity.service'; | ||
|
||
describe('src/app/service/user-activity.service.ts', () => { | ||
let service: UserActivityService | undefined; | ||
|
||
beforeEach(() => { | ||
service = new UserActivityService(); | ||
}); | ||
|
||
it('should instantiate', () => { | ||
expect(service instanceof UserActivityService).toBe(true); | ||
}); | ||
|
||
it('should change last user activity', () => { | ||
Shopware.Context.app.lastActivity = 0; | ||
const date = new Date(); | ||
const expectedResult = Math.round(+date / 1000); | ||
|
||
service.updateLastUserActivity(date); | ||
expect(Shopware.Context.app.lastActivity).toBe(expectedResult); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
src/Administration/Resources/app/administration/src/app/service/user-activity.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @private | ||
*/ | ||
export default class UserActivityService { | ||
updateLastUserActivity(date?: Date): void { | ||
if (date === undefined) { | ||
date = new Date(); | ||
} | ||
|
||
Shopware.Context.app.lastActivity = Math.round(+date / 1000); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters