mirror of https://github.com/docusealco/docuseal
parent
f7be74eb73
commit
284204fd78
@ -0,0 +1,20 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class UsersSendResetPasswordController < ApplicationController
|
||||||
|
load_and_authorize_resource :user
|
||||||
|
|
||||||
|
LIMIT_DURATION = 10.minutes
|
||||||
|
|
||||||
|
def update
|
||||||
|
authorize!(:manage, @user)
|
||||||
|
|
||||||
|
if @user.reset_password_sent_at && @user.reset_password_sent_at > LIMIT_DURATION.ago
|
||||||
|
redirect_back fallback_location: settings_users_path, notice: I18n.t('email_has_been_sent_already')
|
||||||
|
else
|
||||||
|
@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')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,14 +0,0 @@
|
|||||||
export default class extends HTMLElement {
|
|
||||||
connectedCallback () {
|
|
||||||
this.input = document.getElementById(this.dataset.inputId)
|
|
||||||
|
|
||||||
this.input.addEventListener('input', () => {
|
|
||||||
if (this.input.value.trim().length > 0) {
|
|
||||||
this.classList.remove('hidden')
|
|
||||||
} else {
|
|
||||||
this.classList.add('hidden')
|
|
||||||
this.querySelectorAll('input').forEach(input => { input.value = '' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in new issue