refactor: 修改密码退出登入

This commit is contained in:
chenjianxing 2021-09-22 15:13:28 +08:00 committed by jianxing
parent 41780b2e4a
commit e56da41ac5
6 changed files with 51 additions and 25 deletions

View File

@ -150,7 +150,13 @@ public class ApiTestCaseService {
private ApiTestCaseRequest initRequest(ApiTestCaseRequest request, boolean setDefultOrders, boolean checkThisWeekData) {
if (setDefultOrders) {
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
orders.forEach(i -> i.setPrefix("t1"));
orders.forEach(i -> {
if (i.getName().equals("path")) {
i.setPrefix("a");
} else {
i.setPrefix("t1");
}
});
request.setOrders(orders);
}
if (checkThisWeekData) {

View File

@ -234,7 +234,14 @@
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name === 'path'">
a.${order.name} ${order.type}
</when>
<otherwise>
t1.${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>

View File

@ -29,6 +29,7 @@ import AboutUs from "./AboutUs";
import axios from "axios";
import {mapGetters} from "vuex";
import {ORGANIZATION_ID, PROJECT_ID, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
import {logout} from "@/network/user";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const auth = requireComponent.keys().length > 0 ? requireComponent("./auth/Auth.vue") : {};
@ -51,23 +52,7 @@ export default {
},
methods: {
logout: function () {
axios.get("/signout").then(response => {
if (response.data.success) {
localStorage.removeItem(TokenKey);
sessionStorage.removeItem(ORGANIZATION_ID);
sessionStorage.removeItem(WORKSPACE_ID);
sessionStorage.removeItem(PROJECT_ID);
window.location.href = "/login";
}
}).catch(error => {
localStorage.removeItem(TokenKey);
sessionStorage.removeItem(ORGANIZATION_ID);
sessionStorage.removeItem(WORKSPACE_ID);
sessionStorage.removeItem(PROJECT_ID);
window.location.href = "/login";
});
logout();
},
handleCommand(command) {
switch (command) {

View File

@ -102,6 +102,7 @@ import TapdUserInfo from "@/business/components/settings/personal/TapdUserInfo";
import {getIntegrationService} from "@/network/organization";
import ZentaoUserInfo from "@/business/components/settings/personal/ZentaoUserInfo";
import AzureDevopsUserInfo from "@/business/components/settings/personal/AzureDevopsUserInfo";
import {logout} from "@/network/user";
export default {
name: "MsPersonSetting",
@ -267,9 +268,7 @@ export default {
}
this.result = this.$post(this.updatePasswordPath, this.ruleForm, response => {
this.$success(this.$t('commons.modify_success'));
this.editPasswordVisible = false;
this.initTableData();
this.reload();
logout();
});
} else {
return false;

View File

@ -129,6 +129,7 @@ import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn
import EditUser from "@/business/components/settings/system/EditUser";
import ProjectCascader from "@/business/components/settings/system/components/ProjectCascader";
import GroupCascader from "@/business/components/settings/system/components/GroupCascader";
import {logout} from "@/network/user";
export default {
name: "MsUser",
@ -189,6 +190,7 @@ export default {
id: ''
}]
},
changePasswordUser: '',
screenHeight: 'calc(100vh - 195px)',
checkPasswordForm: {},
ruleForm: {},
@ -280,6 +282,7 @@ export default {
this.$refs.editUser.open("Edit", this.$t('user.modify'), row);
},
editPassword(row) {
this.changePasswordUser = row.id;
this.editPasswordVisible = true;
this.ruleForm = Object.assign({}, row);
listenGoBack(this.handleClose);
@ -329,9 +332,13 @@ export default {
if (valid) {
this.result = this.$post(this.editPasswordPath, this.ruleForm, () => {
this.$success(this.$t('commons.modify_success'));
if (this.changePasswordUser === getCurrentUser().id) {
logout();
} else {
this.editPasswordVisible = false;
this.search();
this.reload();
}
});
} else {
return false;

View File

@ -1,5 +1,7 @@
import {getCurrentProjectID} from "@/common/js/utils";
import {post} from "@/common/js/ajax";
import axios from "axios";
import {ORGANIZATION_ID, PROJECT_ID, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
export function getProjectMember(callBack) {
return new Promise((resolve) => {
@ -11,3 +13,23 @@ export function getProjectMember(callBack) {
});
});
}
export function logout() {
axios.get("/signout").then(response => {
if (response.data.success) {
localStorage.removeItem(TokenKey);
sessionStorage.removeItem(ORGANIZATION_ID);
sessionStorage.removeItem(WORKSPACE_ID);
sessionStorage.removeItem(PROJECT_ID);
window.location.href = "/login";
}
}).catch(error => {
localStorage.removeItem(TokenKey);
sessionStorage.removeItem(ORGANIZATION_ID);
sessionStorage.removeItem(WORKSPACE_ID);
sessionStorage.removeItem(PROJECT_ID);
window.location.href = "/login";
});
}