Commit ·
d107e48
1
Parent(s): a89b862
fix: Rearrange left panel with consistency
Browse files
lib/medical_transcription/accounts/user.ex
CHANGED
|
@@ -1,8 +1,11 @@
|
|
| 1 |
defmodule MedicalTranscription.Accounts.User do
|
| 2 |
use Ecto.Schema
|
| 3 |
import Ecto.Changeset
|
|
|
|
| 4 |
@primary_key {:id, :binary_id, autogenerate: true}
|
| 5 |
@foreign_key_type :binary_id
|
|
|
|
|
|
|
| 6 |
schema "users" do
|
| 7 |
field :email, :string
|
| 8 |
field :password, :string, virtual: true, redact: true
|
|
@@ -53,7 +56,7 @@ defmodule MedicalTranscription.Accounts.User do
|
|
| 53 |
defp validate_password(changeset, opts) do
|
| 54 |
changeset
|
| 55 |
|> validate_required([:password])
|
| 56 |
-
|> validate_length(:password, min:
|
| 57 |
# Examples of additional password validation:
|
| 58 |
# |> validate_format(:password, ~r/[a-z]/, message: "at least one lower case character")
|
| 59 |
# |> validate_format(:password, ~r/[A-Z]/, message: "at least one upper case character")
|
|
|
|
| 1 |
defmodule MedicalTranscription.Accounts.User do
|
| 2 |
use Ecto.Schema
|
| 3 |
import Ecto.Changeset
|
| 4 |
+
|
| 5 |
@primary_key {:id, :binary_id, autogenerate: true}
|
| 6 |
@foreign_key_type :binary_id
|
| 7 |
+
@min_password_length 8
|
| 8 |
+
|
| 9 |
schema "users" do
|
| 10 |
field :email, :string
|
| 11 |
field :password, :string, virtual: true, redact: true
|
|
|
|
| 56 |
defp validate_password(changeset, opts) do
|
| 57 |
changeset
|
| 58 |
|> validate_required([:password])
|
| 59 |
+
|> validate_length(:password, min: @min_password_length, max: 72)
|
| 60 |
# Examples of additional password validation:
|
| 61 |
# |> validate_format(:password, ~r/[a-z]/, message: "at least one lower case character")
|
| 62 |
# |> validate_format(:password, ~r/[A-Z]/, message: "at least one upper case character")
|
lib/medical_transcription_web/components/header_component.ex
CHANGED
|
@@ -15,24 +15,30 @@ defmodule MedicalTranscriptionWeb.Components.HeaderComponent do
|
|
| 15 |
</h1>
|
| 16 |
</div>
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
<ul class="flex flex-col items-center gap-4 px-4">
|
| 19 |
<%= if @current_user do %>
|
| 20 |
<li class="text-[0.8125rem] leading-6 text-zinc-900">
|
| 21 |
<%= @current_user.email %>
|
| 22 |
</li>
|
| 23 |
-
<li>
|
| 24 |
<.link
|
| 25 |
href={~p"/users/settings"}
|
| 26 |
-
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
| 27 |
>
|
| 28 |
Settings
|
| 29 |
</.link>
|
| 30 |
</li>
|
| 31 |
-
<li>
|
| 32 |
<.link
|
| 33 |
href={~p"/users/log_out"}
|
| 34 |
method="delete"
|
| 35 |
-
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
| 36 |
>
|
| 37 |
Log out
|
| 38 |
</.link>
|
|
@@ -58,12 +64,9 @@ defmodule MedicalTranscriptionWeb.Components.HeaderComponent do
|
|
| 58 |
</ul>
|
| 59 |
|
| 60 |
<%= if @current_user do %>
|
| 61 |
-
<div class="flex-1 px-6">
|
| 62 |
-
<p class="text-xs leading-normal tracking-[0.2em] font-semibold uppercase">Today</p>
|
| 63 |
-
</div>
|
| 64 |
-
|
| 65 |
<div class="px-6 flex flex-col items-center">
|
| 66 |
<%= if MedicalTranscription.Coding.icd9_present?() do %>
|
|
|
|
| 67 |
<div
|
| 68 |
class="w-full px-3 py-2 bg-emerald-600 text-white text-center rounded-lg"
|
| 69 |
title="Precalculated vector embeddings for classification labels were found."
|
|
|
|
| 15 |
</h1>
|
| 16 |
</div>
|
| 17 |
|
| 18 |
+
<%= if @current_user do %>
|
| 19 |
+
<div class="flex-1 px-6">
|
| 20 |
+
<p class="text-xs leading-normal tracking-[0.2em] font-semibold uppercase">Today</p>
|
| 21 |
+
</div>
|
| 22 |
+
<% end %>
|
| 23 |
+
|
| 24 |
<ul class="flex flex-col items-center gap-4 px-4">
|
| 25 |
<%= if @current_user do %>
|
| 26 |
<li class="text-[0.8125rem] leading-6 text-zinc-900">
|
| 27 |
<%= @current_user.email %>
|
| 28 |
</li>
|
| 29 |
+
<li class="w-full">
|
| 30 |
<.link
|
| 31 |
href={~p"/users/settings"}
|
| 32 |
+
class="text-[0.8125rem] text-left w-full block leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
| 33 |
>
|
| 34 |
Settings
|
| 35 |
</.link>
|
| 36 |
</li>
|
| 37 |
+
<li class="w-full">
|
| 38 |
<.link
|
| 39 |
href={~p"/users/log_out"}
|
| 40 |
method="delete"
|
| 41 |
+
class="text-[0.8125rem] text-left w-full block leading-6 text-zinc-900 font-semibold hover:text-zinc-700"
|
| 42 |
>
|
| 43 |
Log out
|
| 44 |
</.link>
|
|
|
|
| 64 |
</ul>
|
| 65 |
|
| 66 |
<%= if @current_user do %>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
<div class="px-6 flex flex-col items-center">
|
| 68 |
<%= if MedicalTranscription.Coding.icd9_present?() do %>
|
| 69 |
+
|
| 70 |
<div
|
| 71 |
class="w-full px-3 py-2 bg-emerald-600 text-white text-center rounded-lg"
|
| 72 |
title="Precalculated vector embeddings for classification labels were found."
|