From 3430fe23a9244030d06fdf8e6771592e1f12ad52 Mon Sep 17 00:00:00 2001 From: Stephanya Casanova Date: Fri, 3 Jan 2025 12:52:07 +0100 Subject: [PATCH] [Backend] Fix password reset for users who are not logged in (#1963) --- .../io/openbas/rest/document/DocumentApi.java | 6 ++- .../io/openbas/rest/exercise/ExerciseApi.java | 6 ++- .../io/openbas/rest/helper/RestBehavior.java | 25 ++++++--- .../io/openbas/rest/inject/InjectApi.java | 9 ++-- .../rest/objective/ExerciseObjectiveApi.java | 4 +- .../rest/objective/ScenarioObjectiveApi.java | 4 +- .../java/io/openbas/rest/team/TeamApi.java | 4 +- .../main/java/io/openbas/rest/user/MeApi.java | 18 +++++-- .../java/io/openbas/rest/user/PlayerApi.java | 4 +- .../java/io/openbas/rest/user/UserApi.java | 5 +- .../openbas/service/AtomicTestingService.java | 5 +- .../openbas/service/InjectImportService.java | 5 +- .../io/openbas/service/MailingService.java | 11 +++- .../java/io/openbas/rest/UserApiTest.java | 53 +++++++++++++++++++ .../openbas/utils/fixtures/UserFixture.java | 8 +++ openbas-front/src/network.js | 6 ++- openbas-front/src/utils/Action.ts | 3 ++ openbas-front/src/utils/Localization.js | 3 ++ 18 files changed, 150 insertions(+), 29 deletions(-) diff --git a/openbas-api/src/main/java/io/openbas/rest/document/DocumentApi.java b/openbas-api/src/main/java/io/openbas/rest/document/DocumentApi.java index fe74a5e93d..9d7d1b9e07 100644 --- a/openbas-api/src/main/java/io/openbas/rest/document/DocumentApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/document/DocumentApi.java @@ -349,7 +349,8 @@ public Document updateDocumentInformation( !exercise.isUserHasAccess( userRepository .findById(currentUser().getId()) - .orElseThrow(ElementNotFoundException::new))) + .orElseThrow( + () -> new ElementNotFoundException("Current user not found")))) .map(Exercise::getId); List askExerciseIds = Stream.concat(askExerciseIdsStream, input.getExerciseIds().stream()).distinct().toList(); @@ -370,7 +371,8 @@ public Document updateDocumentInformation( !scenario.isUserHasAccess( userRepository .findById(currentUser().getId()) - .orElseThrow(ElementNotFoundException::new))) + .orElseThrow( + () -> new ElementNotFoundException("Current user not found")))) .map(Scenario::getId); List askScenarioIds = Stream.concat(askScenarioIdsStream, input.getScenarioIds().stream()).distinct().toList(); diff --git a/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java b/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java index 99b766a10a..cb3d8fc788 100644 --- a/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java @@ -127,7 +127,9 @@ public Log createLog(@PathVariable String exerciseId, @Valid @RequestBody LogCre log.setExercise(exercise); log.setTags(iterableToSet(tagRepository.findAllById(input.getTagIds()))); log.setUser( - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new)); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); return exerciseLogRepository.save(log); } @@ -172,7 +174,7 @@ public Dryrun createDryrun( ? List.of( userRepository .findById(currentUser().getId()) - .orElseThrow(ElementNotFoundException::new)) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))) : fromIterable(userRepository.findAllById(userIds)); return dryrunService.provisionDryrun(exercise, users, input.getName()); } diff --git a/openbas-api/src/main/java/io/openbas/rest/helper/RestBehavior.java b/openbas-api/src/main/java/io/openbas/rest/helper/RestBehavior.java index 05ec4a91e8..9b2d7c84f3 100644 --- a/openbas-api/src/main/java/io/openbas/rest/helper/RestBehavior.java +++ b/openbas-api/src/main/java/io/openbas/rest/helper/RestBehavior.java @@ -163,13 +163,18 @@ public ResponseEntity handleAlreadyExistingException(AlreadyExisti // --- Open channel access public User impersonateUser(UserRepository userRepository, Optional userId) { - if (currentUser().getId().equals(ANONYMOUS)) { - if (userId.isPresent()) { - return userRepository.findById(userId.get()).orElseThrow(); + if (ANONYMOUS.equals(currentUser().getId())) { + if (userId.isEmpty()) { + throw new UnsupportedOperationException( + "User must be logged or dynamic player is required"); } - throw new UnsupportedOperationException("User must be logged or dynamic player is required"); + return userRepository + .findById(userId.get()) + .orElseThrow(() -> new ElementNotFoundException("User not found")); } - return userRepository.findById(currentUser().getId()).orElseThrow(); + return userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); } public void checkUserAccess(UserRepository userRepository, String userId) { @@ -177,7 +182,10 @@ public void checkUserAccess(UserRepository userRepository, String userId) { if (askedUser.getOrganization() != null) { OpenBASPrincipal currentUser = currentUser(); if (!currentUser.isAdmin()) { - User local = userRepository.findById(currentUser.getId()).orElseThrow(); + User local = + userRepository + .findById(currentUser.getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); List localOrganizationIds = local.getGroups().stream() .flatMap(group -> group.getOrganizations().stream()) @@ -194,7 +202,10 @@ public void checkOrganizationAccess(UserRepository userRepository, String organi if (organizationId != null) { OpenBASPrincipal currentUser = currentUser(); if (!currentUser.isAdmin()) { - User local = userRepository.findById(currentUser.getId()).orElseThrow(); + User local = + userRepository + .findById(currentUser.getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); List localOrganizationIds = local.getGroups().stream() .flatMap(group -> group.getOrganizations().stream()) diff --git a/openbas-api/src/main/java/io/openbas/rest/inject/InjectApi.java b/openbas-api/src/main/java/io/openbas/rest/inject/InjectApi.java index d366d2bd4b..71dacc0d9f 100644 --- a/openbas-api/src/main/java/io/openbas/rest/inject/InjectApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/inject/InjectApi.java @@ -319,7 +319,9 @@ public Inject createInjectForExercise( // Get common attributes Inject inject = input.toInject(injectorContract); inject.setUser( - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new)); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); inject.setExercise(exercise); // Set dependencies if (input.getDependsOn() != null) { @@ -489,7 +491,8 @@ public List nextInjectsToExecute(@RequestParam Optional size) { .isUserHasAccess( userRepository .findById(currentUser().getId()) - .orElseThrow(ElementNotFoundException::new))) + .orElseThrow( + () -> new ElementNotFoundException("Current user not found")))) // Order by near execution .sorted(Inject.executionComparator) // Keep only the expected size @@ -552,7 +555,7 @@ public Inject createInjectForScenario( inject.setUser( this.userRepository .findById(currentUser().getId()) - .orElseThrow(ElementNotFoundException::new)); + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); inject.setScenario(scenario); // Set dependencies if (input.getDependsOn() != null) { diff --git a/openbas-api/src/main/java/io/openbas/rest/objective/ExerciseObjectiveApi.java b/openbas-api/src/main/java/io/openbas/rest/objective/ExerciseObjectiveApi.java index 547eaf77df..098ac9df40 100644 --- a/openbas-api/src/main/java/io/openbas/rest/objective/ExerciseObjectiveApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/objective/ExerciseObjectiveApi.java @@ -101,7 +101,9 @@ public Evaluation createEvaluation( Objective objective = resolveRelation(objectiveId, objectiveRepository); evaluation.setObjective(objective); evaluation.setUser( - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new)); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); Evaluation result = evaluationRepository.save(evaluation); objective.setUpdatedAt(now()); objectiveRepository.save(objective); diff --git a/openbas-api/src/main/java/io/openbas/rest/objective/ScenarioObjectiveApi.java b/openbas-api/src/main/java/io/openbas/rest/objective/ScenarioObjectiveApi.java index e142d997e5..34011ad193 100644 --- a/openbas-api/src/main/java/io/openbas/rest/objective/ScenarioObjectiveApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/objective/ScenarioObjectiveApi.java @@ -101,7 +101,9 @@ public Evaluation createEvaluation( Objective objective = resolveRelation(objectiveId, objectiveRepository); evaluation.setObjective(objective); evaluation.setUser( - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new)); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); Evaluation result = evaluationRepository.save(evaluation); objective.setUpdatedAt(now()); objectiveRepository.save(objective); diff --git a/openbas-api/src/main/java/io/openbas/rest/team/TeamApi.java b/openbas-api/src/main/java/io/openbas/rest/team/TeamApi.java index 330d08098f..ce49073360 100644 --- a/openbas-api/src/main/java/io/openbas/rest/team/TeamApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/team/TeamApi.java @@ -69,7 +69,9 @@ public Iterable getTeams() { } else { // We get the teams that are linked to the organizations we are part of User local = - userRepository.findById(currentUser.getId()).orElseThrow(ElementNotFoundException::new); + userRepository + .findById(currentUser.getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); List organizationIds = local.getGroups().stream() .flatMap(group -> group.getOrganizations().stream()) diff --git a/openbas-api/src/main/java/io/openbas/rest/user/MeApi.java b/openbas-api/src/main/java/io/openbas/rest/user/MeApi.java index dc74e747e5..d9a76d7755 100644 --- a/openbas-api/src/main/java/io/openbas/rest/user/MeApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/user/MeApi.java @@ -71,14 +71,16 @@ public ResponseEntity logout() { public User me() { return userRepository .findById(currentUser().getId()) - .orElseThrow(ElementNotFoundException::new); + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); } @Secured(ROLE_USER) @PutMapping("/api/me/profile") public User updateProfile(@Valid @RequestBody UpdateProfileInput input) { User user = - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); user.setUpdateAttributes(input); user.setOrganization( updateRelation(input.getOrganizationId(), user.getOrganization(), organizationRepository)); @@ -91,7 +93,9 @@ public User updateProfile(@Valid @RequestBody UpdateProfileInput input) { @PutMapping("/api/me/information") public User updateInformation(@Valid @RequestBody UpdateUserInfoInput input) { User user = - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); user.setUpdateAttributes(input); User savedUser = userRepository.save(user); sessionManager.refreshUserSessions(savedUser); @@ -103,7 +107,9 @@ public User updateInformation(@Valid @RequestBody UpdateUserInfoInput input) { public User updatePassword(@Valid @RequestBody UpdateMePasswordInput input) throws InputValidationException { User user = - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); if (userService.isUserPasswordValid(user, input.getCurrentPassword())) { user.setPassword(userService.encodeUserPassword(input.getPassword())); return userRepository.save(user); @@ -118,7 +124,9 @@ public User updatePassword(@Valid @RequestBody UpdateMePasswordInput input) public Token renewToken(@Valid @RequestBody RenewTokenInput input) throws InputValidationException { User user = - userRepository.findById(currentUser().getId()).orElseThrow(ElementNotFoundException::new); + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); Token token = tokenRepository.findById(input.getTokenId()).orElseThrow(ElementNotFoundException::new); if (!user.equals(token.getUser())) { diff --git a/openbas-api/src/main/java/io/openbas/rest/user/PlayerApi.java b/openbas-api/src/main/java/io/openbas/rest/user/PlayerApi.java index 911bec5e84..3b450f2928 100644 --- a/openbas-api/src/main/java/io/openbas/rest/user/PlayerApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/user/PlayerApi.java @@ -57,7 +57,9 @@ public Iterable players() { players = fromIterable(userRepository.rawAllPlayers()); } else { User local = - userRepository.findById(currentUser.getId()).orElseThrow(ElementNotFoundException::new); + userRepository + .findById(currentUser.getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found")); List organizationIds = local.getGroups().stream() .flatMap(group -> group.getOrganizations().stream()) diff --git a/openbas-api/src/main/java/io/openbas/rest/user/UserApi.java b/openbas-api/src/main/java/io/openbas/rest/user/UserApi.java index 40ea1688fd..47422137d7 100644 --- a/openbas-api/src/main/java/io/openbas/rest/user/UserApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/user/UserApi.java @@ -33,6 +33,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.domain.Specification; +import org.springframework.http.ResponseEntity; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.annotation.Secured; import org.springframework.security.authentication.BadCredentialsException; @@ -87,7 +88,7 @@ public User login(@Valid @RequestBody LoginUserInput input) { } @PostMapping("/api/reset") - public void passwordReset(@Valid @RequestBody ResetUserInput input) { + public ResponseEntity passwordReset(@Valid @RequestBody ResetUserInput input) { Optional optionalUser = userRepository.findByEmailIgnoreCase(input.getLogin()); if (optionalUser.isPresent()) { User user = optionalUser.get(); @@ -116,7 +117,9 @@ public void passwordReset(@Valid @RequestBody ResetUserInput input) { } // Store in memory reset token resetTokenMap.put(resetToken, user.getId()); + return ResponseEntity.ok().build(); } + return ResponseEntity.badRequest().build(); } @PostMapping("/api/reset/{token}") diff --git a/openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java b/openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java index 6f5f396f7d..b433533cb2 100644 --- a/openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java +++ b/openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java @@ -103,7 +103,10 @@ public InjectResultOverviewOutput createOrUpdate(AtomicTestingInput input, Strin injectToSave.setAllTeams(input.isAllTeams()); injectToSave.setDescription(input.getDescription()); injectToSave.setDependsDuration(0L); - injectToSave.setUser(userRepository.findById(currentUser().getId()).orElseThrow()); + injectToSave.setUser( + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); injectToSave.setExercise(null); // Set dependencies diff --git a/openbas-api/src/main/java/io/openbas/service/InjectImportService.java b/openbas-api/src/main/java/io/openbas/service/InjectImportService.java index 4c0869ad07..83debf33d2 100644 --- a/openbas-api/src/main/java/io/openbas/service/InjectImportService.java +++ b/openbas-api/src/main/java/io/openbas/service/InjectImportService.java @@ -710,7 +710,10 @@ private ImportRow importRow( mapPatternByAllTeams)); }); // The user is the one doing the import - inject.setUser(userRepository.findById(currentUser().getId()).orElseThrow()); + inject.setUser( + userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); // No exercise yet inject.setExercise(null); // No dependencies diff --git a/openbas-api/src/main/java/io/openbas/service/MailingService.java b/openbas-api/src/main/java/io/openbas/service/MailingService.java index 9c74c18688..ab938b006f 100644 --- a/openbas-api/src/main/java/io/openbas/service/MailingService.java +++ b/openbas-api/src/main/java/io/openbas/service/MailingService.java @@ -1,5 +1,6 @@ package io.openbas.service; +import static io.openbas.config.OpenBASAnonymous.ANONYMOUS; import static io.openbas.config.SessionHelper.currentUser; import com.fasterxml.jackson.databind.ObjectMapper; @@ -74,7 +75,15 @@ public void sendEmail( .ifPresent( injectorContract -> { inject.setContent(this.mapper.valueToTree(emailContent)); - inject.setUser(this.userRepository.findById(currentUser().getId()).orElseThrow()); + + // When resetting the password, the user is not logged in (anonymous), + // so there's no need to add the user to the inject. + if (!ANONYMOUS.equals(currentUser().getId())) { + inject.setUser( + this.userRepository + .findById(currentUser().getId()) + .orElseThrow(() -> new ElementNotFoundException("Current user not found"))); + } exercise.ifPresent(inject::setExercise); diff --git a/openbas-api/src/test/java/io/openbas/rest/UserApiTest.java b/openbas-api/src/test/java/io/openbas/rest/UserApiTest.java index ca72797b60..ef662445b9 100644 --- a/openbas-api/src/test/java/io/openbas/rest/UserApiTest.java +++ b/openbas-api/src/test/java/io/openbas/rest/UserApiTest.java @@ -2,7 +2,12 @@ import static io.openbas.utils.JsonUtils.asJsonString; import static io.openbas.utils.fixtures.UserFixture.EMAIL; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -11,10 +16,15 @@ import io.openbas.database.model.User; import io.openbas.database.repository.UserRepository; import io.openbas.rest.user.form.login.LoginUserInput; +import io.openbas.rest.user.form.login.ResetUserInput; import io.openbas.rest.user.form.user.CreateUserInput; +import io.openbas.service.MailingService; import io.openbas.utils.fixtures.UserFixture; +import java.util.List; import org.junit.jupiter.api.*; +import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; @@ -28,6 +38,8 @@ class UserApiTest extends IntegrationTest { @Autowired private UserRepository userRepository; + @MockBean private MailingService mailingService; + @BeforeAll public void setup() { // Create user @@ -143,4 +155,45 @@ void given_known_create_user_in_uppercase_input_should_return_conflict() throws .andExpect(status().isConflict()); } } + + @Nested + @DisplayName("Reset Password from I forget my pwd option") + class ResetPassword { + @DisplayName("With a known email") + @Test + void resetPassword() throws Exception { + // -- PREPARE -- + ResetUserInput input = UserFixture.getResetUserInput(); + + // -- EXECUTE -- + mvc.perform( + post("/api/reset") + .contentType(MediaType.APPLICATION_JSON) + .content(asJsonString(input))) + .andExpect(status().isOk()); + + // -- ASSERT -- + ArgumentCaptor> userCaptor = ArgumentCaptor.forClass(List.class); + verify(mailingService).sendEmail(anyString(), anyString(), userCaptor.capture()); + assertEquals(EMAIL, userCaptor.getValue().get(0).getEmail()); + } + + @DisplayName("With a unknown email") + @Test + void resetPasswordWithUnknownEmail() throws Exception { + // -- PREPARE -- + ResetUserInput input = UserFixture.getResetUserInput(); + input.setLogin("unknown@filigran.io"); + + // -- EXECUTE -- + mvc.perform( + post("/api/reset") + .contentType(MediaType.APPLICATION_JSON) + .content(asJsonString(input))) + .andExpect(status().isBadRequest()); + + // -- ASSERT -- + verify(mailingService, never()).sendEmail(anyString(), anyString(), any(List.class)); + } + } } diff --git a/openbas-api/src/test/java/io/openbas/utils/fixtures/UserFixture.java b/openbas-api/src/test/java/io/openbas/utils/fixtures/UserFixture.java index 74a872c124..9d675da13a 100644 --- a/openbas-api/src/test/java/io/openbas/utils/fixtures/UserFixture.java +++ b/openbas-api/src/test/java/io/openbas/utils/fixtures/UserFixture.java @@ -2,6 +2,7 @@ import io.openbas.database.model.User; import io.openbas.rest.user.form.login.LoginUserInput; +import io.openbas.rest.user.form.login.ResetUserInput; import org.springframework.security.crypto.argon2.Argon2PasswordEncoder; public class UserFixture { @@ -45,4 +46,11 @@ public static User getSavedUser() { user.setId("saved-user-id"); return user; } + + public static ResetUserInput getResetUserInput() { + ResetUserInput resetUserInput = new ResetUserInput(); + resetUserInput.setLogin(EMAIL); + + return resetUserInput; + } } diff --git a/openbas-front/src/network.js b/openbas-front/src/network.js index b33f3b904b..a0daef7881 100644 --- a/openbas-front/src/network.js +++ b/openbas-front/src/network.js @@ -9,8 +9,10 @@ export const api = (schema) => { // Intercept to apply schema and test unauthorized users instance.interceptors.response.use( (response) => { - if (schema) { - response.data = normalize(response.data, schema); + if (response.data && schema) { + if (typeof response.data === 'object') { + response.data = normalize(response.data, schema); + } } return response; }, diff --git a/openbas-front/src/utils/Action.ts b/openbas-front/src/utils/Action.ts index 370235e3c3..93c7bf79f3 100644 --- a/openbas-front/src/utils/Action.ts +++ b/openbas-front/src/utils/Action.ts @@ -50,6 +50,8 @@ const notifyError = (error: AxiosError) => { // Do not notify the user, as a 401 error will already trigger a disconnection, as 404 already handle inside the app } else if (error.status === 409) { MESSAGING$.notifyError(intl.formatMessage({ id: 'The element already exists' })); + } else if (error.status === 400) { + MESSAGING$.notifyError(intl.formatMessage({ id: 'Bad request' })); } else if (error.status === 500) { MESSAGING$.notifyError(intl.formatMessage({ id: 'Internal error' })); } else if (error.message) { @@ -166,6 +168,7 @@ export const postReferential = (schema: Schema | null, uri: string, data: unknow .post(buildUri(uri), data) .then((response) => { dispatch({ type: Constants.DATA_FETCH_SUCCESS, payload: response.data }); + notifySuccess('The element has been successfully updated'); return response.data; }) .catch((error) => { diff --git a/openbas-front/src/utils/Localization.js b/openbas-front/src/utils/Localization.js index d2e3e935d8..0ad0261ec8 100644 --- a/openbas-front/src/utils/Localization.js +++ b/openbas-front/src/utils/Localization.js @@ -1425,6 +1425,7 @@ const i18n = { 'Childrens': 'Enfants', 'Interactive view': 'Vue interactive', 'Execution successful': 'Exécution réussie', + 'Bad request': 'Mauvaise requête', 'Internal error': 'Erreur interne', 'The element has been successfully updated': 'L\'élément a été mis à jour avec succès', 'The element has been successfully deleted': 'L\'élément a été supprimé avec succès', @@ -2812,6 +2813,7 @@ const i18n = { 'Execution successful': '执行成功', 'The element has been successfully updated': '元素已成功更新', 'The element has been successfully deleted': '元素已成功删除', + 'Bad request': '错误的请求', 'Internal error': '内部错误 ', 'No data to display': '没有可显示的数据', 'No simulation in this platform yet': '此平台尚未提供模拟功能', @@ -2987,6 +2989,7 @@ const i18n = { 'Do you want to launch this atomic testing: {title}?': 'Do you want to launch this atomic testing: {title}?', 'Do you want to relaunch this atomic testing: {title}?': 'Do you want to relaunch this atomic testing: {title}?', 'The element already exists': 'The element already exists', + 'Bad request': 'Bad request', 'Internal error': 'Internal error', 'Something went wrong. Please refresh the page or try again later.': 'Something went wrong. Please refresh the page or try again later.', },