Формочка авторизации
This commit is contained in:
parent
6f7b9e0552
commit
d50af456a1
2
pom.xml
2
pom.xml
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>com.tsc.bitbucketbot</groupId>
|
<groupId>com.tsc.bitbucketbot</groupId>
|
||||||
<artifactId>bitbucketbot</artifactId>
|
<artifactId>bitbucketbot</artifactId>
|
||||||
<version>1.3.0-RELEASE</version>
|
<version>1.4.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -13,7 +13,7 @@ public interface UserService {
|
|||||||
|
|
||||||
Set<String> existsByLogin(@NonNull Set<String> logins);
|
Set<String> existsByLogin(@NonNull Set<String> logins);
|
||||||
|
|
||||||
Optional<User> reg(@NonNull User user);
|
User reg(@NonNull User user);
|
||||||
|
|
||||||
List<User> addAll(Set<User> newUsers);
|
List<User> addAll(Set<User> newUsers);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<User> reg(@NonNull User user) {
|
public User reg(@NonNull User user) {
|
||||||
final Optional<User> optUser = userRepository.findByLogin(user.getLogin());
|
final Optional<User> optUser = userRepository.findByLogin(user.getLogin());
|
||||||
if (optUser.isPresent()) {
|
if (optUser.isPresent()) {
|
||||||
final User oldUser = optUser.get();
|
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);
|
Optional<PullRequestSheetJson> sheetJson = Utils.urlToJson(bitbucketConfig.getUrlPullRequestClose(), user.getToken(), PullRequestSheetJson.class);
|
||||||
if (sheetJson.isPresent()) {
|
if (sheetJson.isPresent()) {
|
||||||
oldUser.setTelegramId(user.getTelegramId());
|
oldUser.setTelegramId(user.getTelegramId());
|
||||||
return Optional.of(userRepository.save(oldUser));
|
return userRepository.save(oldUser);
|
||||||
} else {
|
} else {
|
||||||
throw new RegException("Ваш токен не валиден");
|
throw new RegException("Ваш токен не валиден");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RegException("Вы уже авторизованы в системе");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RegException("Пользователь не найден, подождите обновление базы пользователей!");
|
throw new RegException("Пользователь не найден, подождите обновление базы пользователей!");
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<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 rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
|
||||||
<link href="static/css/signin.css" rel="stylesheet">
|
<link href="static/css/signin.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
@ -20,9 +20,9 @@
|
|||||||
<input type="text" v-model="login" id="login" name="login" class="form-control" placeholder="Username">
|
<input type="text" v-model="login" id="login" name="login" class="form-control" placeholder="Username">
|
||||||
<label for="token" class="sr-only">И еще что то тут...</label>
|
<label for="token" class="sr-only">И еще что то тут...</label>
|
||||||
<input type="text" v-model="token" id="token" class="form-control" placeholder="Token">
|
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@ -43,7 +43,8 @@
|
|||||||
const data = {
|
const data = {
|
||||||
telegramId: this.telegramId,
|
telegramId: this.telegramId,
|
||||||
login: this.login,
|
login: this.login,
|
||||||
token: this.token
|
token: this.token,
|
||||||
|
responseMessage: this.responseMessage
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
|
@ -28,6 +28,7 @@ body {
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
.form-signin .form-control {
|
.form-signin .form-control {
|
||||||
|
margin: 10px;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
Loading…
Reference in New Issue
Block a user