From e553bc04b6f9fc121f2606988bbe349dd3caa1fa Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Thu, 29 Aug 2024 13:19:03 +0300 Subject: [PATCH 01/11] delete vk/yandex auth --- resources/view/login.html | 8 ----- .../handler/VkOAuth2UserDataHandler.java | 35 ------------------- .../handler/YandexOAuth2UserDataHandler.java | 21 ----------- src/main/resources/application.yaml | 24 ------------- 4 files changed, 88 deletions(-) delete mode 100644 src/main/java/com/javarush/jira/login/internal/sociallogin/handler/VkOAuth2UserDataHandler.java delete mode 100644 src/main/java/com/javarush/jira/login/internal/sociallogin/handler/YandexOAuth2UserDataHandler.java diff --git a/resources/view/login.html b/resources/view/login.html index 8765ca8ff..d49ce5691 100644 --- a/resources/view/login.html +++ b/resources/view/login.html @@ -48,14 +48,6 @@

Sign in

type="button"> - - - - - - diff --git a/src/main/java/com/javarush/jira/login/internal/sociallogin/handler/VkOAuth2UserDataHandler.java b/src/main/java/com/javarush/jira/login/internal/sociallogin/handler/VkOAuth2UserDataHandler.java deleted file mode 100644 index e8e05be05..000000000 --- a/src/main/java/com/javarush/jira/login/internal/sociallogin/handler/VkOAuth2UserDataHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.javarush.jira.login.internal.sociallogin.handler; - -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; - -@Component("vk") -public class VkOAuth2UserDataHandler implements OAuth2UserDataHandler { - @Override - public String getFirstName(OAuth2UserData oAuth2UserData) { - return getAttribute(oAuth2UserData, "first_name"); - } - - @Override - public String getLastName(OAuth2UserData oAuth2UserData) { - return getAttribute(oAuth2UserData, "last_name"); - } - - @Override - public String getEmail(OAuth2UserData oAuth2UserData) { - return oAuth2UserData.getData("email"); - } - - private String getAttribute(OAuth2UserData oAuth2UserData, String name) { - List> attributesResponse = oAuth2UserData.getData("response"); - if (attributesResponse != null) { - Map attributes = attributesResponse.get(0); - if (attributes != null) { - return (String) attributes.get(name); - } - } - return null; - } -} diff --git a/src/main/java/com/javarush/jira/login/internal/sociallogin/handler/YandexOAuth2UserDataHandler.java b/src/main/java/com/javarush/jira/login/internal/sociallogin/handler/YandexOAuth2UserDataHandler.java deleted file mode 100644 index e8ea1ac1d..000000000 --- a/src/main/java/com/javarush/jira/login/internal/sociallogin/handler/YandexOAuth2UserDataHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.javarush.jira.login.internal.sociallogin.handler; - -import org.springframework.stereotype.Component; - -@Component("yandex") -public class YandexOAuth2UserDataHandler implements OAuth2UserDataHandler { - @Override - public String getFirstName(OAuth2UserData oAuth2UserData) { - return oAuth2UserData.getData("first_name"); - } - - @Override - public String getLastName(OAuth2UserData oAuth2UserData) { - return oAuth2UserData.getData("last_name"); - } - - @Override - public String getEmail(OAuth2UserData oAuth2UserData) { - return oAuth2UserData.getData("default_email"); - } -} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 7fcba1570..d9660eb05 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -61,20 +61,6 @@ spring: scope: - email - profile - vk: - client-id: 51562377 - client-secret: jNM1YHQy1362Mqs49wUN - client-name: Vkontakte - redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" - client-authentication-method: client_secret_post - authorization-grant-type: authorization_code - scope: email - yandex: - client-id: 2f3395214ba84075956b76a34b231985 - client-secret: ed236c501e444a609b0f419e5e88f1e1 - client-name: Yandex - redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" - authorization-grant-type: authorization_code gitlab: client-id: b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494 client-secret: e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004 @@ -83,16 +69,6 @@ spring: authorization-grant-type: authorization_code scope: read_user provider: - vk: - authorization-uri: https://oauth.vk.com/authorize - token-uri: https://oauth.vk.com/access_token - user-info-uri: https://api.vk.com/method/users.get?v=8.1 - user-name-attribute: response - yandex: - authorization-uri: https://oauth.yandex.ru/authorize - token-uri: https://oauth.yandex.ru/token - user-info-uri: https://login.yandex.ru/info - user-name-attribute: login gitlab: authorization-uri: https://gitlab.com/oauth/authorize token-uri: https://gitlab.com/oauth/token From a7ccb54c6650d6d391d4bd2e7f517010cb1960ee Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Thu, 29 Aug 2024 13:33:38 +0300 Subject: [PATCH 02/11] add environment variable --- env.list | 14 ++++++++++++++ src/main/resources/application.yaml | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 env.list diff --git a/env.list b/env.list new file mode 100644 index 000000000..2b7b4aa89 --- /dev/null +++ b/env.list @@ -0,0 +1,14 @@ +DB_URL=jdbc:postgresql://localhost:5432/jira +DB_USERNAME=jira +DB_PASSWORD=JiraRush +MAIL_HOST=smtp.gmail.com +MAIL_USERNAME=jira4jr@gmail.com +MAIL_PASSWORD=zdfzsrqvgimldzyj +MAIL_PORT=587 +MAIL_USERNAME_TEST=jira4jr@gmail.com +GITHUB_CLIENT_ID=3d0d8738e65881fff266 +GITHUB_CLIENT_SECRET=0f97031ce6178b7dfb67a6af587f37e222a16120 +GOOGLE_CLIENT_ID=329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com +GOOGLE_CLIENT_SECRET=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 +GITLAB_CLIENT_ID=b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494 +GITLAB_CLIENT_SECRET=e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004 \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index d9660eb05..baed9ecfc 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,7 +1,7 @@ # https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html app: host-url: http://localhost:8080 - test-mail: jira4jr@gmail.com + test-mail: ${MAIL_USERNAME_TEST} templates-update-cache: 5s mail-sending-props: core-pool-size: 8 @@ -26,9 +26,9 @@ spring: # https://stackoverflow.com/questions/21257819/what-is-the-difference-between-hibernate-jdbc-fetch-size-and-hibernate-jdbc-batc jdbc.batch_size: 20 datasource: - url: jdbc:postgresql://localhost:5432/jira - username: jira - password: JiraRush + url: ${DB_URL} + username: ${DB_USERNAME} + password: ${DB_PASSWORD} liquibase: changeLog: "classpath:db/changelog.sql" @@ -51,19 +51,19 @@ spring: client: registration: github: - client-id: 3d0d8738e65881fff266 - client-secret: 0f97031ce6178b7dfb67a6af587f37e222a16120 + client-id: ${GITHUB_CLIENT_ID} + client-secret: ${GITHUB_CLIENT_SECRET} scope: - email google: - client-id: 329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com - client-secret: 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 + client-id: ${GOOGLE_CLIENT_ID} + client-secret: ${GOOGLE_CLIENT_SECRET} scope: - email - profile gitlab: - client-id: b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494 - client-secret: e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004 + client-id: ${GITLAB_CLIENT_ID} + client-secret: ${GITLAB_CLIENT_SECRET} client-name: GitLab redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" authorization-grant-type: authorization_code @@ -86,10 +86,10 @@ spring: starttls: enable: true auth: true - host: smtp.gmail.com - username: jira4jr@gmail.com - password: zdfzsrqvgimldzyj - port: 587 + host: ${MAIL_HOST} + username: ${MAIL_USERNAME} + password: ${MAIL_PASSWORD} + port: ${MAIL_PORT} thymeleaf.check-template-location: false mvc.throw-exception-if-no-handler-found: true From 1a6c6e137364f463ab4a7841255eff8c33475215 Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Fri, 30 Aug 2024 12:45:03 +0300 Subject: [PATCH 03/11] add testcontainers --- pom.xml | 13 +++++++++ .../java/com/javarush/jira/BaseTests.java | 29 ++++++++++++++++++- src/test/resources/application-test.yaml | 6 +--- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index f6c152c68..6d2f97738 100644 --- a/pom.xml +++ b/pom.xml @@ -142,6 +142,19 @@ junit-platform-launcher test + + org.testcontainers + junit-jupiter + 1.20.1 + test + + + org.testcontainers + postgresql + 1.20.1 + test + + diff --git a/src/test/java/com/javarush/jira/BaseTests.java b/src/test/java/com/javarush/jira/BaseTests.java index b6ed2d1aa..ca07a2471 100644 --- a/src/test/java/com/javarush/jira/BaseTests.java +++ b/src/test/java/com/javarush/jira/BaseTests.java @@ -1,9 +1,36 @@ package com.javarush.jira; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.PostgreSQLContainer; -@SpringBootTest +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") abstract class BaseTests { + + static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer<>( + "postgres:16-alpine" + ); + + @DynamicPropertySource + static void configureProperties(DynamicPropertyRegistry registry) { + registry.add("spring.datasource.url", postgreSQLContainer::getJdbcUrl); + registry.add("spring.datasource.username", postgreSQLContainer::getUsername); + registry.add("spring.datasource.password", postgreSQLContainer::getPassword); + } + + @BeforeAll + static void beforeAll() { + postgreSQLContainer.start(); + } + + @AfterAll + static void afterAll() { + postgreSQLContainer.stop(); + } + } diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index 51137fd06..b117db540 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -1,8 +1,4 @@ spring.cache.type: none spring: init: - mode: always - datasource: - url: jdbc:postgresql://localhost:5433/jira-test - username: jira - password: JiraRush \ No newline at end of file + mode: always \ No newline at end of file From 0acdea703546d1f35e733c637836d2070178caef Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Sun, 1 Sep 2024 15:42:14 +0300 Subject: [PATCH 04/11] add ProfileRestControllerTest --- .../web/ProfileRestControllerTest.java | 122 ++++++++++++++++++ .../profile/internal/web/ProfileTestData.java | 7 + 2 files changed, 129 insertions(+) diff --git a/src/test/java/com/javarush/jira/profile/internal/web/ProfileRestControllerTest.java b/src/test/java/com/javarush/jira/profile/internal/web/ProfileRestControllerTest.java index a6fd5e3bf..851b8ab1e 100644 --- a/src/test/java/com/javarush/jira/profile/internal/web/ProfileRestControllerTest.java +++ b/src/test/java/com/javarush/jira/profile/internal/web/ProfileRestControllerTest.java @@ -1,8 +1,130 @@ package com.javarush.jira.profile.internal.web; import com.javarush.jira.AbstractControllerTest; +import com.javarush.jira.common.util.JsonUtil; +import com.javarush.jira.login.AuthUser; +import com.javarush.jira.profile.ProfileTo; +import com.javarush.jira.profile.internal.ProfileRepository; +import com.javarush.jira.profile.internal.model.Profile; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.test.context.support.WithUserDetails; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import static com.javarush.jira.profile.internal.web.ProfileRestController.REST_URL; +import static com.javarush.jira.profile.internal.web.ProfileTestData.*; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; class ProfileRestControllerTest extends AbstractControllerTest { + @Autowired + private ProfileRepository profileRepository; + + @Test + @WithUserDetails(value = USER_MAIL) + void testGetUserProfile() throws Exception { + perform(MockMvcRequestBuilders.get(REST_URL)) + .andExpect(status().isOk()) + .andDo(print()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(PROFILE_TO_MATCHER.contentJson(USER_PROFILE_TO)); + + } + + @Test + @WithUserDetails(value = GUEST_MAIL) + void testGetGuestProfile() throws Exception { + perform(MockMvcRequestBuilders.get(REST_URL)) + .andExpect(status().isOk()) + .andDo(print()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(PROFILE_TO_MATCHER.contentJson(GUEST_PROFILE_EMPTY_TO)); + + } + + @Test + @WithUserDetails(value = GUEST_MAIL) + void testGetNewProfile() throws Exception { + AuthUser authUser = (AuthUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + Profile newProfile = ProfileTestData.getNew(authUser.id()); + profileRepository.save(newProfile); + ResultActions resultActions = perform(MockMvcRequestBuilders.get(REST_URL)) + .andExpect(status().isOk()) + .andDo(print()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)); + + ProfileTo response = PROFILE_TO_MATCHER.readFromJson(resultActions); + ProfileTo newProfileTo = ProfileTestData.getNewTo(); + newProfileTo.setId(authUser.id()); + PROFILE_TO_MATCHER.assertMatch(response, newProfileTo); + } + + @Test + @WithUserDetails(value = USER_MAIL) + void testUpdateUserProfile() throws Exception { + AuthUser authUser = (AuthUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + ProfileTo updateProfileTo = ProfileTestData.getUpdatedTo(); + updateProfileTo.setId(authUser.id()); + perform(MockMvcRequestBuilders.put(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(JsonUtil.writeValue(updateProfileTo))) + .andDo(print()) + .andExpect(status().isNoContent()); + + Profile updateProfileFromRepo = profileRepository.findById(updateProfileTo.id()).get(); + Profile updateProfile = ProfileTestData.getUpdated(authUser.id()); + PROFILE_MATCHER.assertMatch(updateProfileFromRepo, updateProfile); + + } + + @Test + @WithUserDetails(value = USER_MAIL) + void testUpdateInvalidProfileTo() throws Exception { + ProfileTo invalidProfileTo = ProfileTestData.getInvalidTo(); + perform(MockMvcRequestBuilders.put(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(JsonUtil.writeValue(invalidProfileTo))) + .andDo(print()) + .andExpect(status().isUnprocessableEntity()); + + } + + @Test + @WithUserDetails(value = USER_MAIL) + void testUpdateInvalidNotificationMail() throws Exception { + ProfileTo profileTo = ProfileTestData.getWithUnknownNotificationTo(); + perform(MockMvcRequestBuilders.put(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(JsonUtil.writeValue(profileTo))) + .andDo(print()) + .andExpect(status().isUnprocessableEntity()); + } + + @Test + @WithUserDetails(value = USER_MAIL) + void testUpdateInvalidContract() throws Exception { + ProfileTo profileTo = ProfileTestData.getWithUnknownContactTo(); + perform(MockMvcRequestBuilders.put(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(JsonUtil.writeValue(profileTo))) + .andDo(print()) + .andExpect(status().isUnprocessableEntity()); + } + + @Test + @WithUserDetails(value = USER_MAIL) + void testUpdateWithContactHtmlUnsafeTo() throws Exception { + ProfileTo profileTo = ProfileTestData.getWithContactHtmlUnsafeTo(); + perform(MockMvcRequestBuilders.put(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(JsonUtil.writeValue(profileTo))) + .andDo(print()) + .andExpect(status().isUnprocessableEntity()); + } + } \ No newline at end of file diff --git a/src/test/java/com/javarush/jira/profile/internal/web/ProfileTestData.java b/src/test/java/com/javarush/jira/profile/internal/web/ProfileTestData.java index fb4407268..8219f74d4 100644 --- a/src/test/java/com/javarush/jira/profile/internal/web/ProfileTestData.java +++ b/src/test/java/com/javarush/jira/profile/internal/web/ProfileTestData.java @@ -10,9 +10,16 @@ import java.util.Set; public class ProfileTestData { + + public static final String USER_MAIL = "user@gmail.com"; + public static final String GUEST_MAIL = "guest@gmail.com"; + public static MatcherFactory.Matcher PROFILE_MATCHER = MatcherFactory.usingIgnoringFieldsComparator(Profile.class, "user"); + public static MatcherFactory.Matcher PROFILE_TO_MATCHER = + MatcherFactory.usingIgnoringFieldsComparator(ProfileTo.class, "id"); + public static ProfileTo USER_PROFILE_TO = new ProfileTo(null, Set.of("assigned", "overdue", "deadline"), Set.of(new ContactTo("skype", "userSkype"), From 4d40e9e03f81301c275c505c94ba79a6502b5f87 Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Sun, 1 Sep 2024 17:45:07 +0300 Subject: [PATCH 05/11] modify FileUtil.upload --- .../jira/bugtracking/attachment/FileUtil.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java b/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java index 6cffbe175..57b780c60 100644 --- a/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java +++ b/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java @@ -7,7 +7,6 @@ import org.springframework.core.io.UrlResource; import org.springframework.web.multipart.MultipartFile; -import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -25,15 +24,18 @@ public static void upload(MultipartFile multipartFile, String directoryPath, Str throw new IllegalRequestDataException("Select a file to upload."); } - File dir = new File(directoryPath); - if (dir.exists() || dir.mkdirs()) { - File file = new File(directoryPath + fileName); - try (OutputStream outStream = new FileOutputStream(file)) { - outStream.write(multipartFile.getBytes()); - } catch (IOException ex) { - throw new IllegalRequestDataException("Failed to upload file" + multipartFile.getOriginalFilename()); + try { + Path directory = Files.createDirectories(Paths.get(directoryPath)); + if (Files.exists(directory)) { + Path pathFile = Files.createFile(Paths.get(directoryPath, fileName)); + try (OutputStream outputStream = new FileOutputStream(pathFile.toFile())) { + outputStream.write(multipartFile.getBytes()); + } } + } catch (IOException e) { + throw new IllegalRequestDataException("Failed to upload file" + multipartFile.getOriginalFilename()); } + } public static Resource download(String fileLink) { From 422cc4cb67caab2a6956c4f9e7fbabaa8347119d Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Mon, 2 Sep 2024 14:22:21 +0300 Subject: [PATCH 06/11] add Dockerfile and docker-compose.yml --- Dockerfile | 14 ++++++++++++++ config/nginx.conf | 2 +- docker-compose.yml | 39 +++++++++++++++++++++++++++++++++++++++ env.list => jira.env | 2 +- 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml rename env.list => jira.env (92%) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..64ef8d8c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +#FROM maven:3.8.5-openjdk-17 +#ARG JAR_FILE=target/*.jar +#WORKDIR /opt/app +#COPY resources /resources +#COPY ${JAR_FILE} app.jar +#ENTRYPOINT ["java","-jar","app.jar"] +FROM maven:3.8.5-openjdk-17 AS build +COPY src /app/src +COPY pom.xml /app +COPY resources /resources +RUN mvn -f /app/pom.xml clean package -Pprod +RUN rm -rf /app/src +EXPOSE 8080 +ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar","/app/target/jira-1.0.jar"] \ No newline at end of file diff --git a/config/nginx.conf b/config/nginx.conf index 82b9e234d..634d2c528 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -10,7 +10,7 @@ server { gzip_min_length 2048; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - root /opt/jirarush/resources; + root /resources; if ($request_uri ~ ';') {return 404;} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..3e0bda448 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +version: "3.7" +services: + app: + container_name: jira-project + restart: always + build: + context: . + dockerfile: Dockerfile + ports: + - "8080:8080" + depends_on: + - db + - nginx + env_file: + - ./jira.env + + + db: + container_name: postgres_db + image: postgres:latest + restart: always + volumes: + - ./data/db:/var/lib/postgresql/data/ + ports: + - "5432:5432" + environment: + POSTGRES_USER: jira + POSTGRES_PASSWORD: JiraRush + + + nginx: + container_name: nginx + image: nginx:latest + restart: always + ports: + - "80:80" + volumes: + - ./config/nginx.conf:/etc/nginx/conf.d/nginx.conf + diff --git a/env.list b/jira.env similarity index 92% rename from env.list rename to jira.env index 2b7b4aa89..34c618996 100644 --- a/env.list +++ b/jira.env @@ -1,4 +1,4 @@ -DB_URL=jdbc:postgresql://localhost:5432/jira +DB_URL=jdbc:postgresql://db:5432/jira DB_USERNAME=jira DB_PASSWORD=JiraRush MAIL_HOST=smtp.gmail.com From 4f001ec0f04b7a07605f9e15f5316f20d0356065 Mon Sep 17 00:00:00 2001 From: PolinaAlimova11 Date: Mon, 2 Sep 2024 20:47:37 +0300 Subject: [PATCH 07/11] add localisation --- pom.xml | 4 ++ resources/mails/email-confirmation.html | 10 ++--- resources/mails/password-reset.html | 10 ++--- resources/view/index.html | 6 +-- resources/view/layout/footer.html | 44 ++++++++++---------- resources/view/layout/header.html | 10 ++--- resources/view/layout/sidebar.html | 12 +++--- src/main/resources/messages.properties | 48 ++++++++++++++++++++++ src/main/resources/messages_en.properties | 48 ++++++++++++++++++++++ src/main/resources/messages_ru.properties | 49 +++++++++++++++++++++++ 10 files changed, 195 insertions(+), 46 deletions(-) create mode 100644 src/main/resources/messages.properties create mode 100644 src/main/resources/messages_en.properties create mode 100644 src/main/resources/messages_ru.properties diff --git a/pom.xml b/pom.xml index 6d2f97738..f6cb79c8b 100644 --- a/pom.xml +++ b/pom.xml @@ -154,6 +154,10 @@ 1.20.1 test + + org.springframework.boot + spring-boot-starter-thymeleaf + diff --git a/resources/mails/email-confirmation.html b/resources/mails/email-confirmation.html index 106e6129a..4f3eba176 100644 --- a/resources/mails/email-confirmation.html +++ b/resources/mails/email-confirmation.html @@ -1,13 +1,13 @@ - + - JiraRush - подтверждение почты + JiraRush - подтверждение почты -

