1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-06-24 09:16:49 +02:00

[#6402] load the request info context during password/OAuth2/OTP authentication

This commit is contained in:
Gani Georgiev
2025-02-10 16:56:48 +02:00
parent 6a7f3a21fb
commit 26f0df36bc
8 changed files with 57 additions and 1 deletions

View File

@ -269,6 +269,20 @@ func TestRecordAuthWithOTP(t *testing.T) {
if err := app.Save(otp); err != nil {
t.Fatal(err)
}
// test at least once that the correct request info context is properly loaded
app.OnRecordAuthRequest().BindFunc(func(e *core.RecordAuthRequestEvent) error {
info, err := e.RequestInfo()
if err != nil {
t.Fatal(err)
}
if info.Context != core.RequestInfoContextOTP {
t.Fatalf("Expected request context %q, got %q", core.RequestInfoContextOTP, info.Context)
}
return e.Next()
})
},
ExpectedStatus: 200,
ExpectedContent: []string{