format: formated files
This commit is contained in:
parent
aecd564f7b
commit
b1f5e09eaf
5 changed files with 31 additions and 12 deletions
|
|
@ -24,7 +24,8 @@ defmodule Mv.Accounts.User do
|
||||||
token_resource Mv.Accounts.Token
|
token_resource Mv.Accounts.Token
|
||||||
require_token_presence_for_authentication? true
|
require_token_presence_for_authentication? true
|
||||||
store_all_tokens? 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 _, _ ->
|
signing_secret fn _, _ ->
|
||||||
{:ok, Application.get_env(:mv, :token_signing_secret)}
|
{:ok, Application.get_env(:mv, :token_signing_secret)}
|
||||||
|
|
@ -39,7 +40,8 @@ defmodule Mv.Accounts.User do
|
||||||
client_secret Mv.Secrets
|
client_secret Mv.Secrets
|
||||||
auth_method :client_secret_jwt
|
auth_method :client_secret_jwt
|
||||||
code_verifier true
|
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
|
end
|
||||||
|
|
||||||
password :password do
|
password :password do
|
||||||
|
|
|
||||||
|
|
@ -77,25 +77,21 @@ defmodule Mv.Membership.Member do
|
||||||
where: [present(:join_date)],
|
where: [present(:join_date)],
|
||||||
message: "cannot be in the future"
|
message: "cannot be in the future"
|
||||||
|
|
||||||
|
|
||||||
# Exit date not before join date
|
# Exit date not before join date
|
||||||
validate compare(:exit_date, greater_than: :join_date),
|
validate compare(:exit_date, greater_than: :join_date),
|
||||||
where: [present([:join_date, :exit_date])],
|
where: [present([:join_date, :exit_date])],
|
||||||
message: "cannot be before join date"
|
message: "cannot be before join date"
|
||||||
|
|
||||||
|
|
||||||
# Phone number format (only if set)
|
# Phone number format (only if set)
|
||||||
validate match(:phone_number, ~r/^\+?[0-9\- ]{6,20}$/),
|
validate match(:phone_number, ~r/^\+?[0-9\- ]{6,20}$/),
|
||||||
where: [present(:phone_number)],
|
where: [present(:phone_number)],
|
||||||
message: "is not a valid phone number"
|
message: "is not a valid phone number"
|
||||||
|
|
||||||
|
|
||||||
# Postal code format (only if set)
|
# Postal code format (only if set)
|
||||||
validate match(:postal_code, ~r/^\d{5}$/),
|
validate match(:postal_code, ~r/^\d{5}$/),
|
||||||
where: [present(:postal_code)],
|
where: [present(:postal_code)],
|
||||||
message: "must consist of 5 digits"
|
message: "must consist of 5 digits"
|
||||||
|
|
||||||
|
|
||||||
# Email validation with EctoCommons.EmailValidator
|
# Email validation with EctoCommons.EmailValidator
|
||||||
validate fn changeset, _ ->
|
validate fn changeset, _ ->
|
||||||
email = Ash.Changeset.get_attribute(changeset, :email)
|
email = Ash.Changeset.get_attribute(changeset, :email)
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,39 @@
|
||||||
defmodule Mv.Secrets do
|
defmodule Mv.Secrets do
|
||||||
use AshAuthentication.Secret
|
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)
|
get_config(:client_id)
|
||||||
end
|
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)
|
get_config(:redirect_uri)
|
||||||
end
|
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)
|
get_config(:client_secret)
|
||||||
end
|
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)
|
get_config(:base_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
defmodule MvWeb.AuthController do
|
defmodule MvWeb.AuthController do
|
||||||
use MvWeb, :controller
|
use MvWeb, :controller
|
||||||
use AshAuthentication.Phoenix.Controller
|
use AshAuthentication.Phoenix.Controller
|
||||||
|
|
@ -24,6 +25,7 @@ defmodule MvWeb.AuthController do
|
||||||
|
|
||||||
def failure(conn, activity, reason) do
|
def failure(conn, activity, reason) do
|
||||||
Logger.error(%{conn: conn, reason: reason})
|
Logger.error(%{conn: conn, reason: reason})
|
||||||
|
|
||||||
message =
|
message =
|
||||||
case {activity, reason} do
|
case {activity, reason} do
|
||||||
{_,
|
{_,
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,7 @@ defmodule MvWeb.Router do
|
||||||
live "/properties/:id", PropertyLive.Show, :show
|
live "/properties/:id", PropertyLive.Show, :show
|
||||||
live "/properties/:id/show/edit", PropertyLive.Show, :edit
|
live "/properties/:id/show/edit", PropertyLive.Show, :edit
|
||||||
|
|
||||||
post "/set_locale", LocaleController, :set_locale
|
post "/set_locale", LocaleController, :set_locale
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# ASHAUTHENTICATION GENERATED AUTH ROUTES
|
# ASHAUTHENTICATION GENERATED AUTH ROUTES
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue