today_ai_weather/app/views/devise/sessions/new.html.erb
songtianlun 0312383bc8 feat: add flash message functionality
- Implement Stimulus controller for closing flash messages
- Replace inline alerts with a partial for better organization
- Enhance styling for user registration and login forms

This update introduces a new flash message component that allows
for user notifications to be displayed on the screen and closed by
the user. The forms also include improved styles for a better
user experience.
2025-02-11 15:52:58 +08:00

68 lines
2.8 KiB
Plaintext

<div class="min-h-screen flex flex-col items-center justify-center px-4">
<div class="card w-full max-w-md bg-base-100 shadow-xl">
<div class="card-body">
<h2 class="card-title text-2xl font-bold text-center mb-6">Sign in to your account</h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "space-y-4" }) do |f| %>
<div class="form-control">
<%= f.label :email, class: "label" %>
<%= f.email_field :email,
autofocus: true,
autocomplete: "email",
class: "input input-bordered w-full",
placeholder: "your@email.com" %>
</div>
<div class="form-control">
<div class="flex justify-between items-center">
<%= f.label :password, class: "label" %>
<% if devise_mapping.recoverable? %>
<%= link_to "Forgot password?", new_password_path(resource_name), class: "label-text-alt link link-primary" %>
<% end %>
</div>
<%= f.password_field :password,
autocomplete: "current-password",
class: "input input-bordered w-full",
placeholder: "••••••••" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="form-control">
<label class="label cursor-pointer justify-start gap-2">
<%= f.check_box :remember_me, class: "checkbox checkbox-primary" %>
<span class="label-text">Remember me</span>
</label>
</div>
<% end %>
<div class="form-control mt-6">
<%= f.submit "Sign in", class: "btn btn-primary w-full" %>
</div>
<% end %>
<% if devise_mapping.registerable? %>
<div class="divider">OR</div>
<div class="text-center">
<p class="text-sm text-base-content/70 mb-4">
Don't have an account?
<%= link_to "Create an account", new_registration_path(resource_name), class: "link link-primary" %>
</p>
</div>
<% end %>
<% if devise_mapping.omniauthable? %>
<div class="space-y-3">
<%- resource_class.omniauth_providers.each do |provider| %>
<%= button_to omniauth_authorize_path(resource_name, provider),
class: "btn btn-outline w-full",
data: { turbo: false } do %>
<%= image_tag("#{provider}.svg", class: "w-5 h-5 mr-2") if File.exist?(Rails.root.join("app/assets/images/#{provider}.svg")) %>
Sign in with <%= OmniAuth::Utils.camelize(provider) %>
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>
</div>