-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,13 +315,7 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
|
||
defp create_new_magic_link_sender(igniter, sender, options) do | ||
with {igniter, [mailer]} <- Igniter.Libs.Swoosh.list_mailers(igniter) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
{_web_module_exists?, use_web_module, igniter} = create_use_web_module(igniter) | ||
|
||
Igniter.Project.Module.create_module( | ||
igniter, | ||
|
@@ -353,7 +347,7 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
new() | ||
|> from({"noreply", "[email protected]"}) # TODO: Replace with your email | ||
|> to(to_string(email)) | ||
|> subject("Your login link") | ||
|> subject("Your login kink") | ||
|> html_body(body([token: token, email: email])) | ||
|> #{List.last(Module.split(mailer))}.deliver!() | ||
end | ||
|
@@ -374,15 +368,9 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
end | ||
|
||
defp create_example_new_magic_link_sender(igniter, sender, options) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
{web_module_exists?, use_web_module, igniter} = create_use_web_module(igniter) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
|
||
example_domain = options[:user] |> Module.split() |> :lists.droplast() |> Module.concat() | ||
example_domain = example_domain(options[:user]) | ||
|
||
real_example = | ||
if web_module_exists? do | ||
|
@@ -430,13 +418,7 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
|
||
defp create_reset_sender(igniter, sender, options) do | ||
with {igniter, [mailer]} <- Igniter.Libs.Swoosh.list_mailers(igniter) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
{_web_module_exists?, use_web_module, igniter} = create_use_web_module(igniter) | ||
|
||
Igniter.Project.Module.create_module( | ||
igniter, | ||
|
@@ -479,15 +461,9 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
end | ||
|
||
defp create_example_reset_sender(igniter, sender, options) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
{web_module_exists?, use_web_module, igniter} = create_use_web_module(igniter) | ||
|
||
example_domain = options[:user] |> Module.split() |> :lists.droplast() |> Module.concat() | ||
example_domain = example_domain(options[:user]) | ||
|
||
real_example = | ||
if web_module_exists? do | ||
|
@@ -526,13 +502,7 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
|
||
defp create_new_user_confirmation_sender(igniter, sender, options) do | ||
with {igniter, [mailer]} <- Igniter.Libs.Swoosh.list_mailers(igniter) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
{_web_module_exists?, use_web_module, igniter} = create_use_web_module(igniter) | ||
|
||
Igniter.Project.Module.create_module( | ||
igniter, | ||
|
@@ -575,13 +545,7 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
end | ||
|
||
defp create_example_new_user_confirmation_sender(igniter, sender, options) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
{web_module_exists?, use_web_module, igniter} = create_use_web_module(igniter) | ||
|
||
example_domain = options[:user] |> Module.split() |> :lists.droplast() |> Module.concat() | ||
|
||
|
@@ -620,6 +584,22 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do | |
) | ||
end | ||
|
||
defp create_use_web_module(igniter) do | ||
web_module = Igniter.Libs.Phoenix.web_module(igniter) | ||
{web_module_exists?, igniter} = Igniter.Project.Module.module_exists(igniter, web_module) | ||
|
||
use_web_module = | ||
if web_module_exists? do | ||
"use #{inspect(web_module)}, :verified_routes" | ||
end | ||
|
||
{web_module_exists?, use_web_module, igniter} | ||
end | ||
|
||
defp example_domain(user) do | ||
user |> Module.split() |> :lists.droplast() |> Module.concat() | ||
end | ||
|
||
defp generate_sign_in_and_registration(igniter, options) do | ||
igniter | ||
|> Ash.Resource.Igniter.add_new_action(options[:user], :sign_in_with_password, """ | ||
|