fix(users): fix styles for login page

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2021-08-15 05:02:33 +05:30
parent 7374d7189e
commit 47acc97955
No known key found for this signature in database
GPG Key ID: ED5C54FBBB920E51
2 changed files with 30 additions and 22 deletions

View File

@ -34,6 +34,7 @@ defmodule KetbinWeb.UserAuth do
|> put_session(:user_token, token) |> put_session(:user_token, token)
|> put_session(:live_socket_id, "users_sessions:#{Base.url_encode64(token)}") |> put_session(:live_socket_id, "users_sessions:#{Base.url_encode64(token)}")
|> maybe_write_remember_me_cookie(token, params) |> maybe_write_remember_me_cookie(token, params)
|> put_flash(:info, "Logged in successfully!")
|> redirect(to: user_return_to || signed_in_path(conn)) |> redirect(to: user_return_to || signed_in_path(conn))
end end

View File

@ -1,27 +1,34 @@
<h1>Log in</h1> <div class="flex flex-col w-full h-full justify-center items-center">
<h1 class="font-bold text-4xl text-amber pt-4">Log in</h1>
<%= form_for @conn, Routes.user_session_path(@conn, :create), [as: :user], fn f -> %> <%= form_for @conn, Routes.user_session_path(@conn, :create), [as: :user, class: "flex flex-col h-full justify-center items-start m-auto"], fn f -> %>
<%= if @error_message do %> <%= if @error_message do %>
<div class="alert alert-danger"> <div class="alert alert-danger">
<p><%= @error_message %></p> <p><%= @error_message %></p>
</div> </div>
<% end %> <% end %>
<div class="flex flex-col w-full">
<%= label f, :email %> <%= label f, :email %>
<%= email_input f, :email, required: true %> <%= email_input f, :email, [class: "text-black px-2 py-1 outline-none", required: true] %>
</div>
<div class="flex flex-col mt-2 w-full">
<%= label f, :password %> <%= label f, :password %>
<%= password_input f, :password, required: true %> <%= password_input f, :password, [class: "text-black px-2 py-1 outline-none", required: true] %>
</div>
<div class="flex mt-2 w-full justify-center items-center">
<%= checkbox f, :remember_me, [class: "mr-2 outline-none"] %>
<%= label f, :remember_me, "Keep me logged in for 60 days" %> <%= label f, :remember_me, "Keep me logged in for 60 days" %>
<%= checkbox f, :remember_me %> </div>
<div> <div class="bg-amber mt-4 rounded-sm px-2 py-1">
<%= submit "Log in" %> <%= submit "Log in" %>
</div> </div>
<% end %> <% end %>
<p> <p class="mb-4 text-amber">
<%= link "Register", to: Routes.user_registration_path(@conn, :new) %> | <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> |
<%= link "Forgot your password?", to: Routes.user_reset_password_path(@conn, :new) %> <%= link "Forgot your password?", to: Routes.user_reset_password_path(@conn, :new) %>
</p> </p>
</div>