Commit f1ef0acc0b7f300b254024129ab070549a3d2cf7

Thomas de Grivel 2021-12-28T07:18:14

email security notifications

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/kmxgit/user_manager.ex b/lib/kmxgit/user_manager.ex
index e09de07..78e1e90 100644
--- a/lib/kmxgit/user_manager.ex
+++ b/lib/kmxgit/user_manager.ex
@@ -205,13 +205,13 @@ defmodule Kmxgit.UserManager do
   end
 
   def update_user(%User{} = user, attrs) do
-    old_login = user.login
+    old_login = user.slug.slug
     case user
          |> User.changeset(attrs)
          |> Repo.update() do
       {:ok, u} ->
-        if u.login != old_login do
-          UserNotifier.deliver_login_changed_email(u, old_login, u.login)
+        if u.slug.slug != old_login do
+          UserNotifier.deliver_login_changed_email(u, old_login, u.slug.slug)
         end
         {:ok, u}
       x -> x