During a normal sign-in, ABP checks whether the user's email has been confirmed and redirects them to the confirmation page if it hasn't. However, when a password change is required, the user is prompted to change their password first. After changing it, the user is signed in and can access the application without being asked to confirm their email. The confirmation check only takes place at the next sign-in.
Steps to reproduce
- Enable
Abp.Identity.SignIn.RequireConfirmedEmail. - Create a user with both Send confirmation email and Force password change enabled.
- Sign in as that user and change the password when prompted.
- Confirm that the user can access the application without having confirmed their email.
- Sign out and sign in again. The user is then prompted to confirm their email.
1 Answer(s)
-
0
Hi,
After a forced password change, the change password page signs the user in directly and skips the email confirmation check that the normal login does.
You can use this workaround for now. Add this class to your
AuthServerproject:using System.Threading.Tasks; using Volo.Abp.Account.Public.Web.Pages.Account; using Volo.Abp.DependencyInjection; using Volo.Abp.Identity; using Volo.Abp.Security.Claims; namespace YourProjectName.Pages.Account; [Dependency(ReplaceServices = true)] [ExposeServices(typeof(ChangePasswordModel))] public class MyChangePasswordModel : ChangePasswordModel { public MyChangePasswordModel(ICurrentPrincipalAccessor currentPrincipalAccessor) : base(currentPrincipalAccessor) { } protected override async Task<bool> ShouldRequireForcedTwoFactorConfirmationAsync(IdentityUser user) { return !await SignInManager.CanSignInAsync(user) || await base.ShouldRequireForcedTwoFactorConfirmationAsync(user); } }It checks the email confirmation before the user is signed in, so a user who hasn't confirmed their email is sent to the confirmation page after changing the password.
We'll fix this in the next patch release. Your ticket has been refunded.
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)