-

Чтобы завершить настройку учетной записи и начать пользоваться JiraRush, подтвердите, что вы правильно указали вашу +

+

Чтобы завершить настройку учетной записи и начать пользоваться JiraRush, подтвердите, что вы правильно указали вашу электронную почту.

-Подтвердить почту +Подтвердить почту \ No newline at end of file diff --git a/resources/mails/password-reset.html b/resources/mails/password-reset.html index b37a49007..3a7b68a67 100644 --- a/resources/mails/password-reset.html +++ b/resources/mails/password-reset.html @@ -1,12 +1,12 @@ - + - JiraRush - установить новый пароль + JiraRush - установить новый пароль -

-

-Установить пароль +

+

+Установить пароль \ No newline at end of file diff --git a/resources/view/index.html b/resources/view/index.html index e8656ef96..c90fa6e3c 100644 --- a/resources/view/index.html +++ b/resources/view/index.html @@ -1,13 +1,13 @@ - + -

JiraRush Home page

+

JiraRush Home page

- +
diff --git a/resources/view/layout/footer.html b/resources/view/layout/footer.html index abd5ae968..2637f7de1 100644 --- a/resources/view/layout/footer.html +++ b/resources/view/layout/footer.html @@ -1,5 +1,5 @@ - +
diff --git a/resources/view/layout/header.html b/resources/view/layout/header.html index 451f9652d..d5b4caffc 100644 --- a/resources/view/layout/header.html +++ b/resources/view/layout/header.html @@ -1,5 +1,5 @@ - +
@@ -9,7 +9,7 @@