0
0
Fork 0

Add password challenge to 2FA settings, e-mail notifications (#11878)

Fix #3961
This commit is contained in:
Eugen Rochko 2019-09-18 16:37:27 +02:00 committed by GitHub
parent d0c2c52783
commit e1066cd431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 567 additions and 50 deletions

View file

@ -0,0 +1,8 @@
# frozen_string_literal: true
class Form::Challenge
include ActiveModel::Model
attr_accessor :current_password, :current_username,
:return_to
end

View file

@ -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