From 6f5908f047a13c85844394e5cf670d9e28c4f8e8 Mon Sep 17 00:00:00 2001 From: Mike Cifelli <26522946+macifell@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:07:35 -0500 Subject: [PATCH 1/2] Case insensitive email comparison --- lib/recognizer_web/controllers/helpers.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/recognizer_web/controllers/helpers.ex b/lib/recognizer_web/controllers/helpers.ex index df07993..06f8a06 100644 --- a/lib/recognizer_web/controllers/helpers.ex +++ b/lib/recognizer_web/controllers/helpers.ex @@ -8,7 +8,7 @@ defmodule RecognizerWeb.Controllers.Helpers do import Plug.Conn, only: [get_session: 2, assign: 3] def get_email_from_request(conn) do - conn.params["user"]["email"] + String.downcase(conn.params["user"]["email"] || "") end def get_user_id_from_request(conn) do From bea22cc56bf307eee862f47cc0fd85cd4b3951a3 Mon Sep 17 00:00:00 2001 From: Mike Cifelli <26522946+macifell@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:21:25 -0500 Subject: [PATCH 2/2] Handle whitespace --- lib/recognizer_web/controllers/helpers.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/recognizer_web/controllers/helpers.ex b/lib/recognizer_web/controllers/helpers.ex index 06f8a06..25ab131 100644 --- a/lib/recognizer_web/controllers/helpers.ex +++ b/lib/recognizer_web/controllers/helpers.ex @@ -8,7 +8,9 @@ defmodule RecognizerWeb.Controllers.Helpers do import Plug.Conn, only: [get_session: 2, assign: 3] def get_email_from_request(conn) do - String.downcase(conn.params["user"]["email"] || "") + (conn.params["user"]["email"] || "") + |> String.trim() + |> String.downcase() end def get_user_id_from_request(conn) do