add reset password link
This commit is contained in:
@@ -20,4 +20,10 @@ class PasswordsController < Devise::PasswordsController
|
||||
Current.user = resource
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_resetting_password_path_for(_)
|
||||
new_session_path(resource_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,6 +30,7 @@ class UsersController < ApplicationController
|
||||
return render turbo_stream: turbo_stream.replace(:modal, template: 'users/new'), status: :unprocessable_content
|
||||
end
|
||||
|
||||
@user.password = SecureRandom.hex if @user.password.blank?
|
||||
@user.role = User::ADMIN_ROLE unless role_valid?(@user.role)
|
||||
|
||||
if @user.save
|
||||
|
||||
@@ -14,7 +14,7 @@ class UsersSendResetPasswordController < ApplicationController
|
||||
@user.send_reset_password_instructions
|
||||
|
||||
redirect_back fallback_location: settings_users_path,
|
||||
notice: I18n.t('you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes')
|
||||
notice: I18n.t('an_email_with_password_reset_instructions_has_been_sent')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<%= form_for current_user, url: update_password_settings_profile_index_path, method: :patch, html: { autocomplete: 'off' } do |f| %>
|
||||
<%= f.label :password, t('new_password'), class: 'label' %>
|
||||
<%= f.password_field :password, autocomplete: 'off', class: 'base-input peer w-full', required: true %>
|
||||
<div class="peer-invalid:hidden space-y-4 mt-4">
|
||||
<div class="<%= 'peer-invalid:hidden' if current_user.errors.blank? %> space-y-4 mt-4">
|
||||
<div class="form-control">
|
||||
<%= f.label :password_confirmation, t('confirm_password'), class: 'label' %>
|
||||
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'base-input' %>
|
||||
@@ -67,7 +67,7 @@
|
||||
<%= f.password_field :current_password, autocomplete: 'current-password', class: 'base-input' %>
|
||||
<% if Accounts.can_send_emails?(current_account) %>
|
||||
<span class="label-text-alt mt-1">
|
||||
<%= t('dont_remember_your_current_password_click_here_to_reset_it_html', link: new_user_password_url) %>
|
||||
<%= t('dont_remember_your_current_password_click_here_to_reset_it_html') %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -13,11 +13,16 @@
|
||||
<div class="form-control">
|
||||
<%= f.label :email, t('email'), class: 'label' %>
|
||||
<%= f.email_field :email, required: true, class: 'base-input' %>
|
||||
<% if user.persisted? && Accounts.can_send_emails?(current_account) %>
|
||||
<span class="label-text-alt mt-2 mx-1">
|
||||
<%= t('click_here_to_send_a_reset_password_email_html') %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if user.new_record? && !Docuseal.multitenant? %>
|
||||
<div class="form-control">
|
||||
<%= f.label :password, t('password'), class: 'label' %>
|
||||
<%= f.password_field :password, required: true, class: 'base-input' %>
|
||||
<%= f.password_field :password, class: 'base-input' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if f.object != current_user %>
|
||||
@@ -37,3 +42,6 @@
|
||||
<%= f.button button_title, class: 'base-button' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if user.persisted? %>
|
||||
<%= button_to nil, user_send_reset_password_path(user), id: 'resend_password_button', method: :put, class: 'hidden', data: { turbo_confirm: t('are_you_sure_'), turbo_frame: :_top } %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user