Cosmetic improvement

This commit is contained in:
Taras Kushnir
2026-01-11 19:30:02 +02:00
parent e1f0e612f3
commit ebdeb3ea05

View File

@@ -158,17 +158,11 @@ func AuthenticateSuite(ctx context.Context, email string, srv *http.ServeMux, xs
}
cookie := resp.Cookies()[idx]
sess, err := sessions.Store.Read(ctx, cookie.Value, false /*skip cache*/)
code, err := TwoFactorCodeFromSession(ctx, cookie.Value, sessions.Store)
if err != nil {
slog.ErrorContext(ctx, "Failed to read server session from session cookie", common.ErrAttr(err))
return cookie, err
}
code, ok := sess.Get(ctx, session.KeyTwoFactorCode).(int)
if !ok {
return nil, errors.New("2FA code not found in session")
}
form = url.Values{}
form.Add(common.ParamCSRFToken, xsrf.Token(email))
form.Add(common.ParamEmail, email)