mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Use DB for auth sessions (#1233)
* DB sessions * Validations for profile image
This commit is contained in:
parent
82c298307d
commit
1ffa13f3b3
27 changed files with 118 additions and 76 deletions
|
@ -63,7 +63,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<%= button_to session_path, method: :delete, class: "w-full text-red-400 flex gap-1 items-center hover:bg-gray-50 rounded-lg px-3 py-2" do %>
|
||||
<%= button_to session_path(Current.session), method: :delete, class: "w-full text-red-400 flex gap-1 items-center hover:bg-gray-50 rounded-lg px-3 py-2" do %>
|
||||
<%= lucide_icon("log-out", class: "w-5 h-5 shrink-0") %>
|
||||
<span class="text-sm">Logout</span>
|
||||
<% end %>
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
</head>
|
||||
|
||||
<body class="h-full">
|
||||
<div class="fixed z-50 space-y-1 top-6 right-10">
|
||||
<div id="notification-tray">
|
||||
<%= render_flash_notifications %>
|
||||
<div class="fixed z-50 space-y-1 top-6 right-10">
|
||||
<div id="notification-tray">
|
||||
<%= render_flash_notifications %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= family_notifications_stream %>
|
||||
<%= family_stream %>
|
||||
<%= family_notifications_stream %>
|
||||
<%= family_stream %>
|
||||
|
||||
<%= content_for?(:content) ? yield(:content) : yield %>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
<%= render "shared/confirm_modal" %>
|
||||
|
||||
<% if self_hosted? %>
|
||||
<%= render "shared/app_version" %>
|
||||
<%= render "shared/app_version" %>
|
||||
<% end %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
|
||||
<div class="p-8 mt-2 text-center">
|
||||
<p class="mt-6 text-sm text-black"><%= link_to t(".privacy_policy"), "/privacy", class: "font-medium text-gray-600 hover:text-gray-400 transition" %> • <%= link_to t(".terms_of_service"), "/terms", class: "font-medium text-gray-600 hover:text-gray-400 transition" %></p>
|
||||
<p class="mt-6 text-sm text-black"><%= link_to t(".privacy_policy"), "https://maybe.co/privacy", class: "font-medium text-gray-600 hover:text-gray-400 transition" %> • <%= link_to t(".terms_of_service"), "https://maybe.co/tos", class: "font-medium text-gray-600 hover:text-gray-400 transition" %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
%>
|
||||
|
||||
<%= styled_form_with model: @user, url: password_reset_path(token: params[:token]), method: :patch, class: "space-y-4" do |form| %>
|
||||
<%= auth_messages form %>
|
||||
|
||||
<div class="relative border border-gray-100 bg-gray-25 rounded-xl focus-within:bg-white focus-within:shadow focus-within:opacity-100">
|
||||
<%= form.label :password, class: "p-4 pb-0 block text-sm font-medium text-gray-700" %>
|
||||
<%= form.password_field :password, required: "required", class: "p-4 pt-1 bg-transparent border-none opacity-50 focus:outline-none focus:ring-0 focus-within:opacity-100 w-full" %>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
%>
|
||||
|
||||
<%= styled_form_with url: password_reset_path, class: "space-y-4" do |form| %>
|
||||
<%= auth_messages form %>
|
||||
|
||||
<%= form.email_field :email, label: true, autofocus: false, autocomplete: "email", required: "required", placeholder: "you@example.com" %>
|
||||
|
||||
<%= form.submit t(".submit") %>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<h1><% t(".title") %></h1>
|
||||
|
||||
<%= styled_form_with model: Current.user, url: password_path, class: "space-y-4" do |form| %>
|
||||
<%= auth_messages form %>
|
||||
|
||||
<div>
|
||||
<%= form.label :password_challenge, t(".password_challenge") %>
|
||||
<%= form.password_field :password_challenge %>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<% end %>
|
||||
|
||||
<%= styled_form_with model: @user, url: registration_path, class: "space-y-4" do |form| %>
|
||||
<%= auth_messages form %>
|
||||
<%= form.email_field :email, autofocus: false, autocomplete: "email", required: "required", placeholder: "you@example.com", label: true %>
|
||||
<%= form.password_field :password, autocomplete: "new-password", required: "required", label: true %>
|
||||
<%= form.password_field :password_confirmation, autocomplete: "new-password", required: "required", label: true %>
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
header_title t(".title")
|
||||
%>
|
||||
|
||||
<%= styled_form_with url: session_path, class: "space-y-4" do |form| %>
|
||||
<%= auth_messages form %>
|
||||
|
||||
<%= styled_form_with url: sessions_path, class: "space-y-4" do |form| %>
|
||||
<%= form.email_field :email, label: t(".email"), autofocus: false, autocomplete: "email", required: "required", placeholder: t(".email_placeholder") %>
|
||||
|
||||
<%= form.password_field :password, label: t(".password"), required: "required" %>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<%= button_to session_path, method: :delete, class: "flex items-center gap-2 px-3 py-2 rounded-xl border text-sm font-medium w-full text-error hover:bg-gray-100 border-transparent" do %>
|
||||
<%= button_to session_path(Current.session), method: :delete, class: "flex items-center gap-2 px-3 py-2 rounded-xl border text-sm font-medium w-full text-error hover:bg-gray-100 border-transparent" do %>
|
||||
<%= lucide_icon("log-out", class: "w-5 h-5 shrink-0") %>
|
||||
<span><%= t(".logout") %></span>
|
||||
<% end %>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="space-y-3">
|
||||
<p><%= t(".profile_image_type") %></p>
|
||||
<%= form.label :profile_image, t(".profile_image_choose"), class: "inline-block cursor-pointer px-3 py-2 bg-gray-50 text-gray-900 rounded-md text-sm font-medium" %>
|
||||
<%= form.file_field :profile_image, accept: "image/png, image/jpeg, image/gif", class: "hidden px-3 py-2 bg-gray-50 text-gray-900 rounded-md text-sm font-medium", data: {profile_image_preview_target: "fileField", action: "change->profile-image-preview#preview"} %>
|
||||
<%= form.file_field :profile_image, accept: "image/png, image/jpeg", class: "hidden px-3 py-2 bg-gray-50 text-gray-900 rounded-md text-sm font-medium", data: {profile_image_preview_target: "fileField", action: "change->profile-image-preview#preview"} %>
|
||||
<%= form.hidden_field :delete_profile_image, value: false, data: {profile_image_preview_target: "deleteField"} %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue