How to suspend a user from login? #2168
-
I need to retain user informaiton and need to suspend user from login. So later require particular user can be changed to active status. How to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is no global toggle for this out of the box. If you use PocketBase as framework, you can disable the email login for a particular user using the app.OnRecordBeforeAuthWithPasswordRequest().Add(func(e *core.RecordAuthWithPasswordEvent) error {
if e.Record != nil && e.Record.Email() == "block@example.com" {
return apis.NewForbiddenError("You are not allowed to perform this action", nil)
}
return nil
}) If you want to disable also the OAuth2 logins for accounts with the specified email, you can make use of the more generic |
Beta Was this translation helpful? Give feedback.
There is no global toggle for this out of the box.
If you use PocketBase as framework, you can disable the email login for a particular user using the
OnRecordBeforeAuthWithPasswordRequest
and return an error (or define a global middleware to intercept the/api/collection/users/auth-with-password
call).If you want to disable also the OAuth2 logins for accounts with the specified email, you can make use of the more generic
OnRec…