Edit code in Frappe apps

I try to change some code in frappe to have more config for Social Login Key. But it looks like the new code is not loaded.

Do I have to run some bench command to reload code from apps folder to sites (because I can not find any suggestion about editing existed app)?

To be clearer:

  1. I added new field name restricted_domain by customizing form
  2. Edit file /apps/frappe/frappe/utils/oauth.py - function get_oauth2_providers
def get_oauth2_providers():
        out = {}
        providers = frappe.get_all("Social Login Key", fields=["*"])
        for provider in providers:
                authorize_url, access_token_url = provider.authorize_url, provider.access_token_url
                if provider.custom_base_url:
                        authorize_url = provider.base_url + provider.authorize_url
                        access_token_url = provider.base_url + provider.access_token_url
                out[provider.name] = {
                        "flow_params": {
                                "name": provider.name,
                                "authorize_url": authorize_url,
                                "access_token_url": access_token_url,
                                "base_url": provider.base_url,
                        },
                        "redirect_uri": provider.redirect_url,
                        "api_endpoint": provider.api_endpoint,
                }
                if provider.auth_url_data:
                        out[provider.name]["auth_url_data"] = json.loads(provider.auth_url_data)

                if provider.api_endpoint_args:
                        out[provider.name]["api_endpoint_args"] = json.loads(provider.api_endpoint_args)

+                if provider.restricted_domain:
+                       out[provider.name]["auth_url_data"]["hd"] = provider.restricted_domain
        return out

But it’s still not working. restricted_domain is stored in database already.

Any suggestions?

Running Production or Development ??

@sinnguyen Check this.

1 Like

Production env

bench restart make it work. I think there are some cache files that need to be refreshed.