Disable the public login option and enable google auth

So i have done the following setup :

  1. Koa.master setup
  2. Google Oauth Setup (Working)
  3. Hinted Signing enabled

I want to disable public registration form and allow login/registration through Google only.
But Now when i go to login page and click on “Show Me other ways to sign in” and then click to “Create an Account” i can see the normal registration page (HOW TO DISABLE THIS).

ALSO after clicking on “Show Me other ways to sign in” it takes me to normal signin page and if i refresh the page it goes back to hinted sign in page

How to Hide/Disable normal registration pages completely

Configurations (/admin/third_party_auth/oauth2providerconfig)

Skip hinted login dialog ( :x:)
Skip registration form ( :x:)
Skip email verification( :x:)
Send welcome email( :white_check_mark:)
Visible( :white_check_mark:)
Send to registration first( :white_check_mark:)
Sync learner profile data( :white_check_mark:)
Enable sso id verification( :white_check_mark:)

Configurations (LMS.yml)

Features :
AUTH_USE_OPENID_PROVIDER: true
ENABLE_COMBINED_LOGIN_REGISTRATION: true
THIRD_PARTY_AUTH_HINT: oa2-google-oauth2
ENABLE_THIRD_PARTY_AUTH: true

How to disable public registration page from both login and registration url ?

In the past, the way I’ve done this is via a custom theme, by overriding the register and login underscore templates.

But now that I look at them, I can see that the behavior you want can be controlled via the ALLOW_PUBLIC_ACCOUNT_CREATION feature flag. Does that help?

We have the same requirement at MIT Open Learning for some of our installations and, unfortunately, couldn’t find a simple way to do this.

We ended up locking out public login/registration with username/password with a combination of:

Peter Pinch
MIT Open Learning
he/him/his

2 Likes

@arbrandes I cannot set ALLOW_PUBLIC_ACCOUNT_CREATION = True as after Google login it needs few registration steps to create a account and link google account to edx but this flag completely remove registration pages and google login fails

@pdpinch I doubt I will be allowed to use a custom templates and huge code base change at this point of time but thanks for this input

@vicmathur91 Couple of ideas:

  1. Check that your OAuth Provider Configuration is “Enabled ( :white_check_mark: )” as well as “Visible ( :white_check_mark: )”
    It probably is, but worth verifying.

  2. THIRD_PARTY_AUTH_HINT must match the provider_id, which is composed of the OAuth2 prefix oa2- and the “Provider slug” set on /admin/third_party_auth/oauth2providerconfig.

    If your slug is google-oauth2, then the setting you used above should work, but if not, then it needs to be changed.

    THIRD_PARTY_AUTH_HINT: oa2-google-oauth2

  3. All the sites we manage that use the THIRD_PARTY_AUTH_HINT use the Site Configuration in Django Admin to set this value, not the settings.FEATURES.
    From the code, there’s no good reason why this would be, but I’m noting it anyway.

    (It takes 3 minutes for site configuration changes made in Django Admin to register because of caching.)