Skip to content

Commit

Permalink
Merge pull request #1869 from betagouv/TRELLO-2894
Browse files Browse the repository at this point in the history
TRELLO-2894: pro connect fix
  • Loading branch information
ssedoudbgouv authored Feb 3, 2025
2 parents 2425b5b + ca19637 commit 5bd9e48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion app/orchestrators/UserOrchestrator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ class UserOrchestrator(userRepository: UserRepositoryInterface, eventRepository:
.flatMap {
case Some(user) if user.deletionDate.isDefined =>
// Reactivating user
userRepository.restore(user)
userRepository.restore(
user.copy(
password = "",
email = emailAddress,
userRole = role,
authProvider = ProConnect,
authProviderId = None,
lastEmailValidation = Some(OffsetDateTime.now())
)
)
case Some(_) => Future.failed(UserAccountEmailAlreadyExist)
case None =>
val user = User(
Expand Down
7 changes: 6 additions & 1 deletion app/repositories/user/UserRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ class UserRepository(
override def delete(id: UUID): Future[Int] = softDelete(id)

override def softDelete(id: UUID): Future[Int] = db.run(
table.filter(_.id === id).map(_.deletionDate).update(Some(OffsetDateTime.now()))
table
.filter(_.id === id)
.map { c =>
(c.deletionDate, c.password)
}
.update((Some(OffsetDateTime.now()), ""))
)

override def hardDelete(id: UUID): Future[Int] = db.run(table.filter(_.id === id).delete)
Expand Down

0 comments on commit 5bd9e48

Please sign in to comment.