format: formated files

This commit is contained in:
carla 2025-06-26 14:00:43 +02:00
parent aecd564f7b
commit b1f5e09eaf
5 changed files with 31 additions and 12 deletions

View file

@ -24,7 +24,8 @@ defmodule Mv.Accounts.User do
token_resource Mv.Accounts.Token
require_token_presence_for_authentication? true
store_all_tokens? true
#signing_algorithm "EdDSA" -> https://git.local-it.org/local-it/mitgliederverwaltung/issues/87
# signing_algorithm "EdDSA" -> https://git.local-it.org/local-it/mitgliederverwaltung/issues/87
signing_secret fn _, _ ->
{:ok, Application.get_env(:mv, :token_signing_secret)}
@ -39,7 +40,8 @@ defmodule Mv.Accounts.User do
client_secret Mv.Secrets
auth_method :client_secret_jwt
code_verifier true
#id_token_signed_response_alg "EdDSA" #-> https://git.local-it.org/local-it/mitgliederverwaltung/issues/87
# id_token_signed_response_alg "EdDSA" #-> https://git.local-it.org/local-it/mitgliederverwaltung/issues/87
end
password :password do

View file

@ -77,25 +77,21 @@ defmodule Mv.Membership.Member do
where: [present(:join_date)],
message: "cannot be in the future"
# Exit date not before join date
validate compare(:exit_date, greater_than: :join_date),
where: [present([:join_date, :exit_date])],
message: "cannot be before join date"
# Phone number format (only if set)
validate match(:phone_number, ~r/^\+?[0-9\- ]{6,20}$/),
where: [present(:phone_number)],
message: "is not a valid phone number"
# Postal code format (only if set)
validate match(:postal_code, ~r/^\d{5}$/),
where: [present(:postal_code)],
message: "must consist of 5 digits"
# Email validation with EctoCommons.EmailValidator
validate fn changeset, _ ->
email = Ash.Changeset.get_attribute(changeset, :email)

View file

@ -1,19 +1,39 @@
defmodule Mv.Secrets do
use AshAuthentication.Secret
def secret_for([:authentication, :strategies, :rauthy, :client_id], Mv.Accounts.User, _opts, _meth) do
def secret_for(
[:authentication, :strategies, :rauthy, :client_id],
Mv.Accounts.User,
_opts,
_meth
) do
get_config(:client_id)
end
def secret_for([:authentication, :strategies, :rauthy, :redirect_uri], Mv.Accounts.User, _opts, _meth) do
def secret_for(
[:authentication, :strategies, :rauthy, :redirect_uri],
Mv.Accounts.User,
_opts,
_meth
) do
get_config(:redirect_uri)
end
def secret_for([:authentication, :strategies, :rauthy, :client_secret], Mv.Accounts.User, _opts, _meth) do
def secret_for(
[:authentication, :strategies, :rauthy, :client_secret],
Mv.Accounts.User,
_opts,
_meth
) do
get_config(:client_secret)
end
def secret_for([:authentication, :strategies, :rauthy, :base_url], Mv.Accounts.User, _opts, _meth) do
def secret_for(
[:authentication, :strategies, :rauthy, :base_url],
Mv.Accounts.User,
_opts,
_meth
) do
get_config(:base_url)
end

View file

@ -1,4 +1,5 @@
require Logger
defmodule MvWeb.AuthController do
use MvWeb, :controller
use AshAuthentication.Phoenix.Controller
@ -24,6 +25,7 @@ defmodule MvWeb.AuthController do
def failure(conn, activity, reason) do
Logger.error(%{conn: conn, reason: reason})
message =
case {activity, reason} do
{_,

View file

@ -68,7 +68,6 @@ defmodule MvWeb.Router do
live "/properties/:id/show/edit", PropertyLive.Show, :edit
post "/set_locale", LocaleController, :set_locale
end
# ASHAUTHENTICATION GENERATED AUTH ROUTES