4 files changed,
9 insertions(+),
7 deletions(-)
Author:
Smirnov Oleksandr
ss2316544@gmail.com
Committed by:
GitHub
noreply@github.com
Committed at:
2024-09-26 22:59:24 +0300
Parent:
2327475
M
internal/service/usersrv/usersrv.go
··· 22 22 RefreshTokens(ctx context.Context, refreshToken string) (dtos.TokensDTO, error) 23 23 Logout(ctx context.Context, userID uuid.UUID) error 24 24 25 - ChangePassword(ctx context.Context, inp dtos.ResetUserPasswordDTO) error 25 + ChangePassword(ctx context.Context, userID uuid.UUID, inp dtos.ResetUserPasswordDTO) error 26 26 27 27 Verify(ctx context.Context, verificationKey string) error 28 28 ResendVerificationEmail(ctx context.Context, credentials dtos.SignInDTO) error ··· 165 165 }, nil 166 166 } 167 167 168 -func (u *UserSrv) ChangePassword(ctx context.Context, inp dtos.ResetUserPasswordDTO) error { 168 +func (u *UserSrv) ChangePassword( 169 + ctx context.Context, 170 + userID uuid.UUID, 171 + inp dtos.ResetUserPasswordDTO, 172 +) error { 169 173 oldPass, err := u.hasher.Hash(inp.CurrentPassword) 170 174 if err != nil { 171 175 return err ··· 176 180 return err 177 181 } 178 182 179 - if err := u.userstore.ChangePassword(ctx, inp.UserID, oldPass, newPass); err != nil { 183 + if err := u.userstore.ChangePassword(ctx, userID, oldPass, newPass); err != nil { 180 184 return err 181 185 } 182 186
M
internal/transport/http/apiv1/auth.go
··· 154 154 155 155 if err := a.usersrv.ChangePassword( 156 156 c.Request.Context(), 157 + a.getUserID(c), 157 158 dtos.ResetUserPasswordDTO{ 158 - UserID: a.getUserID(c), 159 159 CurrentPassword: req.CurrentPassword, 160 160 NewPassword: req.NewPassword, 161 161 }); err != nil {