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