diff --git a/lib/accounts/user.ex b/lib/accounts/user.ex index 2f4844a..53156b4 100644 --- a/lib/accounts/user.ex +++ b/lib/accounts/user.ex @@ -99,7 +99,7 @@ defmodule Mv.Accounts.User do changeset |> Ash.Changeset.change_attribute(:email, user_info["preferred_username"]) - |> Ash.Changeset.change_attribute(:oidc_id, user_info["id"]) + |> Ash.Changeset.change_attribute(:oidc_id, user_info["sub"] || user_info["id"]) end end end diff --git a/lib/mv_web/live/user_live/form.ex b/lib/mv_web/live/user_live/form.ex index 08bd2d0..dd78c0c 100644 --- a/lib/mv_web/live/user_live/form.ex +++ b/lib/mv_web/live/user_live/form.ex @@ -12,22 +12,28 @@ defmodule MvWeb.UserLive.Form do <.form for={@form} id="user-form" phx-change="validate" phx-submit="save"> <.input field={@form[:email]} label={gettext("Email")} required type="email" /> - + <%= if @user do %>

- {gettext("Note")}: {gettext("Password can only be changed through authentication functions.")} + {gettext("Note")}: {gettext( + "Password can only be changed through authentication functions." + )}

<% else %>

- {gettext("Note")}: {gettext("Users created here will need to set their password through the authentication system.")} + {gettext("Note")}: {gettext( + "Users created here will need to set their password through the authentication system." + )}

<% end %> - <.button phx-disable-with={gettext("Saving...")} variant="primary">{gettext("Save User")} + <.button phx-disable-with={gettext("Saving...")} variant="primary"> + {gettext("Save User")} + <.button navigate={return_path(@return_to, @user)}>{gettext("Cancel")} @@ -85,7 +91,10 @@ defmodule MvWeb.UserLive.Form do if user do AshPhoenix.Form.for_update(user, :update_user, domain: Mv.Accounts, as: "user") else - AshPhoenix.Form.for_create(Mv.Accounts.User, :create_user, domain: Mv.Accounts, as: "user") + AshPhoenix.Form.for_create(Mv.Accounts.User, :create_user, + domain: Mv.Accounts, + as: "user" + ) end assign(socket, form: to_form(form))