<%= get_flash(@conn, :info) %>
+<%= get_flash(@conn, :error) %>
<%= @inner_content %>diff --git a/friends/lib/friends/accounts/user.ex b/friends/lib/friends/accounts/user.ex index e63a464..9f85586 100644 --- a/friends/lib/friends/accounts/user.ex +++ b/friends/lib/friends/accounts/user.ex @@ -9,6 +9,8 @@ defmodule Friends.Accounts.User do field :confirmed_at, :naive_datetime timestamps() + + has_one :profile, Friends.Friend end @doc """ @@ -47,7 +49,7 @@ defmodule Friends.Accounts.User do defp validate_password(changeset, opts) do changeset |> validate_required([:password]) - |> validate_length(:password, min: 12, max: 72) + |> validate_length(:password, min: 6, max: 72) # |> validate_format(:password, ~r/[a-z]/, message: "at least one lower case character") # |> validate_format(:password, ~r/[A-Z]/, message: "at least one upper case character") # |> validate_format(:password, ~r/[!?@#$%^&*_0-9]/, message: "at least one digit or punctuation character") diff --git a/friends/lib/friends/accounts/user_notifier.ex b/friends/lib/friends/accounts/user_notifier.ex index b8d4806..c3cec41 100644 --- a/friends/lib/friends/accounts/user_notifier.ex +++ b/friends/lib/friends/accounts/user_notifier.ex @@ -8,7 +8,7 @@ defmodule Friends.Accounts.UserNotifier do email = new() |> to(recipient) - |> from({"Friends", "contact@example.com"}) + |> from({"Friends App", "ryan@pandu.ski"}) |> subject(subject) |> text_body(body) diff --git a/friends/lib/friends/friend.ex b/friends/lib/friends/friend.ex index 62294f5..d2b4f48 100644 --- a/friends/lib/friends/friend.ex +++ b/friends/lib/friends/friend.ex @@ -16,7 +16,7 @@ defmodule Friends.Friend do field(:slug, :string) field(:memories, {:array, :string}) - # has_many(:photos, Media.Photo) + belongs_to :user, Friends.Accounts.User, foreign_key: :user_id many_to_many( :relationships, diff --git a/friends/lib/friends_web/controllers/friend_controller.ex b/friends/lib/friends_web/controllers/friend_controller.ex new file mode 100644 index 0000000..8709ee7 --- /dev/null +++ b/friends/lib/friends_web/controllers/friend_controller.ex @@ -0,0 +1,13 @@ +defmodule FriendsWeb.FriendController do + use FriendsWeb, :controller + alias Friends.{Friend, Relationship} + alias Friends.Accounts.User + import Helpers + + def index(conn, _params) do + + conn + |> assign(:all_friends, Friend.all) + |> render("index.html") + end +end diff --git a/friends/lib/friends_web/router.ex b/friends/lib/friends_web/router.ex index 125b8dd..5727e62 100644 --- a/friends/lib/friends_web/router.ex +++ b/friends/lib/friends_web/router.ex @@ -21,6 +21,8 @@ defmodule FriendsWeb.Router do pipe_through :browser get "/", PageController, :index + get "/friends", FriendController, :index + live "/friend/:slug", FriendsLive.Show end diff --git a/friends/lib/friends_web/templates/friend/index.html.heex b/friends/lib/friends_web/templates/friend/index.html.heex new file mode 100644 index 0000000..355e334 --- /dev/null +++ b/friends/lib/friends_web/templates/friend/index.html.heex @@ -0,0 +1,13 @@ +
<%= get_flash(@conn, :info) %>
+<%= get_flash(@conn, :error) %>
<%= @inner_content %>