Disable the button that allows the registration of any visitor

Hi guys!

I am learning to use the tutor, I already had many difficulties that I managed to solve seeing the posts on this forum or from other sources, but I have a problem that I have not yet been able to solve and I can’t even find a reference to adjust it.

I need that when new students access the tutor’s home page, they cannot register with the “Register” button, but that they can register when the course staff register the e-mail in a course

I saw in some forum that if I created a plugin, and modified the feature (“ALLOW_PUBLIC_ACCOUNT_CREATION”: false), I would disable the button.

The plugin:

name: desabilitar_acesso_estudante
version: 0.1.0
patches:
  common-env-features: |
    "ALLOW_PUBLIC_ACCOUNT_CREATION": false

With this plugin I was able to disable the “Register” button, but the student is unable to register with the tutor with the e-mail he receives, after the course team has registered his e-mail in the course. The registration form appears, but fails when trying to submit.

On the screen of the registration form there is no error, only the button is as if it were blocked. In the logs it reports a 403 permission error, as shown below:

lms_1            | 172.18.0.1 - - [20/Apr/2021:20:58:29 +0000] "POST /api/user/v1/validation/registration HTTP/1.0" 200 75 "https://lms.valdirverona.mus.br/register?utm_content=8045c8b5-4711-4c3d-83d9-e33d7a29c760&utm_medium=email&utm_campaign=allowedenroll&utm_source=instructor" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"
lms_1            | 172.18.0.1 - - [20/Apr/2021:20:58:29 +0000] "POST /api/user/v1/validation/registration HTTP/1.0" 200 75 "https://lms.valdirverona.mus.br/register?utm_content=8045c8b5-4711-4c3d-83d9-e33d7a29c760&utm_medium=email&utm_campaign=allowedenroll&utm_source=instructor" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"
lms_1            | 2021-04-20 20:58:29,991 INFO 90 [tracking] [user None] logger.py:49 - {"event": "{\"POST\": {\"mailing_address\": [\"street - house\"], \"goals\": [\"music\"], \"honor_code\": [\"true\"], \"name\": [\"Learner Test Example\"], \"password\": \"********\", \"level_of_education\": [\"hs\"], \"gender\": [\"m\"], \"email\": [\"lahen32973@tripaco.com\"], \"year_of_birth\": [\"2003\"], \"username\": [\"learner_test_example\"]}, \"GET\": {}}", "event_source": "server", "accept_language": "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3", "referer": "https://lms.valdirverona.mus.br/register?utm_content=8045c8b5-4711-4c3d-83d9-e33d7a29c760&utm_medium=email&utm_campaign=allowedenroll&utm_source=instructor", "event_type": "/user_api/v1/account/registration/", "ip": "177.23.212.72", "page": null, "context": {"path": "/user_api/v1/account/registration/", "user_id": null, "course_id": "", "org_id": ""}, "time": "2021-04-20T20:58:29.991182+00:00", "username": "", "agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0", "host": "lms.valdirverona.mus.br"}
lms_1            | 172.18.0.1 - - [20/Apr/2021:20:58:30 +0000] "POST /user_api/v1/account/registration/ HTTP/1.0" 403 29 "https://lms.valdirverona.mus.br/register?utm_content=8045c8b5-4711-4c3d-83d9-e33d7a29c760&utm_medium=email&utm_campaign=allowedenroll&utm_source=instructor" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"

So I had to disable this plugin to make the student registration work, but the “Register” button appears again on the home page.

I would like to know what would be the best way to disable/hide the Register button. Or some way that students do not have access to the creation of their enrollment, that is only by invitation in the email.

The tutor version is 10.4.0, and the theme is indigo.

I am grateful for any help or reference for this case.

Thank you guys!

@FelipeRMG You could look into using a custom theme to override the navbar-not-authenticated.html template. I believe this is where that Register button would be found.

1 Like

I think you are mistaking two different things:

  1. Subscribing to the platform: also know as “account creation”, means signing up to the platform, defining a password and email, etc.
  2. Registering to a course: a user who has already subscribed to the platform can register to a course.

Setting FEATURES["ALLOW_PUBLIC_ACCOUNT_CREATION"] = False means preventing users from doing #1. When you say “the course team has registered his e-mail in the course” it means that they have done #2 – but not #1, which #2 depends on. Thus, what you need to do is to actually create a user account. Since this feature is disabled from the frontend, you must do so from the command line interface. For that, you can use the tutor local createuser command: Local deployment — Tutor documentation (omit the --staff/--superuser options).

Thanks @ToddLichty your comment helped a lot in my solution of my problem, I was really able to disable/hide the “Register” button in the way it showed.
But a "/openedx/edx-platform/openedx/core/djangoapps/user_authn/views/register.py" file had to be changed so that the account creation form for any visitor entering the environment is deactivated, even if had access to the form.
So only users who are registered in any course can create an account.

Thank you @regis . I wanted the student to create the account only if the course team enrolled in some course. So, I disabled the plugin, so that the solution would work, since the FEATURES ["ALLOW_PUBLIC_ACCOUNT_CREATION"] attribute should be True,

Thank you all