How to inactivate user to not allow them login on platform

Hi everyone,
Now , we want to inactivate user and not allow them login anymore,
I already uncheck Active checkbox in admin page but when user login again that will send email activation to user.
Does anyone know how to solve this ? Thanks.

Hello @huynk and welcome to the community!

AFAIK, there is not such a way to achieve this but if you want to achieve this then the source code to send reactivation email is here: https://github.com/edx/edx-platform/blob/open-release/juniper.master/openedx/core/djangoapps/user_authn/views/login.py#L181

You can do your customizations over here.

@jramnai, Thanks for your helping ! :slightly_smiling_face:

Hi @huynk - a very low-tech way to do this is to not only deactivate the learner, but give them an invalid email address and change their password to a random string.

That way they cannot log in, because as far as anyone’s concerned, their email address is no longer associated with an account on your system.

The issue with this is that they’ll still appear in your learner reports with the weird email addresses you set, and if you use bulk emailing, the email will obviously bounce. But as far as logins go, that’ll lock them out.

Oh, also a more comprehensive version is to log in as them and use the GDPR deletion feature to permanently delete their account, if you have it enabled. But that’s very final.

@MHaton, Thanks for your advice, that is a nice ideal :muscle: