mirror of
https://github.com/hpd840321/craftlabs-authorization-sdk.git
synced 2026-06-09 10:00:30 +08:00
feat(m11): add password reset, owner fields, system params
This commit is contained in:
+20
@@ -128,6 +128,26 @@ public class AuthController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("/admin/reset-password")
|
||||
public ResponseEntity<Void> resetPassword(@RequestBody Map<String, String> body) {
|
||||
String username = body.get("username");
|
||||
String newPassword = body.get("newPassword");
|
||||
if (username == null || newPassword == null || newPassword.length() < 6) {
|
||||
throw new ResponseStatusException(org.springframework.http.HttpStatus.BAD_REQUEST,
|
||||
newPassword == null || newPassword.length() < 6 ? "新密码至少6位" : "参数不完整");
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping("/admin/force-logout")
|
||||
public ResponseEntity<Void> forceLogout(@RequestBody Map<String, String> body) {
|
||||
String username = body.get("username");
|
||||
if (username == null) {
|
||||
throw new ResponseStatusException(org.springframework.http.HttpStatus.BAD_REQUEST, "username required");
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping("/change-password")
|
||||
public ResponseEntity<Void> changePassword(@RequestBody Map<String, String> body) {
|
||||
String oldPassword = body.get("oldPassword");
|
||||
|
||||
+11
@@ -30,6 +30,9 @@ public class PlatformCustomer {
|
||||
@TableField("customer_code")
|
||||
private String customerCode;
|
||||
|
||||
@TableField("owner_user_id")
|
||||
private String ownerUserId;
|
||||
|
||||
@TableField("created_at")
|
||||
private OffsetDateTime createdAt;
|
||||
|
||||
@@ -100,6 +103,14 @@ public class PlatformCustomer {
|
||||
this.customerCode = customerCode;
|
||||
}
|
||||
|
||||
public String getOwnerUserId() {
|
||||
return ownerUserId;
|
||||
}
|
||||
|
||||
public void setOwnerUserId(String ownerUserId) {
|
||||
this.ownerUserId = ownerUserId;
|
||||
}
|
||||
|
||||
public OffsetDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
+11
@@ -36,6 +36,9 @@ public class PlatformProject {
|
||||
@TableField("project_manager")
|
||||
private String projectManager;
|
||||
|
||||
@TableField("owner_user_id")
|
||||
private String ownerUserId;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -107,4 +110,12 @@ public class PlatformProject {
|
||||
public void setProjectManager(String projectManager) {
|
||||
this.projectManager = projectManager;
|
||||
}
|
||||
|
||||
public String getOwnerUserId() {
|
||||
return ownerUserId;
|
||||
}
|
||||
|
||||
public void setOwnerUserId(String ownerUserId) {
|
||||
this.ownerUserId = ownerUserId;
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -27,6 +27,9 @@ public class CustomerRequest {
|
||||
@Size(max = 64)
|
||||
private String customerCode;
|
||||
|
||||
@Size(max = 256)
|
||||
private String ownerUserId;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -82,4 +85,12 @@ public class CustomerRequest {
|
||||
public void setCustomerCode(String customerCode) {
|
||||
this.customerCode = customerCode;
|
||||
}
|
||||
|
||||
public String getOwnerUserId() {
|
||||
return ownerUserId;
|
||||
}
|
||||
|
||||
public void setOwnerUserId(String ownerUserId) {
|
||||
this.ownerUserId = ownerUserId;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -12,6 +12,7 @@ public class CustomerResponse {
|
||||
private String address;
|
||||
private String billingInfo;
|
||||
private String customerCode;
|
||||
private String ownerUserId;
|
||||
private OffsetDateTime createdAt;
|
||||
private OffsetDateTime updatedAt;
|
||||
|
||||
@@ -79,6 +80,14 @@ public class CustomerResponse {
|
||||
this.customerCode = customerCode;
|
||||
}
|
||||
|
||||
public String getOwnerUserId() {
|
||||
return ownerUserId;
|
||||
}
|
||||
|
||||
public void setOwnerUserId(String ownerUserId) {
|
||||
this.ownerUserId = ownerUserId;
|
||||
}
|
||||
|
||||
public OffsetDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
+11
@@ -23,6 +23,9 @@ public class ProjectRequest {
|
||||
|
||||
private String plannedEndDate;
|
||||
|
||||
@Size(max = 256)
|
||||
private String ownerUserId;
|
||||
|
||||
public Long getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
@@ -70,4 +73,12 @@ public class ProjectRequest {
|
||||
public void setPlannedEndDate(String plannedEndDate) {
|
||||
this.plannedEndDate = plannedEndDate;
|
||||
}
|
||||
|
||||
public String getOwnerUserId() {
|
||||
return ownerUserId;
|
||||
}
|
||||
|
||||
public void setOwnerUserId(String ownerUserId) {
|
||||
this.ownerUserId = ownerUserId;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -11,6 +11,7 @@ public class ProjectResponse {
|
||||
private String plannedStartDate;
|
||||
private String plannedEndDate;
|
||||
private String projectManager;
|
||||
private String ownerUserId;
|
||||
private OffsetDateTime createdAt;
|
||||
private OffsetDateTime updatedAt;
|
||||
|
||||
@@ -70,6 +71,14 @@ public class ProjectResponse {
|
||||
this.projectManager = projectManager;
|
||||
}
|
||||
|
||||
public String getOwnerUserId() {
|
||||
return ownerUserId;
|
||||
}
|
||||
|
||||
public void setOwnerUserId(String ownerUserId) {
|
||||
this.ownerUserId = ownerUserId;
|
||||
}
|
||||
|
||||
public OffsetDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE platform_customer ADD COLUMN owner_user_id VARCHAR(256);
|
||||
ALTER TABLE platform_project ADD COLUMN owner_user_id VARCHAR(256);
|
||||
@@ -200,6 +200,12 @@ const routes = [
|
||||
component: () => import("../views/AuditSearchView.vue"),
|
||||
meta: { roles: ["SYS_ADMIN"], title: "审计日志" },
|
||||
},
|
||||
{
|
||||
path: "admin/params",
|
||||
name: "system-params",
|
||||
component: () => import("../views/SystemParamsView.vue"),
|
||||
meta: { roles: ["SYS_ADMIN"], title: "系统参数" },
|
||||
},
|
||||
],
|
||||
},
|
||||
{ path: "/403", name: "forbidden", component: () => import("../views/ForbiddenView.vue") },
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const params = ref({
|
||||
orphanSnStrictValidation: true,
|
||||
deliveryGateEnabled: true,
|
||||
sessionTimeoutMinutes: 60,
|
||||
passwordMinLength: 6,
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
async function loadParams() {
|
||||
try {
|
||||
const stored = localStorage.getItem('systemParams')
|
||||
if (stored) {
|
||||
params.value = { ...params.value, ...JSON.parse(stored) }
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
async function saveParams() {
|
||||
loading.value = true
|
||||
try {
|
||||
localStorage.setItem('systemParams', JSON.stringify(params.value))
|
||||
ElMessage.success('参数已保存(MVP: 存储于浏览器本地)')
|
||||
} catch (e) {
|
||||
ElMessage.error('保存失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadParams)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h2>系统参数</h2>
|
||||
<el-card shadow="never" style="margin-top:16px;max-width:560px">
|
||||
<el-form label-width="200px" label-position="left">
|
||||
<el-form-item label="孤儿 SN 严格校验">
|
||||
<el-switch v-model="params.orphanSnStrictValidation" />
|
||||
</el-form-item>
|
||||
<el-form-item label="交付闸门启用">
|
||||
<el-switch v-model="params.deliveryGateEnabled" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会话超时(分钟)">
|
||||
<el-input-number v-model="params.sessionTimeoutMinutes" :min="5" :max="1440" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码最小长度">
|
||||
<el-input-number v-model="params.passwordMinLength" :min="4" :max="64" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="saveParams">保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user