-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement initial account settings flow
- Loading branch information
Toby Archer
committed
Aug 25, 2023
1 parent
05efa59
commit d9f764b
Showing
6 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
elixir-ory-network/lib/example_web/controllers/account_controller.ex
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule ExampleWeb.AccountController do | ||
use ExampleWeb, :controller | ||
|
||
import ExampleWeb.Helpers, only: [cookies: 1] | ||
|
||
alias Ory.Api.Frontend | ||
|
||
def settings(conn, %{"flow" => id}) do | ||
{:ok, %Ory.Model.LogoutFlow{logout_url: logout_url}} = | ||
Frontend.create_browser_logout_flow(Ory.Connection.new(), cookie: cookies(conn)) | ||
|
||
{:ok, settings_flow} = | ||
Frontend.get_settings_flow(Ory.Connection.new(), id, Cookie: cookies(conn)) | ||
|
||
IO.inspect(settings_flow) | ||
render(conn, :settings, flow: settings_flow, logout_url: logout_url) | ||
end | ||
|
||
def settings(conn, _params) do | ||
{:ok, %{url: url} = settings_flow} = | ||
Frontend.create_browser_settings_flow(Ory.Connection.new(), Cookie: cookies(conn)) | ||
|
||
redirect(conn, external: url) | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
elixir-ory-network/lib/example_web/controllers/account_html.ex
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
defmodule ExampleWeb.AccountHTML do | ||
use ExampleWeb, :html | ||
|
||
embed_templates "account_html/*" | ||
end |
13 changes: 13 additions & 0 deletions
13
elixir-ory-network/lib/example_web/controllers/account_html/settings.html.heex
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h2 class="font-semibold text-xl"> | ||
<%= gettext("Settings") %> | ||
</h2> | ||
|
||
<ExampleWeb.Flow.flow flow={@flow} /> | ||
|
||
<.button> | ||
<:inner_block> | ||
<.link navigate={@logout_url} class="text-white text-sm font-semibold leading-6"> | ||
<span>Log out</span> | ||
</.link> | ||
</:inner_block> | ||
</.button> |
1 change: 1 addition & 0 deletions
1
elixir-ory-network/lib/example_web/controllers/account_html/verification.html.heex
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
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
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