Compare commits
No commits in common. "577e273a1b63a887de81b2e1b2bd8b61f485cc4e" and "4a79081fc8b64f535604ff0aa39236a53a7db85e" have entirely different histories.
577e273a1b
...
4a79081fc8
8 changed files with 6 additions and 84 deletions
|
@ -1,15 +1,3 @@
|
|||
defmodule NullaWeb.PageHTML do
|
||||
use NullaWeb, :html
|
||||
|
||||
embed_templates "templates/page/*"
|
||||
end
|
||||
|
||||
defmodule NullaWeb.AuthHTML do
|
||||
use NullaWeb, :html
|
||||
|
||||
embed_templates "templates/auth/*"
|
||||
end
|
||||
|
||||
defmodule NullaWeb.ActorHTML do
|
||||
use NullaWeb, :html
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<main class="flex min-h-screen items-center justify-center">
|
||||
<form class="flex flex-col gap-2" action="/auth/sign_in" method="post">
|
||||
<label for="email">E-mail address *</label>
|
||||
<input id="email" name="email" type="email" maxlength="50" required />
|
||||
<label for="password">Password *</label>
|
||||
<input id="password" name="password" type="password" minlength="8" maxlength="50" required />
|
||||
<button class="text-white bg-black py-2 border" type="submit">Log in</button>
|
||||
</form>
|
||||
</main>
|
|
@ -1,12 +0,0 @@
|
|||
<main class="flex min-h-screen items-center justify-center">
|
||||
<form class="flex flex-col gap-2" action="/auth" method="post">
|
||||
<label for="username">Username *</label>
|
||||
<input id="username" name="username" type="text" maxlength="30" required />
|
||||
<label for="email">E-mail address *</label>
|
||||
<input id="email" name="email" type="email" maxlength="50" required />
|
||||
<label for="password">Password *</label>
|
||||
<input id="password" name="password" type="password" minlength="8" maxlength="50" required />
|
||||
<input id="password_confirm" name="password_confirm" type="password" minlength="8" maxlength="50" placeholder="Confirm password" />
|
||||
<button class="text-white bg-black py-2 border" type="submit">Sign up</button>
|
||||
</form>
|
||||
</main>
|
|
@ -1,37 +1,12 @@
|
|||
defmodule NullaWeb.AuthController do
|
||||
use NullaWeb, :controller
|
||||
alias Nulla.Models.User
|
||||
|
||||
def sign_in_view(conn, _params) do
|
||||
render(conn, :sign_in, layout: false)
|
||||
def sign_in do
|
||||
end
|
||||
|
||||
def sign_in(conn, _params) do
|
||||
conn
|
||||
|> redirect(to: "/")
|
||||
def sign_out do
|
||||
end
|
||||
|
||||
def sign_out(conn, _params) do
|
||||
conn
|
||||
|> configure_session(drop: true)
|
||||
|> put_flash(:info, "You have been logged out.")
|
||||
|> redirect(to: "/")
|
||||
end
|
||||
|
||||
def sign_up_view(conn, _params) do
|
||||
render(conn, :sign_up, layout: false)
|
||||
end
|
||||
|
||||
def sign_up(conn, params) do
|
||||
case User.create_user(params) do
|
||||
{:ok, user} ->
|
||||
conn
|
||||
|> put_session(:user_id, user.id)
|
||||
|> put_flash(:info, "You're registred!")
|
||||
|> redirect(to: "/")
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
render(conn, "sign_up.html", changeset: changeset)
|
||||
end
|
||||
def sign_up do
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
defmodule NullaWeb.PageController do
|
||||
use NullaWeb, :controller
|
||||
|
||||
def home(conn, _params) do
|
||||
render(conn, :home, layout: false)
|
||||
end
|
||||
end
|
|
@ -17,8 +17,6 @@ defmodule NullaWeb.Router do
|
|||
scope "/", NullaWeb do
|
||||
pipe_through :browser
|
||||
|
||||
get "/", PageController, :home
|
||||
|
||||
get "/.well-known/host-meta", HostmetaController, :index
|
||||
get "/.well-known/webfinger", WebfingerController, :index
|
||||
get "/.well-known/nodeinfo", NodeinfoController, :index
|
||||
|
@ -26,11 +24,9 @@ defmodule NullaWeb.Router do
|
|||
post "/inbox", InboxController, :inbox
|
||||
|
||||
scope "/auth" do
|
||||
get "/sign_in", AuthController, :sign_in_view
|
||||
post "/sign_in", AuthController, :sign_in
|
||||
delete "/sign_out", AuthController, :sign_out
|
||||
get "/sign_up", AuthController, :sign_up_view
|
||||
post "/sign_up", AuthController, :sign_up
|
||||
get "/sign_in", AuthController, :sign_in
|
||||
post "/sign_out", AuthController, :sign_out
|
||||
get "/sign_up", AuthController, :sign_up
|
||||
end
|
||||
|
||||
scope "/users/:username" do
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
defmodule NullaWeb.PageControllerTest do
|
||||
use NullaWeb.ConnCase
|
||||
|
||||
test "GET /", %{conn: conn} do
|
||||
conn = get(conn, ~p"/")
|
||||
|
||||
assert String.length(html_response(conn, 200)) > 0
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue