Skip to content

Commit

Permalink
modify password
Browse files Browse the repository at this point in the history
  • Loading branch information
ponfee committed Dec 10, 2023
1 parent ca67f81 commit 5930e94
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 43 deletions.
4 changes: 2 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ disjob # Main project①

3. Login to the Admin

- Open【 http://127.0.0.1:80/ 】in your browser and login with username/password: `admin`/`admin123`
- Open【 http://127.0.0.1:80/ 】in your browser and login with username/password: `admin`/`123456`
- Find the Scheduling Management menu in the left sidebar to use the `scheduling management` function
- Scheduling Configuration: Job configuration, including viewing, adding, modifying, deleting, triggering, disabling, etc.
- Scheduling Instances: job trigger time generate an instance, the instance split to many tasks.

4. Link Address
- Admin demo:【 http://ponfee.cn:8000/ 】, username/password: `disjob`/`disjob123`
- Admin demo:【 http://ponfee.cn:8000/ 】, username/password: `disjob`/`123456`
- Online documentation: **Under construction, please stay tuned!**

## User Guide
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,18 @@ disjob # 主项目①

3. 登录管理后台

- 浏览器访问【 http://127.0.0.1:80/ 】登录管理后台,用户名/密码:`admin`/`admin123`
- 浏览器访问【 http://127.0.0.1:80/ 】登录管理后台,用户名/密码:`admin`/`123456`
- 登录后在左侧菜单栏找到`调度管理`菜单,即可使用调度管理功能
- **Supervisor**:查看Supervisor机器列表及其运行情况
- **管理分组**:给管理员使用,管理分组(一个分组可理解为是一个应用)
- **我的分组**:给应用负责人使用,可查看每个组(应用)的Worker机器列表及其运行情况
- **作业配置**:作业(job)配置,包括查看、新增、修改、删除、触发、禁用等
- **任务实例**:job在某一时间点被触发执行的实例(instance),一个实例会拆分成若干个任务(task)
- 在页面上方的`第一个分页表格`是以树状(tree)方式展示任务实例,并支持下钻
- 鼠标向下滚动页面后看到的`第二个分页表格`是以扁平(flat)方式展示任务实例

4. 链接地址
- 管理后台**演示地址**:【 http://ponfee.cn:8000/ 】,用户名/密码:`disjob`/`disjob123`
- 管理后台**演示地址**:【 http://ponfee.cn:8000/ 】,用户名/密码:`disjob`/`123456`
- 在线查看**文档地址**`正在建设中,敬请期待!`

## User Guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h4 style="color:#004d8c; font-weight:bold;">欢迎使用 <strong>Disjob 管理
<form id="signupForm" autocomplete="off">
<h4 class="no-margins" style="color: #004d8c; font-weight: bold;">登录:</h4>
<input type="text" name="username" class="form-control uname" placeholder="用户名" value="admin" />
<input type="password" name="password" class="form-control pword" placeholder="密码" value="admin123" />
<input type="password" name="password" class="form-control pword" placeholder="密码" value="123456" />
<div class="row m-t" th:if="${captchaEnabled==true}">
<div class="col-xs-6">
<input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ <h2 tabindex="-1" id="user-content-quick-start" dir="auto"><a class="heading-lin
<li>登录管理后台</li>
</ol>
<ul dir="auto">
<li>浏览器访问【 <a href="http://127.0.0.1:80/" rel="nofollow">http://127.0.0.1:80/</a> 】登录管理后台,用户名/密码:<code>admin</code>/<code>admin123</code></li>
<li>浏览器访问【 <a href="http://127.0.0.1:80/" rel="nofollow">http://127.0.0.1:80/</a> 】登录管理后台,用户名/密码:<code>admin</code>/<code>123456</code></li>
<li>登录后在左侧菜单栏找到<code>调度管理</code>菜单,即可使用调度管理功能</li>
<li><strong>作业配置</strong>:作业(job)配置,包括查看、新增、修改、删除、触发、禁用等</li>
<li><strong>任务实例</strong>:job在某一时间点被触发执行的实例(instance),一个实例会拆分成若干个任务(task)
Expand All @@ -318,7 +318,7 @@ <h2 tabindex="-1" id="user-content-quick-start" dir="auto"><a class="heading-lin
<li>链接地址</li>
</ol>
<ul dir="auto">
<li>管理后台<strong>演示地址</strong>:【 <a href="http://ponfee.cn:8000/" rel="nofollow">http://ponfee.cn:8000/</a> 】,用户名/密码:<code>disjob</code>/<code>disjob123</code></li>
<li>管理后台<strong>演示地址</strong>:【 <a href="http://ponfee.cn:8000/" rel="nofollow">http://ponfee.cn:8000/</a> 】,用户名/密码:<code>disjob</code>/<code>123456</code></li>
<li>在线查看<strong>文档地址</strong><code>正在建设中,敬请期待!</code></li>
</ul>
<h2 tabindex="-1" id="user-content-user-guide" dir="auto"><a class="heading-link" href="#user-guide">User Guide<svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import cn.ponfee.disjob.common.collect.Collects;
import cn.ponfee.disjob.common.model.PageResponse;
import cn.ponfee.disjob.core.exception.JobException;
import cn.ponfee.disjob.supervisor.application.SchedGroupService;
import cn.ponfee.disjob.supervisor.application.OpenapiService;
import cn.ponfee.disjob.supervisor.application.SchedGroupService;
import cn.ponfee.disjob.supervisor.application.request.AddSchedJobRequest;
import cn.ponfee.disjob.supervisor.application.request.SchedJobPageRequest;
import cn.ponfee.disjob.supervisor.application.request.UpdateSchedJobRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ public String edit(@PathVariable("group") String group, ModelMap mmap) {
@PostMapping("/edit")
@ResponseBody
public AjaxResult doEdit(UpdateSchedGroupRequest req) {
req.setUpdatedBy(getLoginName());
String currentUser = getLoginName();
if (!currentUser.equals(schedGroupService.get(req.getGroup()).getOwnUser())) {
// 非Own User不可更换Own User数据(即只有Own User本人才能更换该group的Own User为其它人)
req.setOwnUser(null);
}
req.setUpdatedBy(currentUser);
boolean result = schedGroupService.edit(req);
return result ? success() : error("修改冲突,请刷重新新页面");
return result ? success() : error("修改冲突,请刷新页面");
}

@RequiresPermissions(PERMISSION_OPERATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@
var ops = operation === 'change' ? "更换" : (operation === 'set' ? "设置" : "清除");
$.modal.confirm("确认要" + ops + "'" + name + "'令牌吗?", function () {
$.operate.post(prefix + "/token", params, function (result) {
input.val(result.data);
setTokenButton(name);
if (result.code === 0) {
input.val(result.data);
setTokenButton(name);
}
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
field: 'currentPoolSize',
title: '当前线程数'
title: '当前总线程数'
},
{
field: 'activePoolSize',
Expand All @@ -66,17 +66,17 @@
field: 'completedTaskCount',
title: '已执行完成任务数'
},
{
field: 'jvmThreadActiveCount',
title: 'JVM活跃线程数'
},
{
field: 'closed',
title: '线程池是否已关闭',
formatter: function(value, row, index) {
return value ? '<span class="badge badge-success">是</span>' : '<span class="badge badge-info">否</span>';
}
},
{
field: 'jvmThreadActiveCount',
title: 'JVM活跃线程数'
},
{
field: 'alsoSupervisor',
title: '是否同为Supervisor',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('我的分组')" />
<th:block th:include="include :: select2-css" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
field: 'currentPoolSize',
title: '当前线程数'
title: '当前总线程数'
},
{
field: 'activePoolSize',
Expand All @@ -66,17 +66,17 @@
field: 'completedTaskCount',
title: '已执行完成任务数'
},
{
field: 'jvmThreadActiveCount',
title: 'JVM活跃线程数'
},
{
field: 'closed',
title: '线程池是否已关闭',
formatter: function(value, row, index) {
return value ? '<span class="badge badge-success">是</span>' : '<span class="badge badge-info">否</span>';
}
},
{
field: 'jvmThreadActiveCount',
title: 'JVM活跃线程数'
},
{
field: 'alsoSupervisor',
title: '是否同为Supervisor',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import cn.ponfee.disjob.core.base.Worker;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
Expand All @@ -28,16 +28,19 @@
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.*;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.ResponseExtractor;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

import java.lang.reflect.Type;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;

/**
Expand All @@ -54,7 +57,22 @@ public final class DiscoveryRestTemplate<D extends Server> {
public static final Type RESULT_BOOLEAN = new ParameterizedTypeReference<Result<Boolean>>() {}.getType();
public static final Type RESULT_VOID = new ParameterizedTypeReference<Result<Void>>() {}.getType();
public static final Object[] EMPTY = new Object[0];
private static final List<HttpStatus> TIMEOUT_STATUS_LIST = ImmutableList.of(HttpStatus.REQUEST_TIMEOUT, HttpStatus.GATEWAY_TIMEOUT);
private static final Set<HttpStatus> RETRIABLE_HTTP_STATUS = ImmutableSet.of(
// 4xx
HttpStatus.REQUEST_TIMEOUT,
HttpStatus.CONFLICT,
HttpStatus.LOCKED,
HttpStatus.FAILED_DEPENDENCY,
HttpStatus.TOO_EARLY,
HttpStatus.PRECONDITION_REQUIRED,
HttpStatus.TOO_MANY_REQUESTS,

// 5xx
HttpStatus.BAD_GATEWAY,
HttpStatus.SERVICE_UNAVAILABLE,
HttpStatus.GATEWAY_TIMEOUT,
HttpStatus.BANDWIDTH_LIMIT_EXCEEDED
);

private final RestTemplate restTemplate;
private final Discovery<D> discoveryServer;
Expand Down Expand Up @@ -154,7 +172,7 @@ public <T> T execute(String group, String path, HttpMethod httpMethod, Type retu
}
ex = e;
LOG.error("Invoke server rpc failed: {}, {}, {}", url, Jsons.toJson(arguments), e.getMessage());
if (!requireRetry(e)) {
if (!isRequireRetry(e)) {
break;
}
if (i < n) {
Expand All @@ -179,6 +197,8 @@ public RestTemplate getRestTemplate() {
return restTemplate;
}

// ----------------------------------------------------------------------------------------private methods

private static MultiValueMap<String, String> buildQueryParams(Object[] arguments) {
if (ArrayUtils.isEmpty(arguments)) {
return null;
Expand All @@ -192,15 +212,25 @@ private static MultiValueMap<String, String> buildQueryParams(Object[] arguments
return params;
}

private static boolean requireRetry(Throwable e) {
if (e instanceof ResourceAccessException) {
return (e.getCause() instanceof SocketTimeoutException);
private static boolean isRequireRetry(Throwable e) {
if (isTimeoutException(e) || isTimeoutException(e.getCause())) {
// org.springframework.web.client.ResourceAccessException#getCause may be timeout
return true;
}
if (!(e instanceof HttpStatusCodeException)) {
return false;
}
HttpStatus statusCode = ((HttpStatusCodeException) e).getStatusCode();
return TIMEOUT_STATUS_LIST.contains(statusCode);
return RETRIABLE_HTTP_STATUS.contains(((HttpStatusCodeException) e).getStatusCode());
}

private static boolean isTimeoutException(Throwable e) {
if (e == null) {
return false;
}
return (e instanceof java.net.SocketTimeoutException)
|| (e instanceof java.net.ConnectException)
|| (e instanceof org.apache.http.conn.ConnectTimeoutException)
|| (e instanceof java.rmi.ConnectException);
}

// ----------------------------------------------------------------------------------------builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ public boolean delete(String group, String updatedBy) {
@Transactional(transactionManager = TX_MANAGER_SPRING_BEAN_NAME, rollbackFor = Exception.class)
public boolean edit(UpdateSchedGroupRequest request) {
request.checkAndTrim();
SchedGroup schedGroup = request.toSchedGroup();
return Functions.doIfTrue(
isOneAffectedRow(schedGroupMapper.edit(schedGroup)),
isOneAffectedRow(schedGroupMapper.edit(request.toSchedGroup())),
this::refresh
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.util.Collections;
import java.util.Set;
import java.util.stream.Stream;

/**
* Disjob group
Expand Down Expand Up @@ -46,13 +47,14 @@ private DisjobGroup(String supervisorToken, String workerToken, String userToken
}

public static DisjobGroup of(SchedGroup schedGroup) {
String ownUser = schedGroup.getOwnUser();
return new DisjobGroup(
schedGroup.getSupervisorToken(),
schedGroup.getWorkerToken(),
schedGroup.getUserToken(),
schedGroup.getOwnUser(),
parse(schedGroup.getDevUsers()),
parse(schedGroup.getAlarmUsers()),
ownUser,
parse(schedGroup.getDevUsers(), ownUser),
parse(schedGroup.getAlarmUsers(), ownUser),
schedGroup.getWebHook()
);
}
Expand All @@ -63,8 +65,15 @@ public boolean isDeveloper(String user) {

// --------------------------------------------------------------private methods

private static Set<String> parse(String str) {
return StringUtils.isBlank(str) ? Collections.emptySet() : ImmutableSet.copyOf(str.split(Str.COMMA));
private static Set<String> parse(String str, String ownUser) {
if (StringUtils.isBlank(str)) {
return Collections.singleton(ownUser);
}
String[] array = str.split(Str.COMMA);
ImmutableSet.Builder<String> builder = ImmutableSet.builderWithExpectedSize((array.length + 1) << 1);
builder.add(ownUser);
Stream.of(array).filter(StringUtils::isNotBlank).forEach(builder::add);
return builder.build();
}

}
6 changes: 3 additions & 3 deletions sql/mysql-disjob_admin.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ create table sys_user (
) engine=innodb auto_increment=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin comment = '用户信息表';

-- ----------------------------
-- 初始化-用户信息表数据:admin/admin123、disjob/disjob123
-- 初始化-用户信息表数据:admin/123456、disjob/123456
-- ----------------------------
insert into sys_user values(1, 103, 'admin', '管理员', '00', '[email protected]', '15888888888', '1', '', '14c17b4e4c51db8d772a59bb43718fe1', '7e040d', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '管理员');
insert into sys_user values(2, 105, 'disjob', 'Disjob', '00', '[email protected]', '15666666666', '1', '', 'e92fa6078eb4a44f55232dac9fe9e5e3', '486a3e', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '测试员');
insert into sys_user values(1, 103, 'admin', '管理员', '00', '[email protected]', '15888888888', '1', '', '9d6f39c3df35e33504d646820e139943', 'b67ffd', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '管理员');
insert into sys_user values(2, 105, 'disjob', 'Disjob', '00', '[email protected]', '15666666666', '1', '', '3c7230aa7e491814538c02c9e3a2e343', '468561', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '测试员');


-- ----------------------------
Expand Down

0 comments on commit 5930e94

Please sign in to comment.