diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index f2d58cb64..d6e8e09ae 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -128,7 +128,7 @@ export class TransactionLinkResolver { @Authorized([RIGHTS.QUERY_TRANSACTION_LINK]) @Query(() => QueryLinkResult) async queryTransactionLink(@Arg('code') code: string): Promise { - if (/^CL-/.exec(code)) { + if (code.match(/^CL-/)) { const contributionLink = await DbContributionLink.findOneOrFail( { code: code.replace('CL-', '') }, { withDeleted: true }, @@ -154,7 +154,7 @@ export class TransactionLinkResolver { const clientTimezoneOffset = getClientTimezoneOffset(context) const user = getUser(context) - if (/^CL-/.exec(code)) { + if (code.match(/^CL-/)) { // acquire lock const releaseLock = await TRANSACTIONS_LOCK.acquire() try { diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index ad357116a..078a29a8e 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -280,7 +280,7 @@ export class UserResolver { dbUser.passwordEncryptionType = PasswordEncryptionType.NO_PASSWORD logger.debug('new dbUser', dbUser) if (redeemCode) { - if (/^CL-/.exec(redeemCode)) { + if (redeemCode.match(/^CL-/)) { const contributionLink = await DbContributionLink.findOne({ code: redeemCode.replace('CL-', ''), }) diff --git a/backend/src/password/EncryptorUtils.ts b/backend/src/password/EncryptorUtils.ts index 93e519fe4..4c802a86f 100644 --- a/backend/src/password/EncryptorUtils.ts +++ b/backend/src/password/EncryptorUtils.ts @@ -12,7 +12,7 @@ const sodium = require('sodium-native') // We will reuse this for changePassword export const isValidPassword = (password: string): boolean => { - return !!/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^a-zA-Z0-9 \\t\\n\\r]).{8,}$/.exec(password) + return !!password.match(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^a-zA-Z0-9 \\t\\n\\r]).{8,}$/) } export const SecretKeyCryptographyCreateKey = (salt: string, password: string): Buffer[] => { diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index e3e1bbecb..587bb788c 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -119,7 +119,7 @@ export const elopageWebhook = async (req: any, res: any): Promise => { // Validate inputs if ( email === '' || - !VALIDATE_EMAIL.exec(email) || + !email.match(VALIDATE_EMAIL) || firstName === '' || firstName.match(VALIDATE_NAME) || lastName === '' ||