From 92aef6b1807c70c6b798d809f36d1350eedfcde4 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 1 Jul 2020 23:48:04 +0300 Subject: [PATCH 1/3] Add API function and action for disabling MFA --- src/api/users.js | 10 ++++++++++ src/store/modules/users.js | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/src/api/users.js b/src/api/users.js index 642dd1a7..b62df5d7 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -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), diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 90b37e56..5f35bf44 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -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 } From 0a3cbcb70dbbc1abbb65ac52d315d55e746fa461 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 2 Jul 2020 00:15:41 +0300 Subject: [PATCH 2/3] Add ability to disable multi-factor authentication for a user --- src/lang/en.js | 1 + src/views/statuses/show.vue | 2 +- src/views/users/components/ModerationDropdown.vue | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lang/en.js b/src/lang/en.js index 16ff35f2..4e1be13b 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -201,6 +201,7 @@ export default { disableAnySubscription: 'Disallow following user at all', disableAnySubscriptionForMultiple: 'Disallow following users at all', requirePasswordReset: 'Require password reset on next login', + disableMfa: 'Disable multi-factor authentication', selectUsers: 'Select users to apply actions to multiple users', moderateUser: 'Moderate user', moderateUsers: 'Moderate multiple users', diff --git a/src/views/statuses/show.vue b/src/views/statuses/show.vue index fc91fcb9..5f13348a 100644 --- a/src/views/statuses/show.vue +++ b/src/views/statuses/show.vue @@ -35,7 +35,7 @@ {{ $t('users.requirePasswordReset') }} + + {{ $t('users.disableMfa') }} + @@ -127,6 +132,9 @@ export default { } }, methods: { + disableMfa(nickname) { + this.$store.dispatch('DisableMfa', nickname) + }, getPasswordResetToken(nickname) { this.$emit('open-reset-token-dialog') this.$store.dispatch('GetPasswordResetToken', nickname) From 71885f017d9fe22745acc184550cf6e7066cae61 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Thu, 2 Jul 2020 00:16:57 +0300 Subject: [PATCH 3/3] Update Changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 030c8593..c498ac34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - In Notes add link to the note author's profile page - In Moderation log add link to the actor's profile page - Support pagination of local emoji packs and files -- Adds MRF Activity Expiration setting +- Add MRF Activity Expiration setting +- Add ability to disable multi-factor authentication for a user ### Changed