mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-10-16 04:26:37 +02:00
Split up plainOrLoginAuth.Start condition
This commit is contained in:
1 parent
c38218ac9c
commit
6f9248de23
1 file changed
+6
-2
+6
-2
@@ -162,8 +162,12 @@ func newPlainOrLoginAuth(username, password, host string) smtp.Auth {
|
||||
// Start lets PLAIN auth do the TLS and host name checks, so the password is never sent in the clear
|
||||
func (a *plainOrLoginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
|
||||
mechanism, resp, err := a.plain.Start(server)
|
||||
if err != nil || slices.Contains(server.Auth, "PLAIN") || !slices.Contains(server.Auth, "LOGIN") {
|
||||
return mechanism, resp, err
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
// Only switch to LOGIN if the server offers it but not PLAIN; otherwise behave like before
|
||||
if !slices.Contains(server.Auth, "LOGIN") || slices.Contains(server.Auth, "PLAIN") {
|
||||
return mechanism, resp, nil
|
||||
}
|
||||
a.login = true
|
||||
return "LOGIN", nil, nil
|
||||
|
||||
Reference in new issue
Block a user