Skip to content

Commit

Permalink
Add BGG username to users
Browse files Browse the repository at this point in the history
Issue #70
  • Loading branch information
Chris Rees committed Mar 11, 2018
1 parent 8914084 commit 83593f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Nermesterts.Repo.Migrations.AddBggUsernameToUsers do
use Ecto.Migration

def change do
alter table(:users) do
add :bgg_username, :string
end
end
end
3 changes: 2 additions & 1 deletion web/models/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Nermesterts.User do
alias Nermesterts.User

@required_fields ~w(username)a
@optional_fields ~w(active admin guest name password password_confirmation)a
@optional_fields ~w(active admin bgg_username guest name password password_confirmation)a
@all_fields @required_fields ++ @optional_fields

@required_registration_fields ~w(username password password_confirmation)a
Expand All @@ -14,6 +14,7 @@ defmodule Nermesterts.User do

schema "users" do
field :username, :string
field :bgg_username, :string
field :crypted_password, :string
field :password, :string, virtual: true
field :password_confirmation, :string, virtual: true
Expand Down
6 changes: 6 additions & 0 deletions web/templates/user/form.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
<%= error_tag f, :name %>
</div>

<div class="form-group">
<%= label f, :bgg_username, "BGG Username", class: "control-label" %>
<%= text_input f, :bgg_username, class: "form-control" %>
<%= error_tag f, :bgg_username %>
</div>

<div class="form-group">
<%= label f, :password, class: "control-label" %>
<%= password_input f, :password, class: "form-control" %>
Expand Down

0 comments on commit 83593f6

Please sign in to comment.