Compare commits

..

14 commits

2 changed files with 15 additions and 6 deletions

View file

@ -99,7 +99,7 @@ defmodule Mv.Accounts.User do
changeset changeset
|> Ash.Changeset.change_attribute(:email, user_info["preferred_username"]) |> 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 end
end end

View file

@ -16,18 +16,24 @@ defmodule MvWeb.UserLive.Form do
<%= if @user do %> <%= if @user do %>
<div class="mt-4 p-4 bg-blue-50 rounded-lg"> <div class="mt-4 p-4 bg-blue-50 rounded-lg">
<p class="text-sm text-blue-800"> <p class="text-sm text-blue-800">
<strong>{gettext("Note")}:</strong> {gettext("Password can only be changed through authentication functions.")} <strong>{gettext("Note")}:</strong> {gettext(
"Password can only be changed through authentication functions."
)}
</p> </p>
</div> </div>
<% else %> <% else %>
<div class="mt-4 p-4 bg-yellow-50 rounded-lg"> <div class="mt-4 p-4 bg-yellow-50 rounded-lg">
<p class="text-sm text-yellow-800"> <p class="text-sm text-yellow-800">
<strong>{gettext("Note")}:</strong> {gettext("Users created here will need to set their password through the authentication system.")} <strong>{gettext("Note")}:</strong> {gettext(
"Users created here will need to set their password through the authentication system."
)}
</p> </p>
</div> </div>
<% end %> <% end %>
<.button phx-disable-with={gettext("Saving...")} variant="primary">{gettext("Save User")}</.button> <.button phx-disable-with={gettext("Saving...")} variant="primary">
{gettext("Save User")}
</.button>
<.button navigate={return_path(@return_to, @user)}>{gettext("Cancel")}</.button> <.button navigate={return_path(@return_to, @user)}>{gettext("Cancel")}</.button>
</.form> </.form>
</Layouts.app> </Layouts.app>
@ -85,7 +91,10 @@ defmodule MvWeb.UserLive.Form do
if user do if user do
AshPhoenix.Form.for_update(user, :update_user, domain: Mv.Accounts, as: "user") AshPhoenix.Form.for_update(user, :update_user, domain: Mv.Accounts, as: "user")
else 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 end
assign(socket, form: to_form(form)) assign(socket, form: to_form(form))