add reset password link
This commit is contained in:
@@ -20,4 +20,10 @@ class PasswordsController < Devise::PasswordsController
|
|||||||
Current.user = resource
|
Current.user = resource
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def after_resetting_password_path_for(_)
|
||||||
|
new_session_path(resource_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class UsersController < ApplicationController
|
|||||||
return render turbo_stream: turbo_stream.replace(:modal, template: 'users/new'), status: :unprocessable_content
|
return render turbo_stream: turbo_stream.replace(:modal, template: 'users/new'), status: :unprocessable_content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@user.password = SecureRandom.hex if @user.password.blank?
|
||||||
@user.role = User::ADMIN_ROLE unless role_valid?(@user.role)
|
@user.role = User::ADMIN_ROLE unless role_valid?(@user.role)
|
||||||
|
|
||||||
if @user.save
|
if @user.save
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class UsersSendResetPasswordController < ApplicationController
|
|||||||
@user.send_reset_password_instructions
|
@user.send_reset_password_instructions
|
||||||
|
|
||||||
redirect_back fallback_location: settings_users_path,
|
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
|
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| %>
|
<%= 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.label :password, t('new_password'), class: 'label' %>
|
||||||
<%= f.password_field :password, autocomplete: 'off', class: 'base-input peer w-full', required: true %>
|
<%= 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">
|
<div class="form-control">
|
||||||
<%= f.label :password_confirmation, t('confirm_password'), class: 'label' %>
|
<%= f.label :password_confirmation, t('confirm_password'), class: 'label' %>
|
||||||
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'base-input' %>
|
<%= 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' %>
|
<%= f.password_field :current_password, autocomplete: 'current-password', class: 'base-input' %>
|
||||||
<% if Accounts.can_send_emails?(current_account) %>
|
<% if Accounts.can_send_emails?(current_account) %>
|
||||||
<span class="label-text-alt mt-1">
|
<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>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,11 +13,16 @@
|
|||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<%= f.label :email, t('email'), class: 'label' %>
|
<%= f.label :email, t('email'), class: 'label' %>
|
||||||
<%= f.email_field :email, required: true, class: 'base-input' %>
|
<%= 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>
|
</div>
|
||||||
<% if user.new_record? && !Docuseal.multitenant? %>
|
<% if user.new_record? && !Docuseal.multitenant? %>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<%= f.label :password, t('password'), class: 'label' %>
|
<%= f.label :password, t('password'), class: 'label' %>
|
||||||
<%= f.password_field :password, required: true, class: 'base-input' %>
|
<%= f.password_field :password, class: 'base-input' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if f.object != current_user %>
|
<% if f.object != current_user %>
|
||||||
@@ -37,3 +42,6 @@
|
|||||||
<%= f.button button_title, class: 'base-button' %>
|
<%= f.button button_title, class: 'base-button' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% 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 %>
|
||||||
|
|||||||
+12
-7
@@ -27,6 +27,7 @@ en: &en
|
|||||||
enabled: Enabled
|
enabled: Enabled
|
||||||
disabled: Disabled
|
disabled: Disabled
|
||||||
party: Party
|
party: Party
|
||||||
|
click_here_to_send_a_reset_password_email_html: '<label class="link" for="resend_password_button">Click here</label> to send a reset password email.'
|
||||||
edit_order: Edit Order
|
edit_order: Edit Order
|
||||||
expirable_file_download_links: Expirable file download links
|
expirable_file_download_links: Expirable file download links
|
||||||
invite_form_fields: Invite form fields
|
invite_form_fields: Invite form fields
|
||||||
@@ -46,7 +47,7 @@ en: &en
|
|||||||
pending_by_me: Pending by me
|
pending_by_me: Pending by me
|
||||||
partially_completed: Partially completed
|
partially_completed: Partially completed
|
||||||
require_phone_2fa_to_open: Require phone 2FA to open
|
require_phone_2fa_to_open: Require phone 2FA to open
|
||||||
the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_html: The sender has requested a two factor authentication via one time password sent to your <b>%{phone}</b> phone number.
|
the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_html: The sender has requested two-factor authentication via a one-time password sent to your <b>%{phone}</b> phone number.
|
||||||
send_verification_code: Send verification code
|
send_verification_code: Send verification code
|
||||||
code_has_been_resent: Code has been re-sent
|
code_has_been_resent: Code has been re-sent
|
||||||
invalid_code: Invalid code
|
invalid_code: Invalid code
|
||||||
@@ -803,7 +804,7 @@ en: &en
|
|||||||
wrong_password: Wrong password.
|
wrong_password: Wrong password.
|
||||||
current_password: Current password
|
current_password: Current password
|
||||||
dont_remember_your_current_password_click_here_to_reset_it_html: 'Don''t remember your current password? <label class="link" for="resend_password_button">Click here</label> to reset it.'
|
dont_remember_your_current_password_click_here_to_reset_it_html: 'Don''t remember your current password? <label class="link" for="resend_password_button">Click here</label> to reset it.'
|
||||||
you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes: You will receive an email with password reset instructions in a few minutes.
|
an_email_with_password_reset_instructions_has_been_sent: An email with password reset instructions has been sent.
|
||||||
submission_sources:
|
submission_sources:
|
||||||
api: API
|
api: API
|
||||||
bulk: Bulk Send
|
bulk: Bulk Send
|
||||||
@@ -1693,7 +1694,7 @@ es: &es
|
|||||||
wrong_password: Contraseña incorrecta.
|
wrong_password: Contraseña incorrecta.
|
||||||
current_password: Contraseña actual
|
current_password: Contraseña actual
|
||||||
dont_remember_your_current_password_click_here_to_reset_it_html: '¿No recuerdas tu contraseña actual? <label class="link" for="resend_password_button">Haz clic aquí</label> para restablecerla.'
|
dont_remember_your_current_password_click_here_to_reset_it_html: '¿No recuerdas tu contraseña actual? <label class="link" for="resend_password_button">Haz clic aquí</label> para restablecerla.'
|
||||||
you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes: Recibirás un correo electrónico con las instrucciones para restablecer tu contraseña en unos minutos.
|
an_email_with_password_reset_instructions_has_been_sent: Se enviará un correo electrónico con las instrucciones para restablecer tu contraseña en unos minutos.
|
||||||
submission_sources:
|
submission_sources:
|
||||||
api: API
|
api: API
|
||||||
bulk: Envío masivo
|
bulk: Envío masivo
|
||||||
@@ -1800,6 +1801,7 @@ es: &es
|
|||||||
range_without_total: "%{from}-%{to} eventos"
|
range_without_total: "%{from}-%{to} eventos"
|
||||||
|
|
||||||
it: &it
|
it: &it
|
||||||
|
click_here_to_send_a_reset_password_email_html: '<label class="link" for="resend_password_button">Clicca qui</label> per inviare una email per reimpostare la password.'
|
||||||
enabled: Abilitato
|
enabled: Abilitato
|
||||||
disabled: Disabilitato
|
disabled: Disabilitato
|
||||||
expirable_file_download_links: Link di download di file con scadenza
|
expirable_file_download_links: Link di download di file con scadenza
|
||||||
@@ -2583,7 +2585,7 @@ it: &it
|
|||||||
wrong_password: Password errata.
|
wrong_password: Password errata.
|
||||||
current_password: Password attuale
|
current_password: Password attuale
|
||||||
dont_remember_your_current_password_click_here_to_reset_it_html: 'Non ricordi la tua password attuale? <label class="link" for="resend_password_button">Clicca qui</label> per reimpostarla.'
|
dont_remember_your_current_password_click_here_to_reset_it_html: 'Non ricordi la tua password attuale? <label class="link" for="resend_password_button">Clicca qui</label> per reimpostarla.'
|
||||||
you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes: Riceverai un'email con le istruzioni per reimpostare la password entro pochi minuti.
|
an_email_with_password_reset_instructions_has_been_sent: Un'email con le istruzioni per reimpostare la password ti è stata inviata e arriverà entro pochi minuti.
|
||||||
submission_sources:
|
submission_sources:
|
||||||
api: API
|
api: API
|
||||||
bulk: Invio massivo
|
bulk: Invio massivo
|
||||||
@@ -2690,6 +2692,7 @@ it: &it
|
|||||||
range_without_total: "%{from}-%{to} eventi"
|
range_without_total: "%{from}-%{to} eventi"
|
||||||
|
|
||||||
fr: &fr
|
fr: &fr
|
||||||
|
click_here_to_send_a_reset_password_email_html: '<label class="link" for="resend_password_button">Cliquez ici</label> pour envoyer un e-mail de réinitialisation du mot de passe.'
|
||||||
enabled: Activé
|
enabled: Activé
|
||||||
disabled: Désactivé
|
disabled: Désactivé
|
||||||
expirable_file_download_links: Liens de téléchargement de fichiers expirables
|
expirable_file_download_links: Liens de téléchargement de fichiers expirables
|
||||||
@@ -3476,7 +3479,7 @@ fr: &fr
|
|||||||
wrong_password: Mot de passe incorrect.
|
wrong_password: Mot de passe incorrect.
|
||||||
current_password: Mot de passe actuel
|
current_password: Mot de passe actuel
|
||||||
dont_remember_your_current_password_click_here_to_reset_it_html: 'Vous ne vous souvenez plus de votre mot de passe actuel ? <label class="link" for="resend_password_button">Cliquez ici</label> pour le réinitialiser.'
|
dont_remember_your_current_password_click_here_to_reset_it_html: 'Vous ne vous souvenez plus de votre mot de passe actuel ? <label class="link" for="resend_password_button">Cliquez ici</label> pour le réinitialiser.'
|
||||||
you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes: Vous recevrez un e-mail avec les instructions de réinitialisation de votre mot de passe dans quelques minutes.
|
an_email_with_password_reset_instructions_has_been_sent: Un e-mail contenant les instructions pour réinitialiser votre mot de passe vous sera envoyé dans quelques minutes.
|
||||||
submission_sources:
|
submission_sources:
|
||||||
api: API
|
api: API
|
||||||
bulk: Envoi en masse
|
bulk: Envoi en masse
|
||||||
@@ -3583,6 +3586,7 @@ fr: &fr
|
|||||||
range_without_total: "%{from} à %{to} événements"
|
range_without_total: "%{from} à %{to} événements"
|
||||||
|
|
||||||
pt: &pt
|
pt: &pt
|
||||||
|
click_here_to_send_a_reset_password_email_html: '<label class="link" for="resend_password_button">Clique aqui</label> para enviar um e-mail de redefinição de senha.'
|
||||||
enabled: Ativado
|
enabled: Ativado
|
||||||
disabled: Desativado
|
disabled: Desativado
|
||||||
expirable_file_download_links: Links de download de arquivos com expiração
|
expirable_file_download_links: Links de download de arquivos com expiração
|
||||||
@@ -4367,7 +4371,7 @@ pt: &pt
|
|||||||
wrong_password: Senha incorreta.
|
wrong_password: Senha incorreta.
|
||||||
current_password: Senha atual
|
current_password: Senha atual
|
||||||
dont_remember_your_current_password_click_here_to_reset_it_html: 'Não se lembra da sua senha atual? <label class="link" for="resend_password_button">Clique aqui</label> para redefini-la.'
|
dont_remember_your_current_password_click_here_to_reset_it_html: 'Não se lembra da sua senha atual? <label class="link" for="resend_password_button">Clique aqui</label> para redefini-la.'
|
||||||
you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes: Você receberá um e-mail com as instruções para redefinir sua senha em alguns minutos.
|
an_email_with_password_reset_instructions_has_been_sent: Um e-mail com instruções para redefinir sua senha será enviado em alguns minutos.
|
||||||
submission_sources:
|
submission_sources:
|
||||||
api: API
|
api: API
|
||||||
bulk: Envio em massa
|
bulk: Envio em massa
|
||||||
@@ -4474,6 +4478,7 @@ pt: &pt
|
|||||||
range_without_total: "%{from}-%{to} eventos"
|
range_without_total: "%{from}-%{to} eventos"
|
||||||
|
|
||||||
de: &de
|
de: &de
|
||||||
|
click_here_to_send_a_reset_password_email_html: '<label class="link" for="resend_password_button">Klicken Sie hier</label>, um eine E-Mail zum Zurücksetzen des Passworts zu senden.'
|
||||||
enabled: Aktiviert
|
enabled: Aktiviert
|
||||||
disabled: Deaktiviert
|
disabled: Deaktiviert
|
||||||
expirable_file_download_links: Ablaufbare Datei-Download-Links
|
expirable_file_download_links: Ablaufbare Datei-Download-Links
|
||||||
@@ -5258,7 +5263,7 @@ de: &de
|
|||||||
wrong_password: Falsches Passwort.
|
wrong_password: Falsches Passwort.
|
||||||
current_password: Aktuelles Passwort
|
current_password: Aktuelles Passwort
|
||||||
dont_remember_your_current_password_click_here_to_reset_it_html: 'Sie erinnern sich nicht an Ihr aktuelles Passwort? <label class="link" for="resend_password_button">Klicken Sie hier</label>, um es zurückzusetzen.'
|
dont_remember_your_current_password_click_here_to_reset_it_html: 'Sie erinnern sich nicht an Ihr aktuelles Passwort? <label class="link" for="resend_password_button">Klicken Sie hier</label>, um es zurückzusetzen.'
|
||||||
you_will_receive_an_email_with_password_reset_instructions_in_a_few_minutes: Sie erhalten in wenigen Minuten eine E-Mail mit Anweisungen zum Zurücksetzen Ihres Passworts.
|
an_email_with_password_reset_instructions_has_been_sent: Eine E-Mail mit Anweisungen zum Zurücksetzen Ihres Passworts wurde Ihnen in wenigen Minuten zugesendet.
|
||||||
submission_sources:
|
submission_sources:
|
||||||
api: API
|
api: API
|
||||||
bulk: Massenversand
|
bulk: Massenversand
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ RSpec.describe 'Profile Settings' do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
|
|
||||||
|
allow(Accounts).to receive(:can_send_emails?).and_return(true)
|
||||||
|
|
||||||
visit settings_profile_index_path
|
visit settings_profile_index_path
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -79,7 +82,7 @@ RSpec.describe 'Profile Settings' do
|
|||||||
find('label', text: 'Click here').click
|
find('label', text: 'Click here').click
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content('You will receive an email with password reset instructions in a few minutes.')
|
expect(page).to have_content('An email with password reset instructions has been sent.')
|
||||||
|
|
||||||
email = ActionMailer::Base.deliveries.last
|
email = ActionMailer::Base.deliveries.last
|
||||||
reset_password_url = email.body
|
reset_password_url = email.body
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ RSpec.describe 'Team Settings' do
|
|||||||
fill_in 'First name', with: 'Adam'
|
fill_in 'First name', with: 'Adam'
|
||||||
fill_in 'Last name', with: 'Meier'
|
fill_in 'Last name', with: 'Meier'
|
||||||
fill_in 'Email', with: 'adam.meier@example.com'
|
fill_in 'Email', with: 'adam.meier@example.com'
|
||||||
fill_in 'Password', with: 'new_password'
|
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
click_button 'Submit'
|
click_button 'Submit'
|
||||||
|
|||||||
Reference in New Issue
Block a user