Explorar o código

fix(core): Fix email verification for already-verified accounts (#1304)

Fixes #1303
Harun Kilic %!s(int64=4) %!d(string=hai) anos
pai
achega
2f17b9a1fd
Modificáronse 1 ficheiros con 2 adicións e 4 borrados
  1. 2 4
      packages/core/src/service/services/customer.service.ts

+ 2 - 4
packages/core/src/service/services/customer.service.ts

@@ -424,11 +424,9 @@ export class CustomerService {
      */
      */
     async refreshVerificationToken(ctx: RequestContext, emailAddress: string): Promise<void> {
     async refreshVerificationToken(ctx: RequestContext, emailAddress: string): Promise<void> {
         const user = await this.userService.getUserByEmailAddress(ctx, emailAddress);
         const user = await this.userService.getUserByEmailAddress(ctx, emailAddress);
-        if (user) {
+        if (user && !user.verified) {
             await this.userService.setVerificationToken(ctx, user);
             await this.userService.setVerificationToken(ctx, user);
-            if (!user.verified) {
-                this.eventBus.publish(new AccountRegistrationEvent(ctx, user));
-            }
+            this.eventBus.publish(new AccountRegistrationEvent(ctx, user));
         }
         }
     }
     }