@strapi/plugin-users-permissions 5.50.0 → 5.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ function requireAuth() {
19
19
  const createRegisterSchema = (config)=>yup.object({
20
20
  email: yup.string().email().required(),
21
21
  username: yup.string().required(),
22
- password: yup.string().required().test(function(value) {
22
+ password: yup.string().required().test(function validateRegisterPasswordMaxLength(value) {
23
23
  if (!value) return true;
24
24
  const isValid = new TextEncoder().encode(value).length <= 72;
25
25
  if (!isValid) {
@@ -28,7 +28,7 @@ function requireAuth() {
28
28
  });
29
29
  }
30
30
  return true;
31
- }).test(async function(value) {
31
+ }).test(async function validateRegisterPassword(value) {
32
32
  if (typeof config?.validatePassword === 'function') {
33
33
  try {
34
34
  const isValid = await config.validatePassword(value);
@@ -56,7 +56,7 @@ function requireAuth() {
56
56
  email: yup.string().email().required()
57
57
  }).noUnknown();
58
58
  const createResetPasswordSchema = (config)=>yup.object({
59
- password: yup.string().required().test(function(value) {
59
+ password: yup.string().required().test(function validateResetPasswordMaxLength(value) {
60
60
  if (!value) return true;
61
61
  const isValid = new TextEncoder().encode(value).length <= 72;
62
62
  if (!isValid) {
@@ -65,7 +65,7 @@ function requireAuth() {
65
65
  });
66
66
  }
67
67
  return true;
68
- }).test(async function(value) {
68
+ }).test(async function validateResetPassword(value) {
69
69
  if (typeof config?.validatePassword === 'function') {
70
70
  try {
71
71
  const isValid = await config.validatePassword(value);
@@ -88,7 +88,7 @@ function requireAuth() {
88
88
  code: yup.string().required()
89
89
  }).noUnknown();
90
90
  const createChangePasswordSchema = (config)=>yup.object({
91
- password: yup.string().required().test(function(value) {
91
+ password: yup.string().required().test(function validateChangePasswordMaxLength(value) {
92
92
  if (!value) return true;
93
93
  const isValid = new TextEncoder().encode(value).length <= 72;
94
94
  if (!isValid) {
@@ -97,7 +97,7 @@ function requireAuth() {
97
97
  });
98
98
  }
99
99
  return true;
100
- }).test(async function(value) {
100
+ }).test(async function validateChangePassword(value) {
101
101
  if (typeof config?.validatePassword === 'function') {
102
102
  try {
103
103
  const isValid = await config.validatePassword(value);
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sources":["../../../../server/controllers/validation/auth.js"],"sourcesContent":["'use strict';\n\nconst { yup, validateYupSchema } = require('@strapi/utils');\n\nconst callbackSchema = yup.object({\n identifier: yup.string().required(),\n password: yup.string().required(),\n});\n\nconst createRegisterSchema = (config) =>\n yup.object({\n email: yup.string().email().required(),\n username: yup.string().required(),\n password: yup\n .string()\n .required()\n .test(function (value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function (value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n });\n\nconst sendEmailConfirmationSchema = yup.object({\n email: yup.string().email().required(),\n});\n\nconst validateEmailConfirmationSchema = yup.object({\n confirmation: yup.string().required(),\n});\n\nconst forgotPasswordSchema = yup\n .object({\n email: yup.string().email().required(),\n })\n .noUnknown();\n\nconst createResetPasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function (value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function (value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n\n code: yup.string().required(),\n })\n .noUnknown();\n\nconst createChangePasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function (value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function (value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n currentPassword: yup.string().required(),\n })\n .noUnknown();\n\nmodule.exports = {\n validateCallbackBody: validateYupSchema(callbackSchema),\n validateRegisterBody: (payload, config) =>\n validateYupSchema(createRegisterSchema(config))(payload),\n validateSendEmailConfirmationBody: validateYupSchema(sendEmailConfirmationSchema),\n validateEmailConfirmationBody: validateYupSchema(validateEmailConfirmationSchema),\n validateForgotPasswordBody: validateYupSchema(forgotPasswordSchema),\n validateResetPasswordBody: (payload, config) =>\n validateYupSchema(createResetPasswordSchema(config))(payload),\n validateChangePasswordBody: (payload, config) =>\n validateYupSchema(createChangePasswordSchema(config))(payload),\n};\n"],"names":["yup","validateYupSchema","require$$0","callbackSchema","object","identifier","string","required","password","createRegisterSchema","config","email","username","test","value","isValid","TextEncoder","encode","length","createError","message","validatePassword","error","sendEmailConfirmationSchema","validateEmailConfirmationSchema","confirmation","forgotPasswordSchema","noUnknown","createResetPasswordSchema","passwordConfirmation","oneOf","ref","code","createChangePasswordSchema","currentPassword","auth","validateCallbackBody","validateRegisterBody","payload","validateSendEmailConfirmationBody","validateEmailConfirmationBody","validateForgotPasswordBody","validateResetPasswordBody","validateChangePasswordBody"],"mappings":";;;;;;;;;;;;;AAEA,IAAA,MAAM,EAAEA,GAAG,EAAEC,iBAAiB,EAAE,GAAGC,2BAAAA;IAEnC,MAAMC,cAAAA,GAAiBH,GAAAA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AACJ,OAAAA,EAAS5B,MAAAA,GACnCT,iBAAAA,CAAkB2B,0BAA0BlB,MAAAA,CAAAA,CAAAA,CAAS4B,OAAAA,CAAAA;AACvDK,QAAAA,0BAAAA,EAA4B,CAACL,OAAAA,EAAS5B,MAAAA,GACpCT,iBAAAA,CAAkBgC,2BAA2BvB,MAAAA,CAAAA,CAAAA,CAAS4B,OAAAA;AAC1D,KAAA;;;;;;"}
1
+ {"version":3,"file":"auth.js","sources":["../../../../server/controllers/validation/auth.js"],"sourcesContent":["'use strict';\n\nconst { yup, validateYupSchema } = require('@strapi/utils');\n\nconst callbackSchema = yup.object({\n identifier: yup.string().required(),\n password: yup.string().required(),\n});\n\nconst createRegisterSchema = (config) =>\n yup.object({\n email: yup.string().email().required(),\n username: yup.string().required(),\n password: yup\n .string()\n .required()\n .test(function validateRegisterPasswordMaxLength(value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function validateRegisterPassword(value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n });\n\nconst sendEmailConfirmationSchema = yup.object({\n email: yup.string().email().required(),\n});\n\nconst validateEmailConfirmationSchema = yup.object({\n confirmation: yup.string().required(),\n});\n\nconst forgotPasswordSchema = yup\n .object({\n email: yup.string().email().required(),\n })\n .noUnknown();\n\nconst createResetPasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function validateResetPasswordMaxLength(value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function validateResetPassword(value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n\n code: yup.string().required(),\n })\n .noUnknown();\n\nconst createChangePasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function validateChangePasswordMaxLength(value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function validateChangePassword(value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n currentPassword: yup.string().required(),\n })\n .noUnknown();\n\nmodule.exports = {\n validateCallbackBody: validateYupSchema(callbackSchema),\n validateRegisterBody: (payload, config) =>\n validateYupSchema(createRegisterSchema(config))(payload),\n validateSendEmailConfirmationBody: validateYupSchema(sendEmailConfirmationSchema),\n validateEmailConfirmationBody: validateYupSchema(validateEmailConfirmationSchema),\n validateForgotPasswordBody: validateYupSchema(forgotPasswordSchema),\n validateResetPasswordBody: (payload, config) =>\n validateYupSchema(createResetPasswordSchema(config))(payload),\n validateChangePasswordBody: (payload, config) =>\n validateYupSchema(createChangePasswordSchema(config))(payload),\n};\n"],"names":["yup","validateYupSchema","require$$0","callbackSchema","object","identifier","string","required","password","createRegisterSchema","config","email","username","test","validateRegisterPasswordMaxLength","value","isValid","TextEncoder","encode","length","createError","message","validateRegisterPassword","validatePassword","error","sendEmailConfirmationSchema","validateEmailConfirmationSchema","confirmation","forgotPasswordSchema","noUnknown","createResetPasswordSchema","validateResetPasswordMaxLength","validateResetPassword","passwordConfirmation","oneOf","ref","code","createChangePasswordSchema","validateChangePasswordMaxLength","validateChangePassword","currentPassword","auth","validateCallbackBody","validateRegisterBody","payload","validateSendEmailConfirmationBody","validateEmailConfirmationBody","validateForgotPasswordBody","validateResetPasswordBody","validateChangePasswordBody"],"mappings":";;;;;;;;;;;;;AAEA,IAAA,MAAM,EAAEA,GAAG,EAAEC,iBAAiB,EAAE,GAAGC,2BAAAA;IAEnC,MAAMC,cAAAA,GAAiBH,GAAAA,CAAII,MAAM,CAAC;QAChCC,UAAAA,EAAYL,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ,EAAA;QACjCC,QAAAA,EAAUR,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ;AACjC,KAAA,CAAA;AAEA,IAAA,MAAME,oBAAAA,GAAuB,CAACC,MAAAA,GAC5BV,GAAAA,CAAII,MAAM,CAAC;AACTO,YAAAA,KAAAA,EAAOX,GAAAA,CAAIM,MAAM,EAAA,CAAGK,KAAK,GAAGJ,QAAQ,EAAA;YACpCK,QAAAA,EAAUZ,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ,EAAA;YAC/BC,QAAAA,EAAUR,GAAAA,CACPM,MAAM,EAAA,CACNC,QAAQ,GACRM,IAAI,CAAC,SAASC,iCAAAA,CAAkCC,KAAK,EAAA;gBACpD,IAAI,CAACA,OAAO,OAAO,IAAA;AACnB,gBAAA,MAAMC,UAAU,IAAIC,WAAAA,EAAAA,CAAcC,MAAM,CAACH,KAAAA,CAAAA,CAAOI,MAAM,IAAI,EAAA;AAC1D,gBAAA,IAAI,CAACH,OAAAA,EAAS;oBACZ,OAAO,IAAI,CAACI,WAAW,CAAC;wBAAEC,OAAAA,EAAS;AAAqC,qBAAA,CAAA;AAClF,gBAAA;gBACQ,OAAO,IAAA;AACf,YAAA,CAAA,CAAA,CACOR,IAAI,CAAC,eAAeS,wBAAAA,CAAyBP,KAAK,EAAA;gBACjD,IAAI,OAAOL,MA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;AACfC,QAAAA,oBAAAA,EAAsBzC,iBAAAA,CAAkBE,cAAAA,CAAAA;AACxCwC,QAAAA,oBAAAA,EAAsB,CAACC,OAAAA,EAASlC,MAAAA,GAC9BT,iBAAAA,CAAkBQ,qBAAqBC,MAAAA,CAAAA,CAAAA,CAASkC,OAAAA,CAAAA;AAClDC,QAAAA,iCAAAA,EAAmC5C,iBAAAA,CAAkBwB,2BAAAA,CAAAA;AACrDqB,QAAAA,6BAAAA,EAA+B7C,iBAAAA,CAAkByB,+BAAAA,CAAAA;AACjDqB,QAAAA,0BAAAA,EAA4B9C,iBAAAA,CAAkB2B,oBAAAA,CAAAA;AAC9CoB,QAAAA,yBAAAA,EAA2B,CAACJ,OAAAA,EAASlC,MAAAA,GACnCT,iBAAAA,CAAkB6B,0BAA0BpB,MAAAA,CAAAA,CAAAA,CAASkC,OAAAA,CAAAA;AACvDK,QAAAA,0BAAAA,EAA4B,CAACL,OAAAA,EAASlC,MAAAA,GACpCT,iBAAAA,CAAkBoC,2BAA2B3B,MAAAA,CAAAA,CAAAA,CAASkC,OAAAA;AAC1D,KAAA;;;;;;"}
@@ -13,7 +13,7 @@ function requireAuth() {
13
13
  const createRegisterSchema = (config)=>yup.object({
14
14
  email: yup.string().email().required(),
15
15
  username: yup.string().required(),
16
- password: yup.string().required().test(function(value) {
16
+ password: yup.string().required().test(function validateRegisterPasswordMaxLength(value) {
17
17
  if (!value) return true;
18
18
  const isValid = new TextEncoder().encode(value).length <= 72;
19
19
  if (!isValid) {
@@ -22,7 +22,7 @@ function requireAuth() {
22
22
  });
23
23
  }
24
24
  return true;
25
- }).test(async function(value) {
25
+ }).test(async function validateRegisterPassword(value) {
26
26
  if (typeof config?.validatePassword === 'function') {
27
27
  try {
28
28
  const isValid = await config.validatePassword(value);
@@ -50,7 +50,7 @@ function requireAuth() {
50
50
  email: yup.string().email().required()
51
51
  }).noUnknown();
52
52
  const createResetPasswordSchema = (config)=>yup.object({
53
- password: yup.string().required().test(function(value) {
53
+ password: yup.string().required().test(function validateResetPasswordMaxLength(value) {
54
54
  if (!value) return true;
55
55
  const isValid = new TextEncoder().encode(value).length <= 72;
56
56
  if (!isValid) {
@@ -59,7 +59,7 @@ function requireAuth() {
59
59
  });
60
60
  }
61
61
  return true;
62
- }).test(async function(value) {
62
+ }).test(async function validateResetPassword(value) {
63
63
  if (typeof config?.validatePassword === 'function') {
64
64
  try {
65
65
  const isValid = await config.validatePassword(value);
@@ -82,7 +82,7 @@ function requireAuth() {
82
82
  code: yup.string().required()
83
83
  }).noUnknown();
84
84
  const createChangePasswordSchema = (config)=>yup.object({
85
- password: yup.string().required().test(function(value) {
85
+ password: yup.string().required().test(function validateChangePasswordMaxLength(value) {
86
86
  if (!value) return true;
87
87
  const isValid = new TextEncoder().encode(value).length <= 72;
88
88
  if (!isValid) {
@@ -91,7 +91,7 @@ function requireAuth() {
91
91
  });
92
92
  }
93
93
  return true;
94
- }).test(async function(value) {
94
+ }).test(async function validateChangePassword(value) {
95
95
  if (typeof config?.validatePassword === 'function') {
96
96
  try {
97
97
  const isValid = await config.validatePassword(value);
@@ -1 +1 @@
1
- {"version":3,"file":"auth.mjs","sources":["../../../../server/controllers/validation/auth.js"],"sourcesContent":["'use strict';\n\nconst { yup, validateYupSchema } = require('@strapi/utils');\n\nconst callbackSchema = yup.object({\n identifier: yup.string().required(),\n password: yup.string().required(),\n});\n\nconst createRegisterSchema = (config) =>\n yup.object({\n email: yup.string().email().required(),\n username: yup.string().required(),\n password: yup\n .string()\n .required()\n .test(function (value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function (value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n });\n\nconst sendEmailConfirmationSchema = yup.object({\n email: yup.string().email().required(),\n});\n\nconst validateEmailConfirmationSchema = yup.object({\n confirmation: yup.string().required(),\n});\n\nconst forgotPasswordSchema = yup\n .object({\n email: yup.string().email().required(),\n })\n .noUnknown();\n\nconst createResetPasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function (value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function (value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n\n code: yup.string().required(),\n })\n .noUnknown();\n\nconst createChangePasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function (value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function (value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n currentPassword: yup.string().required(),\n })\n .noUnknown();\n\nmodule.exports = {\n validateCallbackBody: validateYupSchema(callbackSchema),\n validateRegisterBody: (payload, config) =>\n validateYupSchema(createRegisterSchema(config))(payload),\n validateSendEmailConfirmationBody: validateYupSchema(sendEmailConfirmationSchema),\n validateEmailConfirmationBody: validateYupSchema(validateEmailConfirmationSchema),\n validateForgotPasswordBody: validateYupSchema(forgotPasswordSchema),\n validateResetPasswordBody: (payload, config) =>\n validateYupSchema(createResetPasswordSchema(config))(payload),\n validateChangePasswordBody: (payload, config) =>\n validateYupSchema(createChangePasswordSchema(config))(payload),\n};\n"],"names":["yup","validateYupSchema","require$$0","callbackSchema","object","identifier","string","required","password","createRegisterSchema","config","email","username","test","value","isValid","TextEncoder","encode","length","createError","message","validatePassword","error","sendEmailConfirmationSchema","validateEmailConfirmationSchema","confirmation","forgotPasswordSchema","noUnknown","createResetPasswordSchema","passwordConfirmation","oneOf","ref","code","createChangePasswordSchema","currentPassword","auth","validateCallbackBody","validateRegisterBody","payload","validateSendEmailConfirmationBody","validateEmailConfirmationBody","validateForgotPasswordBody","validateResetPasswordBody","validateChangePasswordBody"],"mappings":";;;;;;;AAEA,IAAA,MAAM,EAAEA,GAAG,EAAEC,iBAAiB,EAAE,GAAGC,UAAAA;IAEnC,MAAMC,cAAAA,GAAiBH,GAAAA,CAAII,MAAM,CAAC;QAChCC,UAAAA,EAAYL,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ,EAAA;QACjCC,QAAAA,EAAUR,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ;AACjC,KAAA,CAAA;AAEA,IAAA,MAAME,oBAAAA,GAAuB,CAACC,MAAAA,GAC5BV,GAAAA,CAAII,MAAM,CAAC;AACTO,YAAAA,KAAAA,EAAOX,GAAAA,CAAIM,MAAM,EAAA,CAAGK,KAAK,GAAGJ,QAAQ,EAAA;YACpCK,QAAAA,EAAUZ,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ,EAAA;YAC/BC,QAAAA,EAAUR,GAAAA,CACPM,MAAM,EAAA,CACNC,QAAQ,GACRM,IAAI,CAAC,SAAUC,KAAK,EAAA;gBACnB,IAAI,CAACA,OAAO,OAAO,IAAA;AACnB,gBAAA,MAAMC,UAAU,IAAIC,WAAAA,EAAAA,CAAcC,MAAM,CAACH,KAAAA,CAAAA,CAAOI,MAAM,IAAI,EAAA;AAC1D,gB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A,CAAA;YAChCG,eAAAA,EAAiBlC,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ;AAC5C,SAAA,CAAA,CACKoB,SAAS,EAAA;IAEdQ,IAAAA,GAAiB;AACfC,QAAAA,oBAAAA,EAAsBnC,iBAAAA,CAAkBE,cAAAA,CAAAA;AACxCkC,QAAAA,oBAAAA,EAAsB,CAACC,OAAAA,EAAS5B,MAAAA,GAC9BT,iBAAAA,CAAkBQ,qBAAqBC,MAAAA,CAAAA,CAAAA,CAAS4B,OAAAA,CAAAA;AAClDC,QAAAA,iCAAAA,EAAmCtC,iBAAAA,CAAkBsB,2BAAAA,CAAAA;AACrDiB,QAAAA,6BAAAA,EAA+BvC,iBAAAA,CAAkBuB,+BAAAA,CAAAA;AACjDiB,QAAAA,0BAAAA,EAA4BxC,iBAAAA,CAAkByB,oBAAAA,CAAAA;AAC9CgB,QAAAA,yBAAAA,EAA2B,CAACJ,OAAAA,EAAS5B,MAAAA,GACnCT,iBAAAA,CAAkB2B,0BAA0BlB,MAAAA,CAAAA,CAAAA,CAAS4B,OAAAA,CAAAA;AACvDK,QAAAA,0BAAAA,EAA4B,CAACL,OAAAA,EAAS5B,MAAAA,GACpCT,iBAAAA,CAAkBgC,2BAA2BvB,MAAAA,CAAAA,CAAAA,CAAS4B,OAAAA;AAC1D,KAAA;;;;;;"}
1
+ {"version":3,"file":"auth.mjs","sources":["../../../../server/controllers/validation/auth.js"],"sourcesContent":["'use strict';\n\nconst { yup, validateYupSchema } = require('@strapi/utils');\n\nconst callbackSchema = yup.object({\n identifier: yup.string().required(),\n password: yup.string().required(),\n});\n\nconst createRegisterSchema = (config) =>\n yup.object({\n email: yup.string().email().required(),\n username: yup.string().required(),\n password: yup\n .string()\n .required()\n .test(function validateRegisterPasswordMaxLength(value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function validateRegisterPassword(value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n });\n\nconst sendEmailConfirmationSchema = yup.object({\n email: yup.string().email().required(),\n});\n\nconst validateEmailConfirmationSchema = yup.object({\n confirmation: yup.string().required(),\n});\n\nconst forgotPasswordSchema = yup\n .object({\n email: yup.string().email().required(),\n })\n .noUnknown();\n\nconst createResetPasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function validateResetPasswordMaxLength(value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function validateResetPassword(value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n\n code: yup.string().required(),\n })\n .noUnknown();\n\nconst createChangePasswordSchema = (config) =>\n yup\n .object({\n password: yup\n .string()\n .required()\n .test(function validateChangePasswordMaxLength(value) {\n if (!value) return true;\n const isValid = new TextEncoder().encode(value).length <= 72;\n if (!isValid) {\n return this.createError({ message: 'Password must be less than 73 bytes' });\n }\n return true;\n })\n .test(async function validateChangePassword(value) {\n if (typeof config?.validatePassword === 'function') {\n try {\n const isValid = await config.validatePassword(value);\n if (!isValid) {\n return this.createError({ message: 'Password validation failed.' });\n }\n } catch (error) {\n return this.createError({ message: error.message || 'An error occurred.' });\n }\n }\n return true;\n }),\n passwordConfirmation: yup\n .string()\n .required()\n .oneOf([yup.ref('password')], 'Passwords do not match'),\n currentPassword: yup.string().required(),\n })\n .noUnknown();\n\nmodule.exports = {\n validateCallbackBody: validateYupSchema(callbackSchema),\n validateRegisterBody: (payload, config) =>\n validateYupSchema(createRegisterSchema(config))(payload),\n validateSendEmailConfirmationBody: validateYupSchema(sendEmailConfirmationSchema),\n validateEmailConfirmationBody: validateYupSchema(validateEmailConfirmationSchema),\n validateForgotPasswordBody: validateYupSchema(forgotPasswordSchema),\n validateResetPasswordBody: (payload, config) =>\n validateYupSchema(createResetPasswordSchema(config))(payload),\n validateChangePasswordBody: (payload, config) =>\n validateYupSchema(createChangePasswordSchema(config))(payload),\n};\n"],"names":["yup","validateYupSchema","require$$0","callbackSchema","object","identifier","string","required","password","createRegisterSchema","config","email","username","test","validateRegisterPasswordMaxLength","value","isValid","TextEncoder","encode","length","createError","message","validateRegisterPassword","validatePassword","error","sendEmailConfirmationSchema","validateEmailConfirmationSchema","confirmation","forgotPasswordSchema","noUnknown","createResetPasswordSchema","validateResetPasswordMaxLength","validateResetPassword","passwordConfirmation","oneOf","ref","code","createChangePasswordSchema","validateChangePasswordMaxLength","validateChangePassword","currentPassword","auth","validateCallbackBody","validateRegisterBody","payload","validateSendEmailConfirmationBody","validateEmailConfirmationBody","validateForgotPasswordBody","validateResetPasswordBody","validateChangePasswordBody"],"mappings":";;;;;;;AAEA,IAAA,MAAM,EAAEA,GAAG,EAAEC,iBAAiB,EAAE,GAAGC,UAAAA;IAEnC,MAAMC,cAAAA,GAAiBH,GAAAA,CAAII,MAAM,CAAC;QAChCC,UAAAA,EAAYL,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ,EAAA;QACjCC,QAAAA,EAAUR,GAAAA,CAAIM,MAAM,EAAA,CAAGC,QAAQ;AACjC,KAAA,CAAA;AAEA,IAAA,MAAME,oBAAAA,GAAuB,CAACC,MAAAA,GAC5BV,GAAAA,CAAII,MAAM,CAAC;AACTO,YAAAA,KAAAA,EAAOX,GAAAA,CAAIM,MAAM,EAAA,CAAGK,KAAK,GAAGJ,QAAQ,EAAA;YACpCK,QAAAA,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AAAA;AAC1D,KAAA;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "5.50.0",
3
+ "version": "5.50.1",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@strapi/design-system": "2.2.1",
57
57
  "@strapi/icons": "2.2.1",
58
- "@strapi/utils": "5.50.0",
58
+ "@strapi/utils": "5.50.1",
59
59
  "bcryptjs": "2.4.3",
60
60
  "formik": "2.4.5",
61
61
  "grant": "5.4.24",
@@ -75,7 +75,7 @@
75
75
  "zod": "3.25.67"
76
76
  },
77
77
  "devDependencies": {
78
- "@strapi/strapi": "5.50.0",
78
+ "@strapi/strapi": "5.50.1",
79
79
  "@testing-library/dom": "10.4.1",
80
80
  "@testing-library/react": "16.3.2",
81
81
  "@testing-library/user-event": "14.6.1",
@@ -14,7 +14,7 @@ const createRegisterSchema = (config) =>
14
14
  password: yup
15
15
  .string()
16
16
  .required()
17
- .test(function (value) {
17
+ .test(function validateRegisterPasswordMaxLength(value) {
18
18
  if (!value) return true;
19
19
  const isValid = new TextEncoder().encode(value).length <= 72;
20
20
  if (!isValid) {
@@ -22,7 +22,7 @@ const createRegisterSchema = (config) =>
22
22
  }
23
23
  return true;
24
24
  })
25
- .test(async function (value) {
25
+ .test(async function validateRegisterPassword(value) {
26
26
  if (typeof config?.validatePassword === 'function') {
27
27
  try {
28
28
  const isValid = await config.validatePassword(value);
@@ -57,7 +57,7 @@ const createResetPasswordSchema = (config) =>
57
57
  password: yup
58
58
  .string()
59
59
  .required()
60
- .test(function (value) {
60
+ .test(function validateResetPasswordMaxLength(value) {
61
61
  if (!value) return true;
62
62
  const isValid = new TextEncoder().encode(value).length <= 72;
63
63
  if (!isValid) {
@@ -65,7 +65,7 @@ const createResetPasswordSchema = (config) =>
65
65
  }
66
66
  return true;
67
67
  })
68
- .test(async function (value) {
68
+ .test(async function validateResetPassword(value) {
69
69
  if (typeof config?.validatePassword === 'function') {
70
70
  try {
71
71
  const isValid = await config.validatePassword(value);
@@ -93,7 +93,7 @@ const createChangePasswordSchema = (config) =>
93
93
  password: yup
94
94
  .string()
95
95
  .required()
96
- .test(function (value) {
96
+ .test(function validateChangePasswordMaxLength(value) {
97
97
  if (!value) return true;
98
98
  const isValid = new TextEncoder().encode(value).length <= 72;
99
99
  if (!isValid) {
@@ -101,7 +101,7 @@ const createChangePasswordSchema = (config) =>
101
101
  }
102
102
  return true;
103
103
  })
104
- .test(async function (value) {
104
+ .test(async function validateChangePassword(value) {
105
105
  if (typeof config?.validatePassword === 'function') {
106
106
  try {
107
107
  const isValid = await config.validatePassword(value);