File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def names; @authenticators.keys end
65
65
# When only a single argument is given, the authenticator class will be
66
66
# lazily loaded from <tt>Net::IMAP::SASL::#{name}Authenticator</tt> (case is
67
67
# preserved and non-alphanumeric characters are removed..
68
- def add_authenticator ( name , authenticator = nil )
68
+ def add_authenticator ( name , authenticator = nil , warn_overwrite : true )
69
69
key = name . upcase . to_sym
70
70
authenticator ||= begin
71
71
class_name = "#{ name . gsub ( /[^a-zA-Z0-9]/ , "" ) } Authenticator" . to_sym
@@ -75,6 +75,11 @@ def add_authenticator(name, authenticator = nil)
75
75
auth_class . new ( *creds , **props , &block )
76
76
}
77
77
end
78
+ if warn_overwrite && ( original = @authenticators [ key ] )
79
+ warn ( "%p: replacing existing %p authenticator: %p" % [
80
+ self , key , original
81
+ ] , uplevel : 1 )
82
+ end
78
83
@authenticators [ key ] = authenticator
79
84
end
80
85
You can’t perform that action at this time.
0 commit comments