Skip to content

Commit

Permalink
satellite/console: allow only 6-digit code for account activation
Browse files Browse the repository at this point in the history
Made server to return error in case activation code length is not 6

Issue:
storj/storj-private#671

Change-Id: Ib8ffa999beeed1ee508bcecced8362ed8c0ced74
  • Loading branch information
VitaliiShpital authored and Storj Robot committed Apr 30, 2024
1 parent dcd3ccc commit a2db5e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions satellite/console/consoleweb/consoleapi/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ func (a *Auth) ActivateAccount(w http.ResponseWriter, r *http.Request) {
return
}

if len(activateData.Code) != 6 {
a.serveJSONError(ctx, w, console.ErrValidation.New("the activation code must be 6 characters long"))
return
}

verified, unverified, err := a.service.GetUserByEmailWithUnverified(ctx, activateData.Email)
if err != nil && !console.ErrEmailNotFound.Has(err) {
a.serveJSONError(ctx, w, err)
Expand Down

0 comments on commit a2db5e7

Please sign in to comment.