Skip to content

Commit

Permalink
added more descriptive internal password reset error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Sep 15, 2023
1 parent bb0a2dd commit 6e80cb8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Return the response headers and cookies in the `$http.send()` result ([#3310](https://github.com/pocketbase/pocketbase/discussions/3310)).

- Added more descriptive internal error message for missing user/admin email on password reset requests.


## v0.18.5

Expand Down
3 changes: 2 additions & 1 deletion forms/admin_password_reset_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package forms

import (
"errors"
"fmt"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
Expand Down Expand Up @@ -66,7 +67,7 @@ func (form *AdminPasswordResetRequest) Submit(interceptors ...InterceptorFunc[*m

admin, err := form.dao.FindAdminByEmail(form.Email)
if err != nil {
return err
return fmt.Errorf("Failed to fetch admin with email %s: %w", form.Email, err)
}

now := time.Now().UTC()
Expand Down
3 changes: 2 additions & 1 deletion forms/record_password_reset_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package forms

import (
"errors"
"fmt"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
Expand Down Expand Up @@ -69,7 +70,7 @@ func (form *RecordPasswordResetRequest) Submit(interceptors ...InterceptorFunc[*

authRecord, err := form.dao.FindAuthRecordByEmail(form.collection.Id, form.Email)
if err != nil {
return err
return fmt.Errorf("Failed to fetch %s record with email %s: %w", form.collection.Id, form.Email, err)
}

now := time.Now().UTC()
Expand Down

0 comments on commit 6e80cb8

Please sign in to comment.