This commit is contained in:
Maksim Skobaro 2025-06-24 03:31:54 +03:00
parent 57bc6ae303
commit e2fc463dd5

View File

@ -101,7 +101,13 @@ public class ParticipantService {
Participant saved = participantRepository.save(participant); Participant saved = participantRepository.save(participant);
log.info("Participant saved: {}", saved.getFullName());
boolean credentialsChanged = persistUserData(participantSaveDTO, saved, editMode, participant);
if (credentialsChanged) {
log.info("User {} changed credentials, logging out", saved.getUser().getUsername());
authenticationService.logout(saved.getUser().getUsername());
}
if (!editMode && participantSaveDTO.getUserData() != null) { if (!editMode && participantSaveDTO.getUserData() != null) {
emailService.sendEmail(saved.getEmail(), "Вам была создана учетная запись в системе поддержки ВКР", """ emailService.sendEmail(saved.getEmail(), "Вам была создана учетная запись в системе поддержки ВКР", """
@ -131,13 +137,7 @@ public class ParticipantService {
} }
} }
} }
log.info("Participant saved: {}", saved.getFullName());
boolean credentialsChanged = persistUserData(participantSaveDTO, saved, editMode, participant);
if (credentialsChanged) {
log.info("User {} changed credentials, logging out", saved.getUser().getUsername());
authenticationService.logout(saved.getUser().getUsername());
}
} }
private List<Role> persistRoles(ParticipantSaveDTO participantSaveDTO, Participant existingParticipant, boolean editMode, User callerUser, Participant participant) { private List<Role> persistRoles(ParticipantSaveDTO participantSaveDTO, Participant existingParticipant, boolean editMode, User callerUser, Participant participant) {