SMQ-2958 - Fix failing reset password flow (#2970)

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
This commit is contained in:
Felix Gateru
2025-07-14 17:37:09 +03:00
committed by GitHub
parent 879225f7a8
commit 0dea465fb3
3 changed files with 3 additions and 19 deletions
-4
View File
@@ -292,7 +292,6 @@ func (req passwResetReq) validate() error {
}
type resetTokenReq struct {
Token string `json:"token"`
Password string `json:"password"`
ConfPass string `json:"confirm_password"`
}
@@ -304,9 +303,6 @@ func (req resetTokenReq) validate() error {
if req.ConfPass == "" {
return apiutil.ErrMissingConfPass
}
if req.Token == "" {
return apiutil.ErrBearerToken
}
if req.Password != req.ConfPass {
return apiutil.ErrInvalidResetPass
}
-13
View File
@@ -623,25 +623,14 @@ func TestResetTokenReqValidate(t *testing.T) {
{
desc: "valid request",
req: resetTokenReq{
Token: valid,
Password: secret,
ConfPass: secret,
},
err: nil,
},
{
desc: "empty token",
req: resetTokenReq{
Token: "",
Password: secret,
ConfPass: secret,
},
err: apiutil.ErrBearerToken,
},
{
desc: "empty password",
req: resetTokenReq{
Token: valid,
Password: "",
ConfPass: secret,
},
@@ -650,7 +639,6 @@ func TestResetTokenReqValidate(t *testing.T) {
{
desc: "empty confpass",
req: resetTokenReq{
Token: valid,
Password: secret,
ConfPass: "",
},
@@ -659,7 +647,6 @@ func TestResetTokenReqValidate(t *testing.T) {
{
desc: "mismatching password and confpass",
req: resetTokenReq{
Token: valid,
Password: "secret",
ConfPass: secret,
},
+3 -2
View File
@@ -275,8 +275,9 @@ func (svc service) GenerateResetToken(ctx context.Context, email, host string) e
return errors.Wrap(svcerr.ErrViewEntity, err)
}
issueReq := &grpcTokenV1.IssueReq{
UserId: user.ID,
Type: uint32(smqauth.RecoveryKey),
UserId: user.ID,
UserRole: uint32(user.Role + 1),
Type: uint32(smqauth.RecoveryKey),
}
token, err := svc.token.Issue(ctx, issueReq)
if err != nil {