diff --git a/.changeset/heavy-apricots-wash.md b/.changeset/heavy-apricots-wash.md new file mode 100644 index 0000000000000..fe0e221cfa433 --- /dev/null +++ b/.changeset/heavy-apricots-wash.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated method `getPasswordPolicy`. Moving forward, use the endpoint `pw.getPolicy`. diff --git a/apps/meteor/server/methods/getPasswordPolicy.ts b/apps/meteor/server/methods/getPasswordPolicy.ts deleted file mode 100644 index 483938716093d..0000000000000 --- a/apps/meteor/server/methods/getPasswordPolicy.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Users } from '@rocket.chat/models'; -import type { TranslationKey } from '@rocket.chat/ui-contexts'; -import { check } from 'meteor/check'; -import { Meteor } from 'meteor/meteor'; - -import { passwordPolicy } from '../../app/lib/server'; -import { methodDeprecationLogger } from '../../app/lib/server/lib/deprecationWarningLogger'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - getPasswordPolicy(params: { token: string }): { - enabled: boolean; - policy: [name: TranslationKey, options?: Record][]; - }; - } -} - -Meteor.methods({ - async getPasswordPolicy(params) { - methodDeprecationLogger.method('getPasswordPolicy', '7.0.0'); - - check(params, { token: String }); - - const user = await Users.findOne({ 'services.password.reset.token': params.token }); - if (!user && !Meteor.userId()) { - throw new Meteor.Error('error-invalid-user', 'Invalid user', { - method: 'getPasswordPolicy', - }); - } - return passwordPolicy.getPasswordPolicy() as { - enabled: boolean; - policy: [name: TranslationKey, options?: Record][]; - }; - }, -}); diff --git a/apps/meteor/server/methods/index.ts b/apps/meteor/server/methods/index.ts index 6ae87421c11af..dd738080e05d6 100644 --- a/apps/meteor/server/methods/index.ts +++ b/apps/meteor/server/methods/index.ts @@ -13,7 +13,6 @@ import './createDirectMessage'; import './deleteFileMessage'; import './deleteUser'; import './getAvatarSuggestion'; -import './getPasswordPolicy'; import './getRoomById'; import './getRoomIdByNameOrId'; import './getRoomNameById';