mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
GODT-1381: Use in-memory cache in case local cache is unavailable
- change: refactor GUI notification object - add: global bridge errors - add: when cache on disk cannot be initialized fallback to memory cache - add: show notification for CoD failure - change: do not allow login to IMAP and SMTP when CoD init failed
This commit is contained in:
@ -23,6 +23,7 @@ import (
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/internal/users"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/confirmer"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
||||
goSMTPBackend "github.com/emersion/go-smtp"
|
||||
@ -77,6 +78,11 @@ func newSMTPBackend(
|
||||
func (sb *smtpBackend) Login(_ *goSMTPBackend.ConnectionState, username, password string) (goSMTPBackend.Session, error) {
|
||||
// Called from go-smtp in goroutines - we need to handle panics for each function.
|
||||
defer sb.panicHandler.HandlePanic()
|
||||
|
||||
if sb.bridge.HasError(bridge.ErrLocalCacheUnavailable) {
|
||||
return nil, users.ErrLoggedOutUser
|
||||
}
|
||||
|
||||
username = strings.ToLower(username)
|
||||
|
||||
user, err := sb.bridge.GetUser(username)
|
||||
|
||||
@ -25,6 +25,7 @@ import (
|
||||
|
||||
type bridger interface {
|
||||
GetUser(query string) (bridgeUser, error)
|
||||
HasError(err error) bool
|
||||
}
|
||||
|
||||
type bridgeUser interface {
|
||||
|
||||
Reference in New Issue
Block a user