diff --git a/packages/authentication/src/providers/username-password.ts b/packages/authentication/src/providers/username-password.ts index 95c82fbcc61e7..c6428253dc311 100644 --- a/packages/authentication/src/providers/username-password.ts +++ b/packages/authentication/src/providers/username-password.ts @@ -24,14 +24,14 @@ class UsernamePasswordProvider extends AbstractAuthenticationModuleProvider { ): Promise { const { email, password } = userData.body - if (isString(password)) { + if (!password || !isString(password)) { return { success: false, error: "Password should be a string", } } - if (isString(email)) { + if (!email || !isString(email)) { return { success: false, error: "Email should be a string", diff --git a/packages/authentication/src/services/authentication-module.ts b/packages/authentication/src/services/authentication-module.ts index 30d50d74a510c..93365943b3788 100644 --- a/packages/authentication/src/services/authentication-module.ts +++ b/packages/authentication/src/services/authentication-module.ts @@ -48,10 +48,9 @@ export default class AuthenticationModuleService< } __hooks = { - onApplicationStart: this.createProvidersOnLoad, + onApplicationStart: async () => await this.createProvidersOnLoad(), } - protected __container__: MedusaContainer protected baseRepository_: DAL.RepositoryService