From 3a08929b05a0a5a366eed3fe0cf39edf85f2f5bc Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sun, 26 Jan 2020 15:08:20 +0300 Subject: [PATCH] Print "email" JSON-value if it has a wrong type --- src/oauth2.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/oauth2.rs b/src/oauth2.rs index 2e80e5fdb..e7a7c8c53 100644 --- a/src/oauth2.rs +++ b/src/oauth2.rs @@ -314,7 +314,12 @@ impl Oauth2 { // CAVE: serde_json::Value.as_str() removes the quotes of json-strings // but serde_json::Value.to_string() does not! if let Some(addr) = response.get("email") { - addr.as_str().map(|s| s.to_string()) + if let Some(s) = addr.as_str() { + Some(s.to_string()) + } else { + warn!(context, "E-mail in userinfo is not a string: {}", addr); + None + } } else { warn!(context, "E-mail missing in userinfo."); None