Fix Azure AD login when password reset is disabled in web.config #117
+4
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Users were unable to log in via Azure AD when the
enablePasswordReset="false"setting was configured in the web.config file. After the user successfully authenticated with Azure credentials, they would be redirected to the Login page with a verification message instead of being logged in.Root Cause
The Azure AD provider was attempting to reset the user's password during the login process (to prevent password expiration issues), but this operation would fail when password resets were disabled in the site configuration. This failure was causing the entire authentication flow to abort.
Solution
Added a try-catch block around the password reset operation in the
UpdateUserAndRolesmethod to gracefully handle the situation when password resets are disabled:This change allows the authentication flow to continue even when password reset is disabled, making the Azure AD login process compatible with all DNN configurations.
Fixes #113.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.