Add API function and action for disabling MFA

This commit is contained in:
Angelina Filippova 2020-07-01 23:48:04 +03:00
parent f1a9d1726a
commit 92aef6b180
2 changed files with 19 additions and 0 deletions

View file

@ -62,6 +62,16 @@ export async function deleteUsers(nicknames, authHost, token) {
})
}
export async function disableMfa(nickname, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/disable_mfa`,
method: 'put',
headers: authHeaders(token),
data: { nickname }
})
}
export async function fetchUser(id, authHost, token) {
return await request({
baseURL: baseName(authHost),

View file

@ -7,6 +7,7 @@ import {
deactivateUsers,
deleteRight,
deleteUsers,
disableMfa,
fetchUsers,
getPasswordResetToken,
searchUsers,
@ -150,6 +151,14 @@ const users = {
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
},
async DisableMfa({ dispatch, getters }, nickname) {
try {
await disableMfa(nickname, getters.authHost, getters.token)
} catch (_e) {
return
}
dispatch('SuccessMessage')
},
async ConfirmUsersEmail({ dispatch, getters }, { users, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return { ...user, confirmation_pending: false }