Restrict login to the platform for individual user

Is there a way to prevent someone from logging into the platform? We realize that you can set the Active state for the django.auth_user instance to disabled, however, when the user tries to login it notifies the user through email on how to activate their account. This is good for the learners who created an account and maybe forgot to continue use of the platform by clicking their activation email to verify that it’s their account.

How could we restrict login to the platform for anyone? I don’t want to have to get into unenrolling/re-enrolling them from the course but rather prevent them from logging in.


Take a look at edx-platform/ at 9e08c5e3d2d80d2da34240862aaa7193ea9fcbe4 · openedx/edx-platform · GitHub

Thanks @e0d. Is there a way to reactivate their account later?

We’re not interested in deleting/retiring the user account but rather preventing them from logging in for a given duration. Pause their login attempts and then when the time is right we can re-enable them to re-login.

@Zachary_Trabookis the support API might be useful for what you’re trying to do: edx-platform/ at master · openedx/edx-platform · GitHub

1 Like

@feanil The Support > Manage User does seem to do what we want. I ran the interface at https://edx-platform-lms/support/manage_user and clicked Disable Account. Then it immediately logged out the user. To allow the user to re-login later I just set their password.

Hey @Zachary_Trabookis,

If you are willing to develop some code for this there is a specific filter from the hooks framework for this.
It is called StudentLoginRequested and it is fired here.
You could create a plugin that implements the logic that you want and that raises StudentLoginRequested.PreventLogin when the user matches your criteria for cooling down the login.