Unverified Commit 353359fc authored by Martin Cech's avatar Martin Cech Committed by GitHub
Browse files

Merge pull request #16271 from nuwang/forward_port_oidc_username_fix

[23.0] Forward port of slugify username received from oidc
parents bd6b2e83 6544f0d3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -380,6 +380,7 @@ class CustosAuthnz(IdentityProvider):
        username = userinfo.get("preferred_username", userinfo["email"])
        if "@" in username:
            username = username.split("@")[0]  # username created from username portion of email
        username = util.ready_name_for_url(username)
        if trans.sa_session.query(trans.app.model.User).filter_by(username=username).first():
            # if username already exists in database, append integer and iterate until unique username found
            count = 0