Skip to content

Commit

Permalink
Clean up reset password form
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Dec 12, 2023
1 parent e7f922b commit 15f789d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
55 changes: 34 additions & 21 deletions app/views/devise/passwords/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
<h2>Change your password</h2>
<% label_css = "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-half" %>
<div class="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div class="sm:mx-auto sm:w-full sm:max-w-md">
<h2 class="mt-6 text-center text-3xl leading-9 font-extrabold text-gray-900">Change your password</h2>
</div>

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-[480px]">
<div class="bg-white px-6 py-12 shadow sm:rounded-lg sm:px-12">
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>

<div class="field">
<%= f.label :password, "New password" %><br />
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: label_css %>
</div>
<div class="space-y-6">
<div>
<div class="block">
<%= f.label :password, class: "text-sm font-medium leading-6 text-gray-900" %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %>
</div>
<div class="mt-2">
<%= f.password_field :password, autocomplete: "new-password", autofocus: true, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>

<div class="field">
<%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: label_css %>
</div>
<div>
<%= f.label :password_confirmation, class: "block text-sm font-medium leading-6 text-gray-900" %>
<div class="mt-2">
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>

<div class="actions">
<%= f.submit "Change my password" %>
<div>
<%= f.submit "Change my password", class: "flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" %>
</div>
</div>
<% end %>
</div>
</div>
<% end %>

<%= render "devise/shared/links" %>
</div>
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true

config.action_mailer.default_url_options = {host: "localhost", port: 3000}
end
4 changes: 4 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,8 @@
# ]
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }

config.action_mailer.delivery_method = :mailpace
config.action_mailer.mailpace_settings = {api_token: Rails.application.credentials.mailpace_api_token}
config.action_mailer.default_url_options = {host: "beginnerbounties.com"}
end
7 changes: 0 additions & 7 deletions config/initializers/mail.rb

This file was deleted.

0 comments on commit 15f789d

Please sign in to comment.