{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc/issues/6","repository_url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc","labels_url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc/issues/6/comments","events_url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc/issues/6/events","html_url":"https://github.com/Microsoft/moodle-auth_oidc/issues/6","id":119112235,"number":6,"title":"problems with case sensitivity on login/account creation with azure","user":{"login":"BenKelada","id":230730,"avatar_url":"https://avatars.githubusercontent.com/u/230730?v=3","gravatar_id":"","url":"https://api.github.com/users/BenKelada","html_url":"https://github.com/BenKelada","followers_url":"https://api.github.com/users/BenKelada/followers","following_url":"https://api.github.com/users/BenKelada/following{/other_user}","gists_url":"https://api.github.com/users/BenKelada/gists{/gist_id}","starred_url":"https://api.github.com/users/BenKelada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenKelada/subscriptions","organizations_url":"https://api.github.com/users/BenKelada/orgs","repos_url":"https://api.github.com/users/BenKelada/repos","events_url":"https://api.github.com/users/BenKelada/events{/privacy}","received_events_url":"https://api.github.com/users/BenKelada/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-26T23:58:47Z","updated_at":"2016-02-04T00:13:43Z","closed_at":null,"body":"Moodle lower cases usernames  when creating accounts\r\nwhen using a postgres database comparisons/collations are cases sensitive (they are case insensitive on mysql / mssql by default )\r\nthis means that when using this plugin with an azure account with uppercase characters in the username user account creation works but logins failed\r\nthis change fixes it:\r\n```\r\n--- moodle/auth/oidc/classes/loginflow/authcode.php\t(date 1448580884000)\r\n+++ moodle/auth/oidc/classes/loginflow/authcode.php\t(revision )\r\n@@ -289,8 +289,9 @@\r\n             // Use 'upn' if available for username (Azure-specific), or fall back to lower-case oidcuniqid.\r\n             $username = $idtoken->claim('upn');\r\n             if (empty($username)) {\r\n-                $username = strtolower($oidcuniqid);\r\n+                $username = $oidcuniqid;\r\n             }\r\n+            $username = strtolower($username);\r\n             $tokenrec = $this->createtoken($oidcuniqid, $username, $authparams, $tokenparams, $idtoken);\r\n         }\r\n ```\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc/issues/comments/179545334","html_url":"https://github.com/Microsoft/moodle-auth_oidc/issues/6#issuecomment-179545334","issue_url":"https://api.github.com/repos/Microsoft/moodle-auth_oidc/issues/6","id":179545334,"user":{"login":"BenKelada","id":230730,"avatar_url":"https://avatars.githubusercontent.com/u/230730?v=3","gravatar_id":"","url":"https://api.github.com/users/BenKelada","html_url":"https://github.com/BenKelada","followers_url":"https://api.github.com/users/BenKelada/followers","following_url":"https://api.github.com/users/BenKelada/following{/other_user}","gists_url":"https://api.github.com/users/BenKelada/gists{/gist_id}","starred_url":"https://api.github.com/users/BenKelada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenKelada/subscriptions","organizations_url":"https://api.github.com/users/BenKelada/orgs","repos_url":"https://api.github.com/users/BenKelada/repos","events_url":"https://api.github.com/users/BenKelada/events{/privacy}","received_events_url":"https://api.github.com/users/BenKelada/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T00:13:43Z","updated_at":"2016-02-04T00:13:43Z","body":"No worries thanks james"}}