diff --git a/backend/data/src/main/kotlin/io/tolgee/constants/NotificationType.kt b/backend/data/src/main/kotlin/io/tolgee/constants/NotificationType.kt index f81c988923..8447dc73b5 100644 --- a/backend/data/src/main/kotlin/io/tolgee/constants/NotificationType.kt +++ b/backend/data/src/main/kotlin/io/tolgee/constants/NotificationType.kt @@ -5,4 +5,5 @@ enum class NotificationType { TASK_COMPLETED, MFA_ENABLED, MFA_DISABLED, + PASSWORD_CHANGED, } diff --git a/backend/data/src/main/kotlin/io/tolgee/service/security/UserAccountService.kt b/backend/data/src/main/kotlin/io/tolgee/service/security/UserAccountService.kt index aa46424d7c..2d675e57f3 100644 --- a/backend/data/src/main/kotlin/io/tolgee/service/security/UserAccountService.kt +++ b/backend/data/src/main/kotlin/io/tolgee/service/security/UserAccountService.kt @@ -488,7 +488,15 @@ class UserAccountService( userAccount.tokensValidNotBefore = DateUtils.truncate(Date(), Calendar.SECOND) userAccount.password = passwordEncoder.encode(dto.password) userAccount.passwordChanged = true - return userAccountRepository.save(userAccount) + val savedUser = userAccountRepository.save(userAccount) + notificationService.save( + Notification().apply { + this.user = userAccount + this.type = NotificationType.PASSWORD_CHANGED + this.originatingUser = userAccount + }, + ) + return savedUser } private fun updateUserEmail( diff --git a/webapp/src/component/layout/TopBar/Notifications.tsx b/webapp/src/component/layout/TopBar/Notifications.tsx index b714ba6b96..edf534b9fe 100644 --- a/webapp/src/component/layout/TopBar/Notifications.tsx +++ b/webapp/src/component/layout/TopBar/Notifications.tsx @@ -108,6 +108,8 @@ function getLocalizedMessage( return ; case 'MFA_DISABLED': return ; + case 'PASSWORD_CHANGED': + return ; } } diff --git a/webapp/src/service/apiSchema.generated.ts b/webapp/src/service/apiSchema.generated.ts index 2c5f04958e..4b1ea9deaa 100644 --- a/webapp/src/service/apiSchema.generated.ts +++ b/webapp/src/service/apiSchema.generated.ts @@ -2927,7 +2927,12 @@ export interface components { linkedTask?: components["schemas"]["TaskModel"]; originatingUser?: components["schemas"]["SimpleUserAccountModel"]; project?: components["schemas"]["SimpleProjectModel"]; - type: "TASK_ASSIGNED" | "TASK_COMPLETED" | "MFA_ENABLED" | "MFA_DISABLED"; + type: + | "TASK_ASSIGNED" + | "TASK_COMPLETED" + | "MFA_ENABLED" + | "MFA_DISABLED" + | "PASSWORD_CHANGED"; }; NotificationsMarkSeenRequest: { /**