Формочка авторизации

This commit is contained in:
upagge 2020-03-28 06:44:37 +03:00
parent 6f7b9e0552
commit d50af456a1
No known key found for this signature in database
GPG Key ID: 15CD012E46F6BA34
5 changed files with 12 additions and 8 deletions

View File

@ -10,7 +10,7 @@
</parent>
<groupId>com.tsc.bitbucketbot</groupId>
<artifactId>bitbucketbot</artifactId>
<version>1.3.0-RELEASE</version>
<version>1.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>

View File

@ -13,7 +13,7 @@ public interface UserService {
Set<String> existsByLogin(@NonNull Set<String> logins);
Optional<User> reg(@NonNull User user);
User reg(@NonNull User user);
List<User> addAll(Set<User> newUsers);

View File

@ -34,7 +34,7 @@ public class UserServiceImpl implements UserService {
}
@Override
public Optional<User> reg(@NonNull User user) {
public User reg(@NonNull User user) {
final Optional<User> optUser = userRepository.findByLogin(user.getLogin());
if (optUser.isPresent()) {
final User oldUser = optUser.get();
@ -42,10 +42,12 @@ public class UserServiceImpl implements UserService {
Optional<PullRequestSheetJson> 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("Пользователь не найден, подождите обновление базы пользователей!");

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Авторизатор BitBucked MarkBot</title>
<title>Авторизатор BitbucketBot</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link href="static/css/signin.css" rel="stylesheet">
</head>
@ -20,9 +20,9 @@
<input type="text" v-model="login" id="login" name="login" class="form-control" placeholder="Username">
<label for="token" class="sr-only">И еще что то тут...</label>
<input type="text" v-model="token" id="token" class="form-control" placeholder="Token">
<button @click="auth" class="btn btn-lg btn-primary btn-block">Забубенитсья</button>
<button @click="auth" class="btn btn-lg btn-primary btn-block" style="margin: 10px">Забубениться</button>
<span>{{responseMessage}}</span>
<p class="mt-5 mb-3 text-muted">© 2020 Made by @DR_Demons for @uppage bitbucked bot</p>
<p class="mt-5 mb-3 text-muted">© 2020 Made by @DR_Demons for @uPagge bitbucketbot</p>
</div>
</div>
<script>
@ -43,7 +43,8 @@
const data = {
telegramId: this.telegramId,
login: this.login,
token: this.token
token: this.token,
responseMessage: this.responseMessage
};
try {
const response = await fetch(url, {

View File

@ -28,6 +28,7 @@ body {
font-weight: 400;
}
.form-signin .form-control {
margin: 10px;
position: relative;
box-sizing: border-box;
height: auto;