Add password challenge to 2FA settings, e-mail notifications (#11878)
Fix #3961
This commit is contained in:
parent
d0c2c52783
commit
e1066cd431
32 changed files with 567 additions and 50 deletions
8
app/models/form/challenge.rb
Normal file
8
app/models/form/challenge.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::Challenge
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_accessor :current_password, :current_username,
|
||||
:return_to
|
||||
end
|
|
@ -264,17 +264,20 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
def password_required?
|
||||
return false if Devise.pam_authentication || Devise.ldap_authentication
|
||||
return false if external?
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def send_reset_password_instructions
|
||||
return false if encrypted_password.blank? && (Devise.pam_authentication || Devise.ldap_authentication)
|
||||
return false if encrypted_password.blank?
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def reset_password!(new_password, new_password_confirmation)
|
||||
return false if encrypted_password.blank? && (Devise.pam_authentication || Devise.ldap_authentication)
|
||||
return false if encrypted_password.blank?
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue