mirror of
https://github.com/neilalexander/yggmail.git
synced 2026-05-06 03:46:29 +03:00
Back to hex keys after all
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package imapserver
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/emersion/go-imap"
|
||||
"github.com/emersion/go-imap/backend"
|
||||
"github.com/jxskiss/base62"
|
||||
"github.com/neilalexander/yggmail/internal/config"
|
||||
"github.com/neilalexander/yggmail/internal/storage"
|
||||
"github.com/neilalexander/yggmail/internal/utils"
|
||||
@@ -26,7 +26,7 @@ func (b *Backend) Login(_ *imap.ConnInfo, username, password string) (backend.Us
|
||||
return nil, fmt.Errorf("failed to authenticate: wrong domain in username")
|
||||
}
|
||||
}
|
||||
username = base62.EncodeToString(b.Config.PublicKey)
|
||||
username = hex.EncodeToString(b.Config.PublicKey)
|
||||
if authed, err := b.Storage.ConfigTryPassword(password); err != nil {
|
||||
b.Log.Printf("Failed to authenticate IMAP user %q due to error: %s", username, err)
|
||||
return nil, fmt.Errorf("failed to authenticate: %w", err)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package imapserver
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/emersion/go-imap/backend"
|
||||
"github.com/jxskiss/base62"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
@@ -14,7 +14,7 @@ type User struct {
|
||||
}
|
||||
|
||||
func (u *User) Username() string {
|
||||
return base62.EncodeToString(u.backend.Config.PublicKey)
|
||||
return hex.EncodeToString(u.backend.Config.PublicKey)
|
||||
}
|
||||
|
||||
func (u *User) ListMailboxes(subscribed bool) (mailboxes []backend.Mailbox, err error) {
|
||||
|
||||
Reference in New Issue
Block a user