Skip to content

Commit

Permalink
correct handling of gender and year of birth
Browse files Browse the repository at this point in the history
  • Loading branch information
jredrejo committed Mar 4, 2020
1 parent 83ffc48 commit 6ff736b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kolibri_oidc_client_plugin/auth.py
Expand Up @@ -76,8 +76,11 @@ def create_user(self, claims):
email = claims.get("email", username)
# Kolibri doesn't allow an empty password. This isn't going to be used:
password = uuid4().hex
birthdate = claims.get("birthdate", "NOT_SPECIFIED")
gender = claims.get("gender", "NOT_SPECIFIED")
# birthdate format is [ISO8601‑2004] YYYY-MM-DD
birthdate = (
claims.get("birthdate")[:4] if "birthdate" in claims else "NOT_SPECIFIED"
)
gender = claims.get("gender", "NOT_SPECIFIED").upper()
user = self.UserModel.objects.create_user(
username,
email=email,
Expand Down

0 comments on commit 6ff736b

Please sign in to comment.