- Steps to reproduce the issue:
- Login with admin
- Go to Settings ->Account -> External providers enable google provider
- Passive a user that you can log in with an external provider(google) and try to log in with that user via Google.
I activated the Google external provider in one of my projects. If the user logs in with a local login when isActive=false
, the warning "You are not allowed to log in! Your account is inactive or needs to confirm your email/phone number
" is given. If the same user logs in with Google, they stay on the login page but the same warning message should come but it does not.
8 Answer(s)
-
0
To ensure that the same warning message ("You are not allowed to log in! Your account is inactive or needs to confirm your email/phone number") appears for both local and external (Google) logins when a user is inactive, you need to implement user status validation in the external login flow as well.
In ABP, the local login typically checks user status in the
LoginModel
. For external providers, you should override the external login callback to perform the same validation. Here’s how you can do it:Override the External Login Callback
In yourLoginModel
(or equivalent for external login), override the method that handles the external login callback. After retrieving the user from the external provider, check theIsActive
property (or your custom status logic).public override async Task<IActionResult> OnGetExternalLoginCallbackAsync(string remoteError = null) { // ... existing code to get externalLoginInfo and user var user = await UserManager.FindByLoginAsync(externalLoginInfo.LoginProvider, externalLoginInfo.ProviderKey); if (user != null && !user.IsActive) { Alerts.Danger("You are not allowed to log in! Your account is inactive or needs to confirm your email/phone number"); return Page(); } // ... continue with the normal flow }
Angular UI Handling
Make sure your Angular UI displays the error message returned from the backend. The ABP Angular template typically shows backend validation errors as toasts or inline messages.Consistent Validation
Ensure that both local and external login flows use the same validation logic for user status. This avoids discrepancies in user experience.Customizing the Error Message
If you want to customize the error message or localization, use theAlerts.Danger
method or equivalent in your overridden method.
This approach ensures that inactive users receive the same warning regardless of the login method.
Sources:
- ABP Support: Handling errors in external login flows
- ABP Community: Azure AD and external login integration
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
Hi, I think this is a bug, so it would be better if you solve this issue.
-
0
I activated the Google external provider in one of my projects. If the user logs in with a local login when isActive=false, the warning "You are not allowed to log in! Your account is inactive or needs to confirm your email/phone number" is given. If the same user logs in with Google, they stay on the login page but the same warning message should come but it does not.
Hi, thanks for the update. Just to clarify, although there's no warning message, are you successfully logged in? Or is the issue purely visual, where the login works as expected but the UI doesn't reflect it (i.e., no success or warning messages displayed)?
Could you please confirm whether the problem is related only to the UI feedback or if the authentication itself is not functioning?
-
0
Hi Engincan, It did not allow login (this is expected behavior) only this warning message did not come. (MVC UI- Authorization Code Flow)
-
0
[ademaygun] said: Hi Engincan, It did not allow login (this is expected behavior) only this warning message did not come. (MVC UI- Authorization Code Flow)
Okay, thanks for the clarification. I'll check this and write you back.
-
1
Update: I'm able to reproduce this problem and created an internal issue (#20272).
-
1
Hi Ademaygun,
Thank you for your recent valuable feedback. I will open a separate issue to track this(#20294). We will proceed with using the suggested logos for Google and other popular options.
Closing this issue now. Feel free to re-open it or create a new one if you have further questions.