-
Notifications
You must be signed in to change notification settings - Fork 0
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
12 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
registrations/lib/registrations/user_identities/user_identity.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,12 @@ | ||
defmodule Registrations.UserIdentities.UserIdentity do | ||
use Ecto.Schema | ||
use PowAssent.Ecto.UserIdentities.Schema, user: RegistrationsWeb.User | ||
|
||
@primary_key {:id, :binary_id, autogenerate: true} | ||
@foreign_key_type :binary_id | ||
schema "user_identities" do | ||
pow_assent_user_identity_fields() | ||
|
||
timestamps() | ||
end | ||
end |
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
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
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
18 changes: 18 additions & 0 deletions
18
registrations/lib/registrations_web/templates/pow_assent/registration/add_user_id.html.eex
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,18 @@ | ||
<h2>Register</h2> | ||
|
||
<%= form_for @changeset, @action, [as: :user], fn f -> %> | ||
<%= if @changeset.action do %> | ||
<div class="alert alert-danger"> | ||
<p>Oops, something went wrong! Please check the errors below.</p> | ||
</div> | ||
<% end %> | ||
|
||
<%= label f, Pow.Ecto.Schema.user_id_field(@changeset) %> | ||
<%= text_input f, Pow.Ecto.Schema.user_id_field(@changeset) %> | ||
<%= error_tag f, Pow.Ecto.Schema.user_id_field(@changeset) %> | ||
|
||
<div> | ||
<%= submit "Submit" %> | ||
</div> | ||
<% end %> | ||
|
3 changes: 3 additions & 0 deletions
3
registrations/lib/registrations_web/views/pow_assent/registration_view.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,3 @@ | ||
defmodule RegistrationsWeb.PowAssent.RegistrationView do | ||
use RegistrationsWeb, :view | ||
end |
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
16 changes: 16 additions & 0 deletions
16
registrations/priv/repo/migrations/20240721040506_create_user_identities.exs
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,16 @@ | ||
defmodule Registrations.Repo.Migrations.CreateUserIdentities do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:user_identities, primary_key: false) do | ||
add :id, :binary_id, primary_key: true | ||
add :provider, :string, null: false | ||
add :uid, :string, null: false | ||
add :user_id, references("users", on_delete: :nothing, type: :binary_id) | ||
|
||
timestamps() | ||
end | ||
|
||
create unique_index(:user_identities, [:uid, :provider]) | ||
end | ||
end |