Skip to content

Instantly share code, notes, and snippets.

@jredrejo
Created July 17, 2019 17:26
Show Gist options
  • Save jredrejo/c3e250f5e5f224ba02715be8c51b5b38 to your computer and use it in GitHub Desktop.
Save jredrejo/c3e250f5e5f224ba02715be8c51b5b38 to your computer and use it in GitHub Desktop.
un-women oidc email hack
diff --git a/kolibri/plugins/oidc_provider_plugin/__init__.py b/kolibri/plugins/oidc_provider_plugin/__init__.py
index 0276a6d09..2afa7693b 100644
--- a/kolibri/plugins/oidc_provider_plugin/__init__.py
+++ b/kolibri/plugins/oidc_provider_plugin/__init__.py
@@ -1,6 +1,13 @@
+import os
+
+
def kolibri_userinfo(claims, user):
"""
Fill claims with the information available in the Kolibri database
"""
+
claims["name"] = user.full_name
+ COUNTRY = os.environ.get("COUNTRY", None)
+ if COUNTRY:
+ claims["email"] = "{username}@{country}.org".format(username=user.username, country=COUNTRY)
return claims
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment