[admin] remove two-step authentication

This commit is contained in:
xiaomlove
2022-05-13 17:55:49 +08:00
parent 155d4ddcb6
commit a7d9a68db4
12 changed files with 70 additions and 38 deletions

View File

@@ -208,7 +208,9 @@ const api = {
pardonHrBulk: (params = {}) => {
return axios.put('hr-pardon', params);
},
removeTwoStepAuthentication: (params = {}) => {
return axios.put('user-remove-two-step', params);
},
}
export default api

View File

@@ -68,31 +68,24 @@
<td><el-button size="small" @click="handleViewInviteInfo">View</el-button></td>
</tr>
<tr>
<td>Seed points</td>
<td>{{baseInfo.seed_points}}</td>
</tr>
<tr>
<td>H&R inspecting</td>
<td>{{baseInfo.invites}}</td>
<td>Two-step authentication</td>
<td>{{baseInfo.two_step_secret ? 'Enabled' : 'Disabled'}}</td>
<td>
<el-popconfirm
title="Confirm Remove ?"
@confirm="handleRemoveHitAndRun"
v-if="baseInfo.two_step_secret"
title="Confirm Disable Two-step authentication ?"
@confirm="handleRemoveTwoStepAuthentication"
>
<template #reference>
<el-button size="small">Remove</el-button>
</template>
</el-popconfirm>
<el-popconfirm
title="Confirm Pardon ?"
@confirm="handlePardonHitAndRun"
>
<template #reference>
<el-button size="small">Pardon</el-button>
<el-button type="default" size="small">Disable</el-button>
</template>
</el-popconfirm>
</td>
</tr>
<tr>
<td>Seed points</td>
<td>{{baseInfo.seed_points}}</td>
</tr>
<tr>
<td>Invites</td>
<td>{{baseInfo.invites}}</td>
@@ -356,12 +349,12 @@ export default {
ElMessage.success(res.msg)
await fetchPageData()
}
const handleRemoveHitAndRun = async (id) => {
let res = await api.removeUserMedal(id)
const handleRemoveTwoStepAuthentication = async () => {
let res = await api.removeTwoStepAuthentication({uid: id})
ElMessage.success(res.msg)
await fetchPageData()
}
return {
...toRefs(state),
handleRemoveExam,
@@ -377,6 +370,7 @@ export default {
fetchPageData,
handleRemoveUserMedal,
handleIncrementDecrement,
handleRemoveTwoStepAuthentication,
assignExam,
grantMedal,
viewInviteInfo,

View File

@@ -7,13 +7,13 @@
:close-on-click-modal="false"
>
<el-table :data="inviteInfo" v-loading="loading">
<el-table-column prop="id" label="ID" width="55"></el-table-column>
<el-table-column prop="id" label="ID" width="80"></el-table-column>
<el-table-column prop="inviter_user.username" label="Inviter" width="150"></el-table-column>
<el-table-column prop="invitee" label="Receive email"></el-table-column>
<el-table-column prop="hash" label="Hash"></el-table-column>
<el-table-column prop="hash" label="Hash" width="300"></el-table-column>
<el-table-column prop="valid_text" label="Hash valid" width="100"></el-table-column>
<el-table-column prop="invitee_register_email" label="Register email"></el-table-column>
<el-table-column prop="time_invited" label="Time invited" width="160"></el-table-column>
<el-table-column prop="time_invited" label="Time invited" width="180"></el-table-column>
</el-table>
</el-dialog>