Skip to content

Commit

Permalink
updated response messages and rebuilt ui/dist
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Sep 2, 2022
1 parent 06a7f1a commit df1a947
Show file tree
Hide file tree
Showing 17 changed files with 690 additions and 688 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The easiest way to interact with the API is to use one of the official SDK clien

## Overview

PocketBase could be used as a standalone app or as a Go framework/toolkit that enables you to build
PocketBase could be [downloaded directly as a standalone app](https://github.com/pocketbase/pocketbase/releases) or it could be used as a Go framework/toolkit which allows you to build
your own custom app specific business logic and still have a single portable executable at the end.

### Installation
Expand Down
2 changes: 1 addition & 1 deletion apis/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func (api *userApi) unlinkExternalAuth(c echo.Context) error {

handlerErr := api.app.OnUserBeforeUnlinkExternalAuthRequest().Trigger(event, func(e *core.UserUnlinkExternalAuthEvent) error {
if err := api.app.Dao().DeleteExternalAuth(externalAuth); err != nil {
return rest.NewBadRequestError("Cannot unlink the external auth reference. Make sure that the user has other linked auth providers OR has an email address.", err)
return rest.NewBadRequestError("Cannot unlink the external auth provider. Make sure that the user has other linked auth providers OR has an email address.", err)
}

return e.HttpContext.NoContent(http.StatusNoContent)
Expand Down
2 changes: 1 addition & 1 deletion core/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ type App interface {
// authenticated user data and token.
OnUserAuthRequest() *hook.Hook[*UserAuthEvent]

// OnUserListExternalAuths hook is triggered on each API user's external auhts list request.
// OnUserListExternalAuths hook is triggered on each API user's external auths list request.
//
// Could be used to validate or modify the response before returning it to the client.
OnUserListExternalAuths() *hook.Hook[*UserListExternalAuthsEvent]
Expand Down
4 changes: 3 additions & 1 deletion daos/external_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,16 @@ func (dao *Dao) DeleteExternalAuth(model *models.ExternalAuth) error {
return err
}

// if the user doesn't have an email, make sure that there
// is at least one other external auth relation available
if user.Email == "" {
allExternalAuths, err := dao.FindAllExternalAuthsByUserId(user.Id)
if err != nil {
return err
}

if len(allExternalAuths) <= 1 {
return errors.New("You cannot delete the only available external auth relation because the user doesn't have an email set.")
return errors.New("You cannot delete the only available external auth relation because the user doesn't have an email address.")
}
}

Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit df1a947

Please sign in to comment.