Skip to content

Commit

Permalink
chore: resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kangmingtay committed Mar 3, 2024
1 parent 0963e41 commit 53ea66e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions internal/api/anonymous.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ func (a *API) SignupAnonymously(w http.ResponseWriter, r *http.Request) error {
params.Aud = aud
params.Provider = "anonymous"

// always call this outside of a database transaction as this method
// can be computationally hard and block due to password hashing
newUser, err := params.ToUserModel(false /* <- isSSOUser */)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfigurati
}
if params.Email == "" && params.Phone == "" {
if !api.config.External.AnonymousUsers.Enabled {
return badRequestError("Anonymous sign-ins are disabled")
return unprocessableEntityError("Anonymous sign-ins are disabled")
}
if _, err := api.limitHandler(limiter)(w, r); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (a *API) requireNotAnonymous(w http.ResponseWriter, r *http.Request) (conte
ctx := r.Context()
claims := getClaims(ctx)
if claims.IsAnonymous {
return nil, unauthorizedError("Anonymous user not allowed")
return nil, forbiddenError("Anonymous user not allowed to perform these actions")
}
return ctx, nil
}
Expand Down

0 comments on commit 53ea66e

Please sign in to comment.