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 @@ -60,7 +60,7 @@ def names; @authenticators.keys end
60
60
# When only a single argument is given, the authenticator class will be
61
61
# lazily loaded from <tt>Net::IMAP::SASL::#{name}Authenticator</tt> (case is
62
62
# preserved and non-alphanumeric characters are removed..
63
- def add_authenticator ( name , authenticator = nil )
63
+ def add_authenticator ( name , authenticator = nil , warn_overwrite : true )
64
64
key = name . upcase . to_sym
65
65
authenticator ||= begin
66
66
class_name = "#{ name . gsub ( /[^a-zA-Z0-9]/ , "" ) } Authenticator" . to_sym
@@ -70,6 +70,11 @@ def add_authenticator(name, authenticator = nil)
70
70
auth_class . new ( *creds , **props , &block )
71
71
}
72
72
end
73
+ if warn_overwrite && ( original = @authenticators [ key ] )
74
+ warn ( "%p: replacing existing %p authenticator: %p" % [
75
+ self , key , original
76
+ ] , uplevel : 1 )
77
+ end
73
78
@authenticators [ key ] = authenticator
74
79
end
75
80
You can’t perform that action at this time.
0 commit comments