ganahrhr 2 tahun lalu
induk
melakukan
14fe2fbc96
1 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 6 4
      Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs

+ 6 - 4
Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs

@@ -42,10 +42,12 @@ namespace HyperCube.Areas.Identity.Pages.Account
             var result = await _userManager.ConfirmEmailAsync(user, code);
             StatusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email.";
 
-            Console.WriteLine($"Adding new user [{user.UserName}], id: [{userId}] to list!");
-            ///adding new confirmed user
-            Models.AccountModel newAcc = new();
-            Models.AccountModel.Loaded.Add(userId, newAcc);
+            if (result.Succeeded)
+            {
+                Console.WriteLine($"Adding new confirmed user [{user.UserName}], id: [{userId}] to list!");
+                Models.AccountModel newAcc = new();
+                Models.AccountModel.Loaded.Add(userId, newAcc);
+            }
 
             return Page();            
         }