diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 7030e40f..c3b7e88e 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -1,4 +1,11 @@ # frozen_string_literal: true class InvitationsController < Devise::PasswordsController + def update + super do |resource| + resource.confirmed_at ||= Time.current if resource.errors.empty? + + PasswordsController::Current.user = resource + end + end end diff --git a/app/views/invitations/edit.html.erb b/app/views/invitations/edit.html.erb index 966b487f..1513d612 100644 --- a/app/views/invitations/edit.html.erb +++ b/app/views/invitations/edit.html.erb @@ -3,7 +3,7 @@ <%= svg_icon('waving_hand', class: 'h-10 w-10') %> <%= t('welcome_to_product_name', product_name: Docuseal.product_name) %> - <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: 'space-y-6' }) do |f| %> + <%= form_for(resource, as: resource_name, url: invitation_path, html: { method: :put, class: 'space-y-6' }) do |f| %>
<%= render 'devise/shared/error_messages', resource: %> <%= f.hidden_field :reset_password_token %>