From d7f586f386ba7c3bf7d1cd057ad4d2e4896e65f1 Mon Sep 17 00:00:00 2001 From: wolbernd Date: Wed, 21 Apr 2021 08:02:22 +0200 Subject: [PATCH] [FIX] Allow deletion of own account for passwordless accounts (e.g. OAUTH) (#21119) --- app/lib/server/methods/deleteUserOwnAccount.js | 3 ++- client/views/account/AccountProfilePage.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/server/methods/deleteUserOwnAccount.js b/app/lib/server/methods/deleteUserOwnAccount.js index 4a655856ec5..1ff7494a875 100644 --- a/app/lib/server/methods/deleteUserOwnAccount.js +++ b/app/lib/server/methods/deleteUserOwnAccount.js @@ -1,6 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; import { Accounts } from 'meteor/accounts-base'; +import { SHA256 } from 'meteor/sha'; import s from 'underscore.string'; import { settings } from '../../../settings'; @@ -34,7 +35,7 @@ Meteor.methods({ if (result.error) { throw new Meteor.Error('error-invalid-password', 'Invalid password', { method: 'deleteUserOwnAccount' }); } - } else if (user.username !== s.trim(password)) { + } else if (SHA256(user.username) !== s.trim(password)) { throw new Meteor.Error('error-invalid-username', 'Invalid username', { method: 'deleteUserOwnAccount' }); } diff --git a/client/views/account/AccountProfilePage.js b/client/views/account/AccountProfilePage.js index 789e5869022..ffc211ca740 100644 --- a/client/views/account/AccountProfilePage.js +++ b/client/views/account/AccountProfilePage.js @@ -231,7 +231,6 @@ const AccountProfilePage = () => { onCancel={closeModal} title={title} text={t('If_you_are_sure_type_in_your_username')} - isPassword /> )); }, [closeModal, deleteOwnAccount, dispatchToastMessage, erasureType, localPassword, t, setModal]);