diff --git a/pom.xml b/pom.xml index f765163..8375a81 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.tsc.bitbucketbot bitbucketbot - 1.3.0-RELEASE + 1.4.0-SNAPSHOT jar diff --git a/src/main/java/com/tsc/bitbucketbot/service/UserService.java b/src/main/java/com/tsc/bitbucketbot/service/UserService.java index 6625bbb..366d8d9 100644 --- a/src/main/java/com/tsc/bitbucketbot/service/UserService.java +++ b/src/main/java/com/tsc/bitbucketbot/service/UserService.java @@ -13,7 +13,7 @@ public interface UserService { Set existsByLogin(@NonNull Set logins); - Optional reg(@NonNull User user); + User reg(@NonNull User user); List addAll(Set newUsers); diff --git a/src/main/java/com/tsc/bitbucketbot/service/impl/UserServiceImpl.java b/src/main/java/com/tsc/bitbucketbot/service/impl/UserServiceImpl.java index 1bcdb13..cb99fb0 100644 --- a/src/main/java/com/tsc/bitbucketbot/service/impl/UserServiceImpl.java +++ b/src/main/java/com/tsc/bitbucketbot/service/impl/UserServiceImpl.java @@ -34,7 +34,7 @@ public class UserServiceImpl implements UserService { } @Override - public Optional reg(@NonNull User user) { + public User reg(@NonNull User user) { final Optional optUser = userRepository.findByLogin(user.getLogin()); if (optUser.isPresent()) { final User oldUser = optUser.get(); @@ -42,10 +42,12 @@ public class UserServiceImpl implements UserService { Optional sheetJson = Utils.urlToJson(bitbucketConfig.getUrlPullRequestClose(), user.getToken(), PullRequestSheetJson.class); if (sheetJson.isPresent()) { oldUser.setTelegramId(user.getTelegramId()); - return Optional.of(userRepository.save(oldUser)); + return userRepository.save(oldUser); } else { throw new RegException("Ваш токен не валиден"); } + } else { + throw new RegException("Вы уже авторизованы в системе"); } } throw new RegException("Пользователь не найден, подождите обновление базы пользователей!"); diff --git a/src/main/resources/public/index.html b/src/main/resources/public/index.html index 66b3f80..3b495f9 100644 --- a/src/main/resources/public/index.html +++ b/src/main/resources/public/index.html @@ -5,7 +5,7 @@ - Авторизатор BitBucked MarkBot + Авторизатор BitbucketBot @@ -20,9 +20,9 @@ - + {{responseMessage}} -

© 2020 Made by @DR_Demons for @uppage bitbucked bot

+

© 2020 Made by @DR_Demons for @uPagge bitbucketbot