Konten: Zugriffe vollständig in account.Store
Handle, Anzeigename, Beschreibung, Profilbilder, Profil- und Kontodaten, Passwortprüfung und das Löschen der kontoeigenen Tabellen lagen als rohes SQL in den Handlern, während account.Store nur Anlegen, Reset und Passwortwechsel kannte. Jetzt ist der Store die eine Stelle für die Tabelle account; die Handler lesen das Formular und antworten. Nebenbei: die Passwortprüfung gab es zweimal mit zwei Texten unter demselben Code auth.bad_password (ChangePassword und checkPassword). Jetzt VerifyPassword mit einem Sentinel, das Formularfeld hängt der Handler an. Profil und Konto gehen als Structs statt Maps über die Leitung, wie die übrigen Antworten. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"kver/internal/account"
|
||||
)
|
||||
|
||||
type profileJSON struct {
|
||||
@@ -75,7 +77,7 @@ func TestProfileBio(t *testing.T) {
|
||||
t.Fatalf("bio: erwartet 200, bekam %d", got)
|
||||
}
|
||||
p := getProfile(t, srv, "alice")
|
||||
if !strings.HasPrefix(p.Bio, "Zeile 1\nZeile 2 ö") || len([]rune(p.Bio)) != maxBioRunes {
|
||||
if !strings.HasPrefix(p.Bio, "Zeile 1\nZeile 2 ö") || len([]rune(p.Bio)) != account.MaxBioRunes {
|
||||
t.Fatalf("bio falsch gespeichert: %q (%d Runen)", p.Bio, len([]rune(p.Bio)))
|
||||
}
|
||||
if p.Entries != 2 {
|
||||
|
||||
Reference in New Issue
Block a